diff --git a/web/emscripten/main.cpp b/web/emscripten/main.cpp index d6f2e41..6a1036e 100644 --- a/web/emscripten/main.cpp +++ b/web/emscripten/main.cpp @@ -46,8 +46,8 @@ extern "C" { void EMSCRIPTEN_KEEPALIVE presetCheaper(int nChannels, Sample sampleRate) { stretch.presetCheaper(nChannels, sampleRate); } - void EMSCRIPTEN_KEEPALIVE configure(int nChannels, int blockSamples, int intervalSamples) { - stretch.configure(nChannels, blockSamples, intervalSamples); + void EMSCRIPTEN_KEEPALIVE configure(int nChannels, int blockSamples, int intervalSamples, bool splitComputation) { + stretch.configure(nChannels, blockSamples, intervalSamples, splitComputation); } void EMSCRIPTEN_KEEPALIVE setTransposeFactor(Sample multiplier, Sample tonalityLimit) { stretch.setTransposeFactor(multiplier, tonalityLimit); diff --git a/web/web-wrapper.js b/web/web-wrapper.js index b54a0c7..5138d5a 100644 --- a/web/web-wrapper.js +++ b/web/web-wrapper.js @@ -27,9 +27,11 @@ function registerWorkletProcessor(Module, audioNodeKey) { let remoteMethods = { configure: config => { - let blockChanged = (config.blockMs != this.config.blockMs || config.intervalMs != this.config.intervalMs); Object.assign(this.config, config); - if (config.blockMs && blockChanged) this.configure(); + this.configure(); + }, + latency: _ => { + return this.inputLatencySeconds + this.outputLatencySeconds; }, setUpdateInterval: seconds => { this.timeIntervalSamples = sampleRate*seconds; @@ -182,8 +184,11 @@ function registerWorkletProcessor(Module, audioNodeKey) { if (this.config.blockMs) { let blockSamples = Math.round(this.config.blockMs/1000*sampleRate); let intervalSamples = Math.round((this.config.intervalMs || this.config.blockMs*0.25)/1000*sampleRate); - this.wasmModule._configure(this.channels, blockSamples, intervalSamples); + let splitComputation = this.config.splitComputation; + this.wasmModule._configure(this.channels, blockSamples, intervalSamples, splitComputation); this.wasmModule._reset(); + } else if (this.config.preset == 'cheaper') { + this.wasmModule._presetCheaper(this.channels, sampleRate); } else { this.wasmModule._presetDefault(this.channels, sampleRate); }