node-web-audio-api 0.12.0 → 0.14.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,46 +1,57 @@
1
- ## v0.12.0
1
+ ## v0.14.0 (06/12/2023)
2
2
 
3
- - Update upstream crate to v0.33 (fix device number of channels > 32)
3
+ - Update upstream create to [v0.38.0](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0380-2023-12-03)
4
+ - Implement AudioListener
4
5
 
5
- ## v0.11.0
6
+ ## v0.13.0 (08/11/2023)
6
7
 
7
- - Update upstream crate to v0.32
8
+ - Update upstream crate to [v0.36.1](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0361-2023-11-08)
9
+ - Ship build for linux arm64
10
+ - Typescript support
11
+
12
+ ## v0.12.0 (04/09/2023)
13
+
14
+ - Update upstream crate to [v0.33](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0330-2023-07-27)
15
+
16
+ ## v0.11.0 (21/07/2023)
17
+
18
+ - Update upstream crate to [v0.32](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0320-2023-07-16)
8
19
  - Implement AudioDestination API
9
20
  - Make decodeAudioData(arrayBuffer) API compliant (drop `load` helper)
10
21
 
11
- ## v0.10.0
22
+ ## v0.10.0 (26/05/2023)
12
23
 
13
- - Update upstream crate to v0.31
24
+ - Update upstream crate to [v0.31](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0310-2023-06-25)
14
25
 
15
- ## v0.9.0
26
+ ## v0.9.0 (08/06/2023)
16
27
 
17
- - Update upstream crate to v0.30
28
+ - Update upstream crate to [v0.30](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0300-2023-06-07)
18
29
 
19
- ## v0.8.0
30
+ ## v0.8.0 (19/05/2023)
20
31
 
21
32
  - Implement MediaDevices enumerateDeviaces and getUserMedia
22
33
  - Use jack as default output if exists on linux
23
34
 
24
- ## v0.7.0
35
+ ## v0.7.0 (23/02/2023)
25
36
 
26
37
  - Improve readme & doc
27
38
  - Fix AudioParam method names
28
39
 
29
- ## v0.6.0 - Feb 2023
40
+ ## v0.6.0 (01/02/2023)
30
41
 
31
42
  - Basic support for mediaDevices & MediaStreamAudioSourceNode
32
43
  - Add bindings to ConvolverNode, AnalyserNode & Panner nodes
33
- - Update upstream crate to v0.26
44
+ - Update upstream crate to [v0.26](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0250-2022-11-06)
34
45
 
35
- ## v0.5.0 - Dec 2022
46
+ ## v0.5.0 (19/12/2022)
36
47
 
37
48
  - Implement AudioParam#setValueCurveAtTime
38
49
  - Offline context constructor
39
50
 
40
- ## v0.4.0 - Nov 2022
51
+ ## v0.4.0 (07/11/2022)
41
52
 
42
53
  - Implement offline audio context
43
- - Update upstream crate to v0.24
54
+ - Update upstream crate to [v0.24](https://github.com/orottier/web-audio-api-rs/blob/main/CHANGELOG.md#version-0240-2022-09-10)
44
55
  - Implement AudioNode#disconnect
45
56
  - Properly support ESM
46
57
  - Limit number of online contexts to 1 on Linux
package/README.md CHANGED
@@ -79,6 +79,7 @@ node examples/granular-scrub.mjs
79
79
  | macOS aarch64 | ✓ | |
80
80
  | Linux x64 gnu | ✓ | |
81
81
  | Linux arm gnueabihf (RPi) | ✓ | ✓ |
82
+ | Linux arm64 gnu (RPi) | ✓ | ✓ |
82
83
 
83
84
 
84
85
  ## Notes for Linux users
package/index.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ // Referencing the default lib web api typings
2
+ /// <reference lib="dom" />
3
+
4
+ declare module "node-web-audio-api" {
5
+ export import AudioContext = globalThis.AudioContext;
6
+ export import OfflineAudioContext = globalThis.OfflineAudioContext;
7
+ export import AudioBuffer = globalThis.AudioBuffer;
8
+ export import PeriodicWave = globalThis.PeriodicWave;
9
+ export import MediaStreamAudioSourceNode = globalThis.MediaStreamAudioSourceNode;
10
+ export import AnalyserNode = globalThis.AnalyserNode;
11
+ export import AudioBufferSourceNode = globalThis.AudioBufferSourceNode;
12
+ export import BiquadFilterNode = globalThis.BiquadFilterNode;
13
+ export import ChannelMergerNode = globalThis.ChannelMergerNode;
14
+ export import ChannelSplitterNode = globalThis.ChannelSplitterNode;
15
+ export import ConstantSourceNode = globalThis.ConstantSourceNode;
16
+ export import ConvolverNode = globalThis.ConvolverNode;
17
+ export import DelayNode = globalThis.DelayNode;
18
+ export import DynamicsCompressorNode = globalThis.DynamicsCompressorNode;
19
+ export import GainNode = globalThis.GainNode;
20
+ export import IIRFilterNode = globalThis.IIRFilterNode;
21
+ export import OscillatorNode = globalThis.OscillatorNode;
22
+ export import PannerNode = globalThis.PannerNode;
23
+ export import StereoPannerNode = globalThis.StereoPannerNode;
24
+ export import WaveShaperNode = globalThis.WaveShaperNode;
25
+ }
package/index.mjs CHANGED
@@ -1,9 +1,21 @@
1
- // ---------------------------------------------------------- //
2
- // ---------------------------------------------------------- //
3
- // - WARNING - DO NOT EDIT - //
4
- // - This file has been generated - //
5
- // ---------------------------------------------------------- //
6
- // ---------------------------------------------------------- //
1
+ // -------------------------------------------------------------------------- //
2
+ // -------------------------------------------------------------------------- //
3
+ // //
4
+ // //
5
+ // //
6
+ // ██╗ ██╗ █████╗ ██████╗ ███╗ ██╗██╗███╗ ██╗ ██████╗ //
7
+ // ██║ ██║██╔══██╗██╔══██╗████╗ ██║██║████╗ ██║██╔════╝ //
8
+ // ██║ █╗ ██║███████║██████╔╝██╔██╗ ██║██║██╔██╗ ██║██║ ███╗ //
9
+ // ██║███╗██║██╔══██║██╔══██╗██║╚██╗██║██║██║╚██╗██║██║ ██║ //
10
+ // ╚███╔███╔╝██║ ██║██║ ██║██║ ╚████║██║██║ ╚████║╚██████╔╝ //
11
+ // ╚══╝╚══╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝╚═╝ ╚═══╝ ╚═════╝ //
12
+ // //
13
+ // //
14
+ // - This file has been generated --------------------------- //
15
+ // //
16
+ // //
17
+ // -------------------------------------------------------------------------- //
18
+ // -------------------------------------------------------------------------- //
7
19
 
8
20
  // re-export index.js to support clean esm syntax
9
21
  // see https://github.com/nodejs/node/issues/40541#issuecomment-951609570
@@ -37,7 +49,6 @@ export const {
37
49
  WaveShaperNode,
38
50
 
39
51
  // helper methods
40
- load,
41
52
  mediaDevices,
42
53
  } = nativeModule;
43
54
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-web-audio-api",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "author": "Benjamin Matuszewski",
5
5
  "description": "Node.js bindings for web-audio-api-rs using napi-rs",
6
6
  "exports": {
@@ -25,6 +25,7 @@
25
25
  "napi": {
26
26
  "name": "node-web-audio-api"
27
27
  },
28
+ "types": "./index.d.ts",
28
29
  "publishConfig": {
29
30
  "registry": "https://registry.npmjs.org/",
30
31
  "access": "public"
@@ -34,6 +35,7 @@
34
35
  "build": "npm run generate && napi build --platform --release",
35
36
  "build:jack": "npm run generate && napi build --platform --features jack --release",
36
37
  "build:debug": "npm run generate && napi build --platform",
38
+ "build:only": "napi build --platform --release",
37
39
  "check": "cargo fmt && cargo clippy",
38
40
  "generate": "node generator/index.mjs && cargo fmt",
39
41
  "lint": "eslint monkey-patch.js index.cjs index.mjs && eslint examples/*.mjs",
@@ -1,60 +0,0 @@
1
- import { assert } from 'chai';
2
- import { AudioBuffer, AudioContext } from '../index.mjs';
3
-
4
- describe('# AudioBuffer', () => {
5
- let audioContext;
6
-
7
- before(() => {
8
- audioContext = new AudioContext();
9
- });
10
-
11
- after(() => {
12
- audioContext.close();
13
- });
14
-
15
- describe(`## audioContext.createBuffer`, () => {
16
- it('should properly create audio buffer', () => {
17
- const audioBuffer = audioContext.createBuffer(1, 100, audioContext.sampleRate);
18
-
19
- assert.equal(audioBuffer.numberOfChannels, 1);
20
- assert.equal(audioBuffer.length, 100);
21
- assert.equal(audioBuffer.sampleRate, audioContext.sampleRate);
22
- });
23
-
24
- it('should properly fail if missing argument', () => {
25
- assert.throws(() => {
26
- const audioBuffer = audioContext.createBuffer(1, 100);
27
- });
28
- });
29
- });
30
-
31
- describe(`## new AudioBuffer(options)`, () => {
32
- it('should properly create audio buffer', () => {
33
- const audioBuffer = new AudioBuffer({
34
- length: 100,
35
- sampleRate: audioContext.sampleRate,
36
- });
37
-
38
- assert.equal(audioBuffer.numberOfChannels, 1);
39
- assert.equal(audioBuffer.length, 100);
40
- assert.equal(audioBuffer.sampleRate, audioContext.sampleRate);
41
- });
42
-
43
- it('should properly fail if missing argument', () => {
44
- assert.throws(() => {
45
- const audioBuffer = new AudioBuffer({ length: 100 });
46
- });
47
- });
48
-
49
- it(`should have type error`, () => {
50
- try {
51
- new AudioBuffer(Date, 42);
52
- } catch (err) {
53
- console.log(err.type);
54
- console.log(err.name);
55
- console.log(err.message);
56
- assert.fail('should be TypeError');
57
- }
58
- });
59
- });
60
- });
@@ -1,58 +0,0 @@
1
- import { assert } from 'chai';
2
-
3
- import { mediaDevices } from '../index.mjs';
4
-
5
- describe('# mediaDevices.getUserMedia(options)', () => {
6
- it('should fail if no argument given', async () => {
7
- let failed = false;
8
- try {
9
- await mediaDevices.getUserMedia();
10
- } catch (err) {
11
- console.log(err.message);
12
- failed = true;
13
- }
14
-
15
- if (!failed) { assert.fail(); }
16
- });
17
-
18
- // @todo - clean error message
19
- it('should fail if argument is not an object', async () => {
20
- let failed = false;
21
- try {
22
- await mediaDevices.getUserMedia(true);
23
- } catch (err) {
24
- console.log(err.message);
25
- failed = true;
26
- }
27
-
28
- if (!failed) { assert.fail(); }
29
- });
30
-
31
- it('should fail if options.video', async () => {
32
- let failed = false;
33
- try {
34
- await mediaDevices.getUserMedia({ video: true });
35
- } catch (err) {
36
- console.log(err.message);
37
- failed = true;
38
- }
39
-
40
- if (!failed) { assert.fail(); }
41
- });
42
-
43
- it.only('should not fail if options.audio = true', async () => {
44
- let failed = false;
45
-
46
- try {
47
- const stream = await mediaDevices.getUserMedia({ audio: true });
48
- // console.log(stream instanceof mediaDevices.MediaStream);
49
- } catch (err) {
50
- console.log(err);
51
- failed = true;
52
- }
53
-
54
- console.log(failed);
55
-
56
- if (failed) { assert.fail('should not have failed'); }
57
- });
58
- });