@grame/faustwasm 0.6.0 → 0.6.3

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.
@@ -50,11 +50,8 @@ audioContext.suspend();
50
50
  await connectToAudioInput(audioContext, null, faustNode, null);
51
51
  }
52
52
 
53
- // Activate sensor listeners
54
- await faustNode.listenSensors();
55
-
56
53
  // Function to initialize MIDI
57
- function initMIDI(faustNode) {
54
+ function initMIDI() {
58
55
  // Check if the browser supports the Web MIDI API
59
56
  if (navigator.requestMIDIAccess) {
60
57
  navigator.requestMIDIAccess().then(
@@ -72,28 +69,25 @@ audioContext.suspend();
72
69
  }
73
70
  }
74
71
 
75
- // Initialize the MIDI setup
76
- if (FAUST_DSP_VOICES > 0) {
77
- initMIDI(faustNode);
78
- }
72
+ // Function to resume AudioContext, activate MIDI and Sensors on user interaction
73
+ function activateAudioMIDISensors() {
79
74
 
80
- })();
75
+ // Resume the AudioContext
76
+ if (audioContext.state === 'suspended') {
77
+ audioContext.resume();
78
+ }
79
+
80
+ // Activate sensor listeners
81
+ faustNode.listenSensors();
81
82
 
82
- // Function to resume AudioContext on user interaction
83
- function resumeAudioContext() {
84
- if (audioContext.state === 'suspended') {
85
- audioContext.resume();
83
+ // Initialize the MIDI setup
84
+ if (FAUST_DSP_VOICES > 0) {
85
+ initMIDI();
86
+ }
86
87
  }
87
- }
88
88
 
89
- // Add event listeners for user interactions
90
- window.addEventListener('click', resumeAudioContext);
91
- window.addEventListener('touchstart', resumeAudioContext);
89
+ // Add event listeners for user interactions
90
+ window.addEventListener('click', activateAudioMIDISensors);
91
+ window.addEventListener('touchstart', activateAudioMIDISensors);
92
92
 
93
- // Optional: Remove event listeners once the context is resumed
94
- audioContext.onstatechange = function () {
95
- if (audioContext.state === 'running') {
96
- window.removeEventListener('click', resumeAudioContext);
97
- window.removeEventListener('touchstart', resumeAudioContext);
98
- }
99
- };
93
+ })();
package/dist/cjs/index.js CHANGED
@@ -2130,13 +2130,8 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2130
2130
  const matched2 = strMidi.match(/^ctrl\s(\d+)\s(\d+)/);
2131
2131
  const matched1 = strMidi.match(/^ctrl\s(\d+)/);
2132
2132
  if (matched2) {
2133
- console.log("matched2", matched2);
2134
- console.log("matched2[1]", matched2[1]);
2135
- console.log("matched2[2]", matched2[2]);
2136
2133
  this.fCtrlLabel[parseInt(matched2[1])].push({ path: item.address, chan: parseInt(matched2[2]), min: item.min, max: item.max });
2137
2134
  } else if (matched1) {
2138
- console.log("matched1", matched1);
2139
- console.log("matched1[1]", matched1[1]);
2140
2135
  this.fCtrlLabel[parseInt(matched1[1])].push({ path: item.address, chan: 0, min: item.min, max: item.max });
2141
2136
  }
2142
2137
  }
@@ -2406,7 +2401,6 @@ export default ${(_b = jsCode.match(jsCodeHead)) == null ? void 0 : _b[1]};
2406
2401
  if (this.fCtrlLabel[ctrl].length) {
2407
2402
  this.fCtrlLabel[ctrl].forEach((ctrl2) => {
2408
2403
  const { path, chan } = ctrl2;
2409
- console.log("ctrlChange", path, chan, channel);
2410
2404
  if (chan === 0 || channel === chan - 1) {
2411
2405
  this.setParamValue(path, _FaustBaseWebAudioDsp.remap(value, 0, 127, ctrl2.min, ctrl2.max));
2412
2406
  if (this.fOutputHandler)