@grame/faustwasm 0.3.0 → 0.3.1

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.
@@ -25,6 +25,7 @@ const AudioCtx = window.AudioContext || window.webkitAudioContext;
25
25
  const audioContext = new AudioCtx({ latencyHint: 0.00001, echoCancellation: false, autoGainControl: false, noiseSuppression: false });
26
26
  audioContext.destination.channelInterpretation = "discrete";
27
27
  audioContext.suspend();
28
+ $buttonDsp.disabled = true;
28
29
 
29
30
  /**
30
31
  * @param {FaustAudioWorkletNode} faustNode
@@ -107,17 +108,6 @@ const buildMidiDeviceMenu = async (faustNode) => {
107
108
  };
108
109
  };
109
110
 
110
- $buttonDsp.disabled = true;
111
- $buttonDsp.onclick = () => {
112
- if (audioContext.state === "running") {
113
- $buttonDsp.textContent = "Suspended";
114
- audioContext.suspend();
115
- } else if (audioContext.state === "suspended") {
116
- $buttonDsp.textContent = "Running";
117
- audioContext.resume();
118
- }
119
- }
120
-
121
111
  /**
122
112
  * Creates a Faust audio node for use in the Web Audio API.
123
113
  *
@@ -216,4 +206,18 @@ const createFaustUI = async (faustNode) => {
216
206
  else $spanMidiInput.hidden = true;
217
207
  $buttonDsp.disabled = false;
218
208
  document.title = name;
209
+ let motionHandlersBound = false;
210
+ $buttonDsp.onclick = async () => {
211
+ if (!motionHandlersBound) {
212
+ await faustNode.listenSensors();
213
+ motionHandlersBound = true;
214
+ }
215
+ if (audioContext.state === "running") {
216
+ $buttonDsp.textContent = "Suspended";
217
+ audioContext.suspend();
218
+ } else if (audioContext.state === "suspended") {
219
+ $buttonDsp.textContent = "Running";
220
+ audioContext.resume();
221
+ }
222
+ }
219
223
  })();
@@ -211,7 +211,7 @@ const createFaustUI = async (faustNode) => {
211
211
  let motionHandlersBound = false;
212
212
  $buttonDsp.onclick = async () => {
213
213
  if (!motionHandlersBound) {
214
- await faustNode.listenMotion();
214
+ await faustNode.listenSensors();
215
215
  motionHandlersBound = true;
216
216
  }
217
217
  if (audioContext.state === "running") {
package/build ADDED
@@ -0,0 +1,18 @@
1
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/atomicro/Atomicro.dsp /Users/letz/Developpements/sletz.github.io/Atomicro -standalone
2
+
3
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/attacKey/AttacKey.dsp /Users/letz/Developpements/sletz.github.io/AttacKey -standalone
4
+
5
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/baliphone/Baliphone.dsp /Users/letz/Developpements/sletz.github.io/Baliphone -standalone
6
+
7
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/attacKey/AttacKey.dsp /Users/letz/Developpements/sletz.github.io/AttacKey -standalone
8
+
9
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/drone/DroneLAN.dsp /Users/letz/Developpements/sletz.github.io/DroneLAN -standalone
10
+
11
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/sequenceur/Sequenceur.dsp /Users/letz/Developpements/sletz.github.io/Sequenceur -standalone
12
+
13
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/shakerxy/ShakerXY.dsp /Users/letz/Developpements/sletz.github.io/ShakerXY -standalone
14
+
15
+ node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/sinusoide/Sinusoide.dsp /Users/letz/Developpements/sletz.github.io/Sinusoide -standalone
16
+
17
+
18
+ #node scripts/faust2wasm.js /Users/letz/Developpements/GameLAN/test.dsp /Users/letz/Developpements/sletz.github.io/out -standalone
@@ -1278,7 +1278,7 @@ export declare class FaustAudioWorkletNode<Poly extends boolean = false> extends
1278
1278
  protected fDescriptor: FaustUIInputItem[];
1279
1279
  constructor(context: BaseAudioContext, name: string, factory: LooseFaustDspFactory, options: FaustAudioWorkletNodeOptions<Poly>["processorOptions"], nodeOptions?: Partial<FaustAudioWorkletNodeOptions>);
1280
1280
  /** Setup accelerometer and gyroscope handlers */
1281
- listenMotion(): Promise<void>;
1281
+ listenSensors(): Promise<void>;
1282
1282
  setOutputParamHandler(handler: OutputParamHandler | null): void;
1283
1283
  getOutputParamHandler(): OutputParamHandler | null;
1284
1284
  setComputeHandler(handler: ComputeHandler | null): void;
@@ -1341,7 +1341,7 @@ export declare class FaustScriptProcessorNode<Poly extends boolean = false> exte
1341
1341
  protected fOutputs: Float32Array[];
1342
1342
  init(instance: Poly extends true ? FaustPolyWebAudioDsp : FaustMonoWebAudioDsp): void;
1343
1343
  /** Setup accelerometer and gyroscope handlers */
1344
- listenMotion(): Promise<void>;
1344
+ listenSensors(): Promise<void>;
1345
1345
  compute(input: Float32Array[], output: Float32Array[]): boolean;
1346
1346
  setOutputParamHandler(handler: OutputParamHandler): void;
1347
1347
  getOutputParamHandler(): OutputParamHandler | null;
package/dist/cjs/index.js CHANGED
@@ -3677,7 +3677,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
3677
3677
  }
3678
3678
  // Public API
3679
3679
  /** Setup accelerometer and gyroscope handlers */
3680
- async listenMotion() {
3680
+ async listenSensors() {
3681
3681
  if (this.hasAccInput) {
3682
3682
  const handleDeviceMotion = ({ accelerationIncludingGravity }) => {
3683
3683
  if (!accelerationIncludingGravity)
@@ -3935,7 +3935,7 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
3935
3935
  }
3936
3936
  // Public API
3937
3937
  /** Setup accelerometer and gyroscope handlers */
3938
- async listenMotion() {
3938
+ async listenSensors() {
3939
3939
  if (this.hasAccInput) {
3940
3940
  const handleDeviceMotion = ({ accelerationIncludingGravity }) => {
3941
3941
  if (!accelerationIncludingGravity)