Add splitComputation option to node.configure()
This commit is contained in:
parent
49dc7bf6b9
commit
aabe5abf4c
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user