node-web-audio-api 0.10.0 → 0.11.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v0.11.0
2
+
3
+ - Update upstream crate to v0.32
4
+ - Implement AudioDestination API
5
+ - Make decodeAudioData(arrayBuffer) API compliant (drop `load` helper)
6
+
1
7
  ## v0.10.0
2
8
 
3
9
  - Update upstream crate to v0.31
package/monkey-patch.js CHANGED
@@ -90,10 +90,9 @@ function patchAudioContext(nativeBinding) {
90
90
  }
91
91
 
92
92
  decodeAudioData(audioData) {
93
- if (!isPlainObject(audioData) || !('path' in audioData)) {
94
- throw new Error(`Invalid argument, please consider using the load helper`);
93
+ if (!audioData instanceof ArrayBuffer) {
94
+ throw new Error('Invalid argument, please provide an ArrayBuffer');
95
95
  }
96
-
97
96
  try {
98
97
  const audioBuffer = super.decodeAudioData(audioData);
99
98
  return Promise.resolve(audioBuffer);
@@ -144,10 +143,9 @@ function patchOfflineAudioContext(nativeBinding) {
144
143
  }
145
144
 
146
145
  decodeAudioData(audioData) {
147
- if (!isPlainObject(audioData) || !('path' in audioData)) {
148
- throw new Error(`Invalid argument, please consider using the load helper`);
146
+ if (!audioData instanceof ArrayBuffer) {
147
+ throw new Error('Invalid argument, please provide an ArrayBuffer');
149
148
  }
150
-
151
149
  try {
152
150
  const audioBuffer = super.decodeAudioData(audioData);
153
151
  return Promise.resolve(audioBuffer);
@@ -160,16 +158,6 @@ function patchOfflineAudioContext(nativeBinding) {
160
158
  return OfflineAudioContext;
161
159
  }
162
160
 
163
- // dumb method provided to mock an xhr call and mimick browser's API
164
- // see also `AudioContext.decodeAudioData`
165
- function load(path) {
166
- if (!fs.existsSync(path)) {
167
- throw new Error(`File not found: "${path}"`);
168
- }
169
-
170
- return { path };
171
- };
172
-
173
161
  module.exports = function monkeyPatch(nativeBinding) {
174
162
  nativeBinding.AudioContext = patchAudioContext(nativeBinding);
175
163
  nativeBinding.OfflineAudioContext = patchOfflineAudioContext(nativeBinding);
@@ -192,8 +180,5 @@ module.exports = function monkeyPatch(nativeBinding) {
192
180
  return Promise.resolve(stream);
193
181
  }
194
182
 
195
- // utils
196
- nativeBinding.load = load;
197
-
198
183
  return nativeBinding;
199
184
  }
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-web-audio-api",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "author": "Benjamin Matuszewski",
5
5
  "description": "Node.js bindings for web-audio-api-rs using napi-rs",
6
6
  "exports": {