- /* Only generate audio if the board button is being pressed */\r
- int16_t Sample_16Bit = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0;\r
+ /* Only generate audio if the board button is being pressed */\r
+ AudioSample = (Buttons_GetStatus() & BUTTONS_BUTTON1) ? CurrentWaveValue : 0;\r
+ #else\r
+ /* Audio sample is ADC value scaled to fit the entire range */\r
+ AudioSample = ((SAMPLE_MAX_RANGE / ADC_MAX_RANGE) * ADC_GetResult());\r
+\r
+ #if defined(MICROPHONE_BIASED_TO_HALF_RAIL)\r
+ /* Microphone is biased to half rail voltage, subtract the bias from the sample value */\r
+ AudioSample -= (SAMPLE_MAX_RANGE / 2);\r
+ #endif \r
+ #endif\r