Samuel Mokrani
/
USBAudio_HelloWorld
USBAudio Hello World
Diff: main.cpp
- Revision:
- 1:d712dff4f9ca
- Parent:
- 0:3a00949fdb07
- Child:
- 3:c16e446c439a
diff -r 3a00949fdb07 -r d712dff4f9ca main.cpp --- a/main.cpp Wed Nov 30 09:49:14 2011 +0000 +++ b/main.cpp Wed Nov 30 10:31:06 2011 +0000 @@ -12,21 +12,21 @@ #define NB_CHA 1 // length of an audio packet: each ms, we receive 48 * 16bits ->48 * 2 bytes. as there is one channel, the length will be 48 * 2 * 1 -#define LENGTH_PACKET 48 * 2 * 1 +#define AUDIO_LENGTH_PACKET 48 * 2 * 1 // USBAudio USBAudio audio(FREQ, NB_CHA); int main() { - uint8_t buf[LENGTH_PACKET]; + int16_t buf[AUDIO_LENGTH_PACKET/2]; while (1) { // read an audio packet - audio.read(buf); + audio.read((uint8_t *)buf); // print packet received pc.printf("recv: "); - for(int i = 0; i < LENGTH_PACKET; i++) { + for(int i = 0; i < AUDIO_LENGTH_PACKET/2; i++) { pc.printf("%d ", buf[i]); } pc.printf("\r\n");