Skip to content

Commit d360e04

Browse files
Updates for the audio pipeline refactor (WIP).
1 parent b8e5dfa commit d360e04

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

codal.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"target": {
33
"name": "codal-microbit-v2",
44
"url": "https://github.com/lancaster-university/codal-microbit-v2",
5-
"branch": "master",
5+
"branch": "audio-refactor",
66
"type": "git"
77
},
88
"config":{

source/samples/MicrophoneTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mems_mic_test()
7676
void
7777
mems_mic_zero_offset_test()
7878
{
79-
LevelDetectorSPL* levelSPL = new LevelDetectorSPL(uBit.audio.processor->output, 85.0, 65.0, 16.0, 0, DEVICE_ID_SYSTEM_LEVEL_DETECTOR, false);
79+
LevelDetectorSPL* levelSPL = new LevelDetectorSPL(uBit.audio.processor->output, 85.0, 65.0, 16.0, 0, DEVICE_ID_SYSTEM_LEVEL_DETECTOR);
8080
uBit.audio.activateMic();
8181

8282
char float_str[20];

source/samples/OOB_v3.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ static void onButtonLogo(MicroBitEvent) {
212212

213213
int sampleRate = 11000;
214214
static SplitterChannel *splitterChannel = uBit.audio.splitter->createChannel();
215-
splitterChannel->requestSampleRate( sampleRate );
215+
// FIXME: Update this to use the new requestSampleRate
216+
// splitterChannel->requestSampleRate( sampleRate );
216217

217218
// Uncomment these two lines and comment out the *recording declaration after them to insert a low-pass-filter.
218219
// static LowPassFilter *lowPassFilter = new LowPassFilter(*splitterChannel, 0.812313f, false);

source/samples/StreamAPITest.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ void stream_test_record() {
5858
static StreamRecording * recording = new StreamRecording( *input );
5959
static MixerChannel * output = uBit.audio.mixer.addChannel( *recording );
6060

61-
input->requestSampleRate( 11000 );
61+
// FIXME: Update this to use the new requestSampleRate
62+
// input->requestSampleRate( 11000 );
6263
output->setSampleRate( 11000 );
6364
output->setVolume( CONFIG_MIXER_INTERNAL_RANGE * 0.8 ); // 80% volume
6465

@@ -67,7 +68,8 @@ void stream_test_record() {
6768
uBit.display.printChar( '1', 1000 );
6869

6970
uBit.display.printChar( 'R' );
70-
input->requestSampleRate( 11000 );
71+
// FIXME: Update this to use the new requestSampleRate
72+
// input->requestSampleRate( 11000 );
7173
recording->recordAsync();
7274
while( recording->isRecording() ) {
7375
uBit.display.printChar( '~' );
@@ -99,7 +101,8 @@ static const int STRSR_SAMPLE_RATE = 11000;
99101

100102
static void strsr_handle_buttonA(MicroBitEvent) {
101103
static SplitterChannel *splitterChannel = uBit.audio.splitter->createChannel();
102-
splitterChannel->requestSampleRate(STRSR_SAMPLE_RATE);
104+
// FIXME: Update this to use the new requestSampleRate
105+
// splitterChannel->requestSampleRate(STRSR_SAMPLE_RATE);
103106
static StreamRecording *recording = new StreamRecording(*splitterChannel);
104107
static MixerChannel *channel = uBit.audio.mixer.addChannel(*recording, STRSR_SAMPLE_RATE);
105108

@@ -114,20 +117,24 @@ static void strsr_handle_buttonA(MicroBitEvent) {
114117
uBit.display.clear();
115118
uBit.audio.levelSPL->setUnit(LEVEL_DETECTOR_SPL_8BIT);
116119

117-
splitterChannel->requestSampleRate( STRSR_SAMPLE_RATE );
120+
// FIXME: Update this to use the new requestSampleRate
121+
// splitterChannel->requestSampleRate( STRSR_SAMPLE_RATE );
118122

119123
DMESG( "RECORDING" );
120124
recording->recordAsync();
121125
bool showR = true;
122126
while (uBit.buttonA.isPressed()) {
123127
if( uBit.logo.isPressed() ) {
124-
splitterChannel->requestSampleRate( abs((uBit.accelerometer.getRoll()-90) * 100) );
128+
// FIXME: Update this to use the new requestSampleRate
129+
// splitterChannel->requestSampleRate( abs((uBit.accelerometer.getRoll()-90) * 100) );
125130
DMESG( "Sample Rate: %d (mic = %d)", (int)splitterChannel->getSampleRate(), (int)uBit.audio.mic->getSampleRate() );
126131
} else {
127-
if( uBit.buttonB.isPressed() )
128-
splitterChannel->requestSampleRate( 5000 );
129-
else
130-
splitterChannel->requestSampleRate( STRSR_SAMPLE_RATE );
132+
if( uBit.buttonB.isPressed() ) {}
133+
// FIXME: Update this to use the new requestSampleRate
134+
// splitterChannel->requestSampleRate( 5000 );
135+
else {}
136+
// FIXME: Update this to use the new requestSampleRate
137+
// splitterChannel->requestSampleRate( STRSR_SAMPLE_RATE );
131138
}
132139

133140
if (showR)

0 commit comments

Comments
 (0)