Initialize streams. This function initializes the input and output streams, registers the event callbacks and sets up the stream buffers. */
| 75 | event callbacks and sets up the stream buffers. |
| 76 | */ |
| 77 | static void init_streams (void) { |
| 78 | int32_t rval; |
| 79 | void *out_block; |
| 80 | |
| 81 | /* Setup input stream */ |
| 82 | rval = vStream_AudioIn->Initialize(AudioIn_Event_Callback); |
| 83 | ASSERT(rval == VSTREAM_OK); |
| 84 | |
| 85 | rval = vStream_AudioIn->SetBuf(audio_in_buf, sizeof(audio_in_buf), AUDIO_BUF_BLOCK_SIZE); |
| 86 | ASSERT(rval == VSTREAM_OK); |
| 87 | |
| 88 | /* Setup output stream */ |
| 89 | rval = vStream_AudioOut->Initialize(AudioOut_Event_Callback); |
| 90 | ASSERT(rval == VSTREAM_OK); |
| 91 | |
| 92 | rval = vStream_AudioOut->SetBuf(audio_out_buf, sizeof(audio_out_buf), AUDIO_BUF_BLOCK_SIZE); |
| 93 | ASSERT(rval == VSTREAM_OK); |
| 94 | |
| 95 | /* Output stream will fail to start without data to output. */ |
| 96 | /* Prepare first block of data and release it to the driver. */ |
| 97 | out_block = vStream_AudioOut->GetBlock(); |
| 98 | ASSERT(out_block != NULL); |
| 99 | |
| 100 | memset(out_block, 0x00, AUDIO_BUF_BLOCK_SIZE); |
| 101 | |
| 102 | rval = vStream_AudioOut->ReleaseBlock(); |
| 103 | ASSERT(rval == VSTREAM_OK); |
| 104 | } |
| 105 | |
| 106 | /* |
| 107 | Application main thread. |