X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/864196c884ef3602aee44f1a68aceb5819a07f21..eff07bb87758a12064d9de9c859b1e6e6502f2ea:/Demos/Device/ClassDriver/AudioInput/AudioInput.c diff --git a/Demos/Device/ClassDriver/AudioInput/AudioInput.c b/Demos/Device/ClassDriver/AudioInput/AudioInput.c index 7b7ca2c11..59d2129f4 100644 --- a/Demos/Device/ClassDriver/AudioInput/AudioInput.c +++ b/Demos/Device/ClassDriver/AudioInput/AudioInput.c @@ -62,8 +62,7 @@ int main(void) for (;;) { - if (Microphone_Audio_Interface.State.InterfaceEnabled) - ProcessNextSample(); + ProcessNextSample(); Audio_Device_USBTask(&Microphone_Audio_Interface); USB_USBTask(); @@ -95,6 +94,7 @@ void SetupHardware(void) */ void ProcessNextSample(void) { + /* Check if the sample reload timer period has elapsed, and that the USB bus is ready for a new sample */ if ((TIFR0 & (1 << OCF0A)) && Audio_Device_IsReadyForNextSample(&Microphone_Audio_Interface)) { TIFR0 |= (1 << OCF0A); @@ -107,7 +107,7 @@ void ProcessNextSample(void) AudioSample -= (SAMPLE_MAX_RANGE / 2)); #endif - Audio_Device_WriteSample16(AudioSample); + Audio_Device_WriteSample16(&Microphone_Audio_Interface, AudioSample); } }