@grame/faustwasm 0.0.57 → 0.0.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/0001-Rework-polyphonic-effect-mode.patch +122 -0
- package/assets/standalone/faustwasm/index.d.ts +1 -1
- package/assets/standalone/faustwasm/index.js +63 -21
- package/assets/standalone/faustwasm/index.js.map +2 -2
- package/assets/standalone/index-poly.js +2 -1
- package/assets/standalone/index.js +2 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +63 -21
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs-bundle/index.d.ts +1 -1
- package/dist/cjs-bundle/index.js +63 -21
- package/dist/cjs-bundle/index.js.map +2 -2
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +63 -21
- package/dist/esm/index.js.map +2 -2
- package/dist/esm-bundle/index.d.ts +1 -1
- package/dist/esm-bundle/index.js +63 -21
- package/dist/esm-bundle/index.js.map +2 -2
- package/package.json +1 -1
- package/src/FaustDspGenerator.ts +70 -23
- package/src/faust2wasmFiles.js +1 -1
- package/test/bug/bug.html +84 -0
- package/test/bug/bug.js +216 -0
- package/test/bug/bug.json +124 -0
- package/test/bug/bug.wasm +0 -0
- package/test/bug/bug_effect.json +95 -0
- package/test/bug/bug_effect.wasm +0 -0
- package/test/bug/faust-ui/index.css +416 -0
- package/test/bug/faust-ui/index.css.map +1 -0
- package/test/bug/faust-ui/index.d.ts +1 -0
- package/test/bug/faust-ui/index.js +3476 -0
- package/test/bug/faust-ui/index.js.map +1 -0
- package/test/bug/faustwasm/index.d.ts +1294 -0
- package/test/bug/faustwasm/index.js +3874 -0
- package/test/bug/faustwasm/index.js.map +7 -0
- package/test/bug/mixerModule.wasm +0 -0
- package/test/bug.dsp +22 -0
- package/test/clarinet.dsp +2 -1
- package/test/{p-dj.dsp → djembe.dsp} +0 -2
- package/test/faustlive-wasm/faustwasm/index.d.ts +1 -1
- package/test/faustlive-wasm/faustwasm/index.js +63 -21
- package/test/faustlive-wasm/faustwasm/index.js.map +2 -2
- package/test/gain.dsp +2 -0
- package/test/guitar.dsp +2 -1
- package/test/guitar1.dsp +2 -1
- package/test/libfaust-in-worklet/index.js +33 -33
- package/test/midi.dsp +0 -1
- package/test/web/index.js +217 -217
- package/test/Sinusoide.dsp +0 -60
- package/test/t1.dsp +0 -1
package/dist/esm/index.d.ts
CHANGED
|
@@ -1278,7 +1278,7 @@ export declare class FaustPolyDspGenerator implements IFaustPolyDspGenerator {
|
|
|
1278
1278
|
mixerBuffer: Uint8Array;
|
|
1279
1279
|
mixerModule: WebAssembly.Module;
|
|
1280
1280
|
constructor();
|
|
1281
|
-
compile(compiler: IFaustCompiler, name: string,
|
|
1281
|
+
compile(compiler: IFaustCompiler, name: string, dspCodeAux: string, args: string, effectCodeAux?: string): Promise<this | null>;
|
|
1282
1282
|
createNode<SP extends boolean = false>(context: BaseAudioContext, voices: number, name?: string, voiceFactory?: LooseFaustDspFactory, mixerModule?: WebAssembly.Module, effectFactory?: LooseFaustDspFactory | null, sp?: SP, bufferSize?: number, processorName?: string): Promise<SP extends true ? FaustPolyScriptProcessorNode | null : FaustPolyAudioWorkletNode | null>;
|
|
1283
1283
|
createAudioWorkletProcessor(name?: string, voiceFactory?: LooseFaustDspFactory, effectFactory?: LooseFaustDspFactory | null, processorName?: string): Promise<{
|
|
1284
1284
|
new (options: AudioWorkletNodeOptions): AudioWorkletProcessor;
|
package/dist/esm/index.js
CHANGED
|
@@ -3636,31 +3636,73 @@ var _FaustPolyDspGenerator = class {
|
|
|
3636
3636
|
this.voiceFactory = null;
|
|
3637
3637
|
this.effectFactory = null;
|
|
3638
3638
|
}
|
|
3639
|
-
async compile(compiler, name,
|
|
3640
|
-
|
|
3641
|
-
adapt(2,2) = _,_;
|
|
3642
|
-
adapt(1,2) = _ <: _,_;
|
|
3643
|
-
adapt(2,1) = _,_ :> _;
|
|
3644
|
-
adaptor(F,G) = adapt(outputs(F),inputs(G));
|
|
3645
|
-
dsp_code = environment{
|
|
3646
|
-
${dspCode}
|
|
3639
|
+
async compile(compiler, name, dspCodeAux, args, effectCodeAux = `dsp_code = environment{
|
|
3640
|
+
${dspCodeAux}
|
|
3647
3641
|
};
|
|
3648
|
-
process =
|
|
3649
|
-
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
3650
|
-
if (!this.voiceFactory)
|
|
3651
|
-
return null;
|
|
3642
|
+
process = dsp_code.effect;`) {
|
|
3652
3643
|
try {
|
|
3653
|
-
this.effectFactory = await compiler.createPolyDSPFactory(name,
|
|
3644
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCodeAux, args);
|
|
3645
|
+
if (this.effectFactory) {
|
|
3646
|
+
const effectJSON = JSON.parse(this.effectFactory.json);
|
|
3647
|
+
const dspCode = `
|
|
3648
|
+
// Voice output is forced to 2, when DSP is stereo or effect has 2 ins or 2 outs,
|
|
3649
|
+
// so that the effect can process the 2 channels of the voice
|
|
3650
|
+
adaptOut(1,1,1) = _;
|
|
3651
|
+
adaptOut(1,1,2) = _ <: _,_;
|
|
3652
|
+
adaptOut(1,2,1) = _ <: _,_;
|
|
3653
|
+
adaptOut(1,2,2) = _ <: _,_;
|
|
3654
|
+
adaptOut(2,1,1) = _,_;
|
|
3655
|
+
adaptOut(2,1,2) = _,_;
|
|
3656
|
+
adaptOut(2,2,1) = _,_;
|
|
3657
|
+
adaptOut(2,2,2) = _,_;
|
|
3658
|
+
adaptor(F) = adaptOut(outputs(F),${effectJSON.inputs},${effectJSON.outputs});
|
|
3659
|
+
dsp_code = environment{
|
|
3660
|
+
${dspCodeAux}
|
|
3661
|
+
};
|
|
3662
|
+
process = dsp_code.process : adaptor(dsp_code.process);`;
|
|
3663
|
+
const effectCode = `
|
|
3664
|
+
// Inputs
|
|
3665
|
+
adaptIn(1,1,1) = _;
|
|
3666
|
+
adaptIn(1,1,2) = _,*(0) :> _; // The voice output was duplicated, so only one channel has to be kept
|
|
3667
|
+
adaptIn(1,2,1) = _,_;
|
|
3668
|
+
adaptIn(1,2,2) = _,_;
|
|
3669
|
+
adaptIn(2,1,1) = _,_ :> _;
|
|
3670
|
+
adaptIn(2,1,2) = _,_ :> _;
|
|
3671
|
+
adaptIn(2,2,1) = _,_;
|
|
3672
|
+
adaptIn(2,2,2) = _,_;
|
|
3673
|
+
// Outputs
|
|
3674
|
+
adaptOut(1,1) = _ <: _,*(0); // The left channel is kept, but the right one has to be cleared
|
|
3675
|
+
adaptOut(1,2) = _,_;
|
|
3676
|
+
adaptOut(2,1) = _ <: _,*(0); // The left channel is kept, but the right one has to be cleared
|
|
3677
|
+
adaptOut(2,2) = _,_;
|
|
3678
|
+
adaptorIns(F) = adaptIn(outputs(F),${effectJSON.inputs},${effectJSON.outputs});
|
|
3679
|
+
adaptorOuts = adaptOut(${effectJSON.inputs},${effectJSON.outputs});
|
|
3680
|
+
dsp_code = environment{
|
|
3681
|
+
${dspCodeAux}
|
|
3682
|
+
};
|
|
3683
|
+
process = adaptorIns(dsp_code.process) : dsp_code.effect : adaptorOuts;`;
|
|
3684
|
+
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCode, args);
|
|
3685
|
+
try {
|
|
3686
|
+
this.effectFactory = await compiler.createPolyDSPFactory(name, effectCode, args + " -inpl");
|
|
3687
|
+
} catch (e) {
|
|
3688
|
+
console.log(e);
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3654
3691
|
} catch (e) {
|
|
3655
|
-
console.
|
|
3692
|
+
console.log(e);
|
|
3693
|
+
this.voiceFactory = await compiler.createPolyDSPFactory(name, dspCodeAux, args);
|
|
3694
|
+
}
|
|
3695
|
+
if (this.voiceFactory) {
|
|
3696
|
+
this.name = name;
|
|
3697
|
+
const voiceMeta = JSON.parse(this.voiceFactory.json);
|
|
3698
|
+
const isDouble = voiceMeta.compile_options.match("-double");
|
|
3699
|
+
const { mixerBuffer, mixerModule } = await compiler.getAsyncInternalMixerModule(!!isDouble);
|
|
3700
|
+
this.mixerBuffer = mixerBuffer;
|
|
3701
|
+
this.mixerModule = mixerModule;
|
|
3702
|
+
return this;
|
|
3703
|
+
} else {
|
|
3704
|
+
return null;
|
|
3656
3705
|
}
|
|
3657
|
-
this.name = name;
|
|
3658
|
-
const voiceMeta = JSON.parse(this.voiceFactory.json);
|
|
3659
|
-
const isDouble = voiceMeta.compile_options.match("-double");
|
|
3660
|
-
const { mixerBuffer, mixerModule } = await compiler.getAsyncInternalMixerModule(!!isDouble);
|
|
3661
|
-
this.mixerBuffer = mixerBuffer;
|
|
3662
|
-
this.mixerModule = mixerModule;
|
|
3663
|
-
return this;
|
|
3664
3706
|
}
|
|
3665
3707
|
async createNode(context, voices, name = this.name, voiceFactory = this.voiceFactory, mixerModule = this.mixerModule, effectFactory = this.effectFactory, sp = false, bufferSize = 1024, processorName = ((voiceFactory == null ? void 0 : voiceFactory.shaKey) || "") + ((effectFactory == null ? void 0 : effectFactory.shaKey) || "") || `${name}_poly`) {
|
|
3666
3708
|
var _a, _b;
|