node-web-audio-api 0.13.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,7 +1,13 @@
1
+ ## v0.14.0 (06/12/2023)
2
+
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
5
+
1
6
  ## v0.13.0 (08/11/2023)
2
7
 
3
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)
4
9
  - Ship build for linux arm64
10
+ - Typescript support
5
11
 
6
12
  ## v0.12.0 (04/09/2023)
7
13
 
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-web-audio-api",
3
- "version": "0.13.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": {
@@ -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
- });