@grame/faustwasm 0.6.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grame/faustwasm",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "WebAssembly version of Faust Compiler",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/esm/index.d.ts",
package/test/organ.dsp CHANGED
@@ -2,7 +2,7 @@ import("stdfaust.lib");
2
2
 
3
3
  timbre(f) = os.osc(f)*0.5 + os.osc(f*2)*0.25 + os.osc(f*3)*0.125;
4
4
 
5
- process = timbre(hslider("freq [midi:ctrl 7]", 440, 20, 10000, 1))
6
- * hslider("gain [color:green]", 0.5, 0, 1, 0.01)
5
+ process = timbre(hslider("freq [midi:ctrl 7]", 440, 20, 3000, 1))
6
+ * hslider("gain", 0.5, 0, 1, 0.01)
7
7
  * (button("gate") : en.adsr(0.1,0.1,0.98,1.5));
8
8
 
package/test/organ1.dsp CHANGED
@@ -3,6 +3,6 @@ import("stdfaust.lib");
3
3
  timbre(f) = os.osc(f)*0.5 + os.osc(f*2)*0.25 + os.osc(f*3)*0.125;
4
4
  effect = _*(hslider("Left", 0.1, 0, 1, 0.01)), _*(hslider("Right", 0.1, 0, 1, 0.01));
5
5
 
6
- process = timbre(hslider("freq", 440, 20, 10000, 1))
6
+ process = timbre(hslider("freq", 440, 20, 3000, 1))
7
7
  * hslider("gain", 0.5, 0, 1, 0.01)
8
8
  * (button("gate") : en.adsr(0.1,0.1,0.98,1.5));