Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 连接RadioStream和MP3解码器_C++_Arduino - Fatal编程技术网

C++ 连接RadioStream和MP3解码器

C++ 连接RadioStream和MP3解码器,c++,arduino,C++,Arduino,我正在尝试构建一个arduino网络收音机,用于读取流和解码流。我有以下两种写入和读取流的方法,需要连接,但我想不出一个好方法: 在这种方法中,我们读取无线电流并将其内容写入32字节的缓冲区 uint8_t buff[32]; // from the server, read them and print them: while (true) { int ret = client.read(buff, sizeof(buff) / 2 ); if (ret <= 0)

我正在尝试构建一个arduino网络收音机,用于读取流和解码流。我有以下两种写入和读取流的方法,需要连接,但我想不出一个好方法:

在这种方法中,我们读取无线电流并将其内容写入32字节的缓冲区

 uint8_t buff[32];
 // from the server, read them and print them:
while (true)
{
    int ret = client.read(buff, sizeof(buff) / 2 );
    if (ret <= 0)
    break;
    for(int i = 0; i < ret; i++)
    {//instead of Serial write we need to do something with the contents of this buffer

        Serial.write((char)buff[i]);
    }
}
这两种方法需要相互联系,但我不确定如何联系


谢谢大家!

所以基本上我需要的是一个可以异步填充和读取的缓冲区

或者换句话说,消费者和生产者以不同的速度工作


<> P>所以对我来说,一个标准的环形缓冲区,对于几乎每一个平台(包括ARDUIO)

都有很多的实现,“流”,你不是指一个“你”吗?这到底是怎么回事?我只有两个字节的缓冲区需要读取和写入。<代码> IoSturiS/<代码>在C++中有特殊的功能。
    int getMoreData(uint8_t *writeHere, int available)
    {
  /* TODO: write up to 'available' bytes of MP3 data 
   * to the location 'writeHere'. Return the actual number of bytes
   * that were written
   */}