Skip to content

Commit 528fb62

Browse files
committed
smaller fixes to modules
1 parent 0a78c8d commit 528fb62

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

src/modules/buffer-switch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class BufferProcessor extends AudioWorkletProcessor {
5353
sourceSampleRate: that.sourceSamplerate,
5454
emitterBufferSize: that.emitterBufferSize,
5555
channelCount: that.channelCount,
56-
inputPassThrough: that.inputPassThrough
56+
passThroughMode: that.passThroughMode
5757
}
5858
});
5959
}

src/modules/example-processor.js

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ class ExampleProcessor extends AudioWorkletProcessor {
1717
this.sourceSamplerate = options.processorOptions.ctxInfo.sampleRate; //INFO: should be same as global scope 'sampleRate'
1818
this.targetSamplerate = options.processorOptions.targetSamplerate || options.processorOptions.ctxInfo.targetSampleRate || 16000;
1919

20+
this.emitterBufferSize = options.processorOptions.bufferSize || 512;
21+
this.channelCount = options.processorOptions.channels || 1;
22+
23+
this.passThroughMode = (options.processorOptions.passThroughMode != undefined)? options.processorOptions.passThroughMode : 1; //0: nothing, 1: original
24+
2025
//ready
2126
function ready(){
2227
//do some stuff...
@@ -30,10 +35,8 @@ class ExampleProcessor extends AudioWorkletProcessor {
3035
sourceSamplerate: that.sourceSamplerate,
3136
targetSamplerate: that.targetSamplerate,
3237
emitterBufferSize: that.emitterBufferSize,
33-
calculateRmsVolume: that.calculateRmsVolume,
3438
channelCount: that.channelCount,
35-
resamplingMode: that.resamplingMode,
36-
inputPassThrough: that.inputPassThrough
39+
passThroughMode: that.passThroughMode
3740
}
3841
});
3942
}
@@ -107,12 +110,16 @@ class ExampleProcessor extends AudioWorkletProcessor {
107110

108111
//transfer input to output
109112
for (let i = 0; i < inputSampleSize; ++i){
110-
let sampleVal = input[0][i]; //TODO: ONLY MONO!
113+
let sampleVal = input[0][i]; //often used: MONO
114+
115+
//... do something with sampleVal ...
111116

112-
//pass through
113-
output[0][i] = sampleVal;
117+
//pass through input to output?
118+
if (this.passThroughMode == 1){
119+
output[0][i] = input[0][i];
120+
}
114121
}
115-
122+
116123
//Send info
117124
/*
118125
this.port.postMessage({

src/modules/speex-resample-switch.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/wave-encoder-worker.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ function gateControl(open, gateOptions){
184184
gateIsOpen = false;
185185
msg.gate.openedAt = _gateOpenTS;
186186
msg.gate.closedAt = _gateCloseTS;
187+
var closedDueToBufferLimit = (recordedBuffers && recordBufferMaxN
188+
&& recordedBuffers.length && recordedBuffers.length >= recordBufferMaxN);
189+
if (closedDueToBufferLimit){
190+
msg.gate.bufferOrTimeLimit = true;
191+
}
187192
}
188193
msg.gate.isOpen = gateIsOpen;
189194
postMessage(msg);

0 commit comments

Comments
 (0)