USBAudio Hello World

Dependencies:   mbed USBDevice

Files at this revision

API Documentation at this revision

Comitter:
samux
Date:
Wed Nov 30 10:31:06 2011 +0000
Parent:
0:3a00949fdb07
Child:
2:6a0a685c93e5
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- 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");