Skip to content

Commit b16789c

Browse files
finneyjmicrobit-carlos
authored andcommitted
Default Mixerchannel rate to upstream default on creation.
1 parent efb927c commit b16789c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

inc/Mixer2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class Mixer2 : public DataSource
165165
* @param sampleRate (samples per second) - if set to zero, defaults to the output sample rate of the Mixer
166166
* @param sampleRange (quantization levels) the difference between the maximum and minimum sample level on the input channel
167167
*/
168-
MixerChannel *addChannel(DataSource &stream, float sampleRate = CONFIG_MIXER_DEFAULT_CHANNEL_SAMPLERATE, int sampleRange = CONFIG_MIXER_INTERNAL_RANGE);
168+
MixerChannel *addChannel(DataSource &stream, float sampleRate = 0.0f, int sampleRange = CONFIG_MIXER_INTERNAL_RANGE);
169169

170170
/**
171171
* Removes a channel from the mixer

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-
adc.setSamplePeriod( 1e6 / 11000 );
64+
mic->setSampleRate(11000);
6565
mic->setGain(7, 0);
6666

6767
activateMic();

source/Mixer2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ MixerChannel *Mixer2::addChannel(DataSource &stream, float sampleRate, int sampl
9494
MixerChannel *c = new MixerChannel();
9595
c->stream = &stream;
9696
c->range = sampleRange;
97-
c->rate = sampleRate ? sampleRate : outputRate;
97+
c->rate = sampleRate ? sampleRate : stream.getSampleRate();
9898
c->pullRequests = 0;
9999
c->in = NULL;
100100
c->end = NULL;

0 commit comments

Comments
 (0)