96kHz-16bit USB Audio Output interface with UDA1345 and 24.576MHz Xtal.
Dependencies: I2S USBDevice mbed
Fork of USBAudioPlayback by
Diff: main.cpp
- Revision:
- 4:a3aee5fc768a
- Parent:
- 3:44343b9dd8b6
- Child:
- 5:ca2316551f3d
--- a/main.cpp Tue Feb 04 15:22:19 2014 +0000 +++ b/main.cpp Tue Feb 04 15:35:52 2014 +0000 @@ -10,7 +10,7 @@ // 2channels: stereo #define NB_CHA_SPK 2 -#define NB_CHA_MIC 1 +#define NB_CHA_MIC 0 // length computed: each ms, we receive 48 * 16bits ->48 * 2 bytes. as there are two channels, the length will be 48 * 2 * 2 #define LENGTH_AUDIO_PACKET_SPK (FREQ_SPK / 500) * NB_CHA_SPK @@ -24,7 +24,7 @@ I2S i2s(I2S_TRANSMIT, p5, p6, p7); I2S i2srx(I2S_RECEIVE, p8, p29, p15); -#define CHUNKS 64 +#define CHUNKS 6 int buf_out[LENGTH_AUDIO_PACKET_MIC/sizeof(int)]; int16_t buf_in[CHUNKS][LENGTH_AUDIO_PACKET_SPK/sizeof(int16_t)]; @@ -74,7 +74,7 @@ i2s.start(); while (1) { - audio.readWrite((uint8_t *)buf_in[read_pos++], (uint8_t *)buf_out); + audio.read((uint8_t *)buf_in[read_pos++]); read_pos %= CHUNKS; if (stream_in == NULL && read_pos > CHUNKS / 2) { stream_in = buf_in[write_pos];