Skip to content

Commit fd3d59e

Browse files
finneyjmicrobit-carlos
authored andcommitted
Set default microphone samplerate by a CONFIG option
1 parent b16789c commit fd3d59e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

inc/MicroBitAudio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ DEALINGS IN THE SOFTWARE.
4949
#define CONFIG_AUDIO_INPUT_CHANNELS 4
5050
#endif
5151

52+
#ifndef CONFIG_AUDIO_DEFAULT_MICROPHONE_SAMPLERATE
53+
#define CONFIG_AUDIO_DEFAULT_MICROPHONE_SAMPLERATE 11000
54+
#endif
55+
5256
namespace codal
5357
{
5458
/**

source/MicroBitAudio.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ MicroBitAudio::MicroBitAudio(NRF52Pin &pin, NRF52Pin &speaker, NRF52ADC &adc, NR
6161
synth.allowEmptyBuffers(true);
6262

6363
mic = adc.getChannel(microphone, false);
64-
mic->setSampleRate(11000);
64+
mic->setSampleRate(CONFIG_AUDIO_DEFAULT_MICROPHONE_SAMPLERATE);
6565
mic->setGain(7, 0);
6666

6767
activateMic();

0 commit comments

Comments
 (0)