@@ -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({
0 commit comments