@ain1084/audio-worklet-stream 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -60,7 +60,7 @@ npm install @ain1084/audio-worklet-stream
60
60
  <details>
61
61
  <summary>Click to view configuration details</summary>
62
62
 
63
- You need to add `@ain1084/audio-worklet-stream` to the optimizeDeps.exclude section in `vite.config.ts`. Furthermore, include the necessary CORS settings to enable the use of `SharedArrayBuffer`.
63
+ You need to add `@ain1084/audio-worklet-stream` to the optimizeDeps.exclude section in `vite.config.ts`. Furthermore, include the necessary **COOP (Cross-Origin Opener Policy)** and **COEP (Cross-Origin Embedder Policy)** settings to enable the use of `SharedArrayBuffer`.
64
64
 
65
65
  ### vite.config.ts
66
66
 
@@ -115,7 +115,6 @@ export default defineNuxtConfig({
115
115
  },
116
116
  routeRules: {
117
117
  '/**': {
118
- cors: true,
119
118
  headers: {
120
119
  'Cross-Origin-Embedder-Policy': 'require-corp',
121
120
  'Cross-Origin-Opener-Policy': 'same-origin',
@@ -242,17 +241,17 @@ The actual values may slightly differ from the above because they are rounded up
242
241
  <details>
243
242
  <summary>Click to view example details</summary>
244
243
 
245
- The example can be found at [https://github.com/ain1084/audio-worklet-stream/tree/main/example](https://github.com/ain1084/audio-worklet-stream/tree/main/example).
244
+ The example can be found at [example](https://github.com/ain1084/audio-worklet-stream/tree/main/example).
246
245
 
247
246
  The provided example demonstrates how to use the library to manually write audio frames to a buffer. It includes:
248
247
 
249
- - **Main Application** (`example/src/main.ts`): Sets up and starts the audio stream using different buffer writing strategies.
250
- - **Sine Wave Filler** (`example/src/sine-wave-frame-buffer-filler.ts`): Implements a frame buffer filler that generates a sine wave.
251
- - **Sine Wave Generator** (`example/src/sine-wave-generator.ts`): Generates sine wave values for the buffer filler.
252
- - **Worker** (`example/src/worker.ts`): Sets up a worker to handle buffer filling tasks.
253
- - **HTML Entry Point** (`example/index.html`): Provides the HTML structure and buttons to control the audio stream.
248
+ - **Main Application** ([example/src/main.ts](https://github.com/ain1084/audio-worklet-stream/blob/main/example/src/main.ts)): Sets up and starts the audio stream using different buffer writing strategies.
249
+ - **Sine Wave Filler** ([example/src/sine-wave-frame-buffer-filler.ts](https://github.com/ain1084/audio-worklet-stream/blob/main/example/src/sine-wave-frame-buffer-filler.ts)): Implements a frame buffer filler that generates a sine wave.
250
+ - **Sine Wave Generator** ([example/src/sine-wave-generator.ts](https://github.com/ain1084/audio-worklet-stream/blob/main/example/src/sine-wave-generator.ts)): Generates sine wave values for the buffer filler.
251
+ - **Worker** ([example/src/worker.ts](https://github.com/ain1084/audio-worklet-stream/blob/main/example/src/worker.ts)): Sets up a worker to handle buffer filling tasks.
252
+ - **HTML Entry Point** ([example/index.html](https://github.com/ain1084/audio-worklet-stream/blob/main/example/index.html)): Provides the HTML structure and buttons to control the audio stream.
254
253
 
255
- For more details, refer to the [example/README.md](https://github.com/ain1084/audio-worklet-stream/tree/main/example/README.md).
254
+ For more details, refer to the [example/README.md](https://github.com/ain1084/audio-worklet-stream/blob/main/example/README.md).
256
255
 
257
256
  </details>
258
257
 
@@ -400,9 +399,9 @@ If you're experiencing frequent UnderrunEvents:
400
399
  1. Ensure `@ain1084/audio-worklet-stream` is properly installed.
401
400
  2. Check your bundler configuration, especially the `optimizeDeps.exclude` setting in Vite.
402
401
 
403
- #### CORS Errors
402
+ #### Browser Errors
404
403
 
405
- 1. Verify that you've set the correct CORS headers as described in the installation instructions.
404
+ 1. Verify that you've set the correct **COOP (Cross-Origin Opener Policy)** and **COEP (Cross-Origin Embedder Policy)** headers as described in the installation instructions.
406
405
  2. If using a development server, ensure it's configured to send the required headers.
407
406
 
408
407
  ### Performance Issues
@@ -492,10 +491,9 @@ export default defineNuxtConfig({
492
491
  rollupConfig: {
493
492
  external: '@ain1084/audio-worklet-stream',
494
493
  },
495
- // Ensure CORS settings for SharedArrayBuffer
494
+ // Ensure COEP and COOP settings for SharedArrayBuffer
496
495
  routeRules: {
497
496
  '/**': {
498
- cors: true,
499
497
  headers: {
500
498
  'Cross-Origin-Embedder-Policy': 'require-corp',
501
499
  'Cross-Origin-Opener-Policy': 'same-origin',
@@ -37,6 +37,7 @@ export declare class FrameBufferReader {
37
37
  * 1. `buffer`: A Float32Array representing the readable segment of the buffer.
38
38
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
39
39
  * for the current segment relative to the entire data.
40
+ *
40
41
  * The callback must return the number of frames it successfully processed.
41
42
  * If the callback processes fewer frames than available in the current segment,
42
43
  * processing will stop early.
@@ -46,6 +46,7 @@ export class FrameBufferReader {
46
46
  * 1. `buffer`: A Float32Array representing the readable segment of the buffer.
47
47
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
48
48
  * for the current segment relative to the entire data.
49
+ *
49
50
  * The callback must return the number of frames it successfully processed.
50
51
  * If the callback processes fewer frames than available in the current segment,
51
52
  * processing will stop early.
@@ -1 +1 @@
1
- {"version":3,"file":"buffer-reader.js","sourceRoot":"","sources":["../../src/frame-buffer/buffer-reader.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACX,YAAY,CAAa;IACzB,mBAAmB,CAAa;IAChC,YAAY,CAAgB;IACrC,MAAM,GAAW,CAAC,CAAA;IAE1B;;;;;OAKG;IACH,YAAY,WAAwB,EAAE,kBAA+B,EAAE,WAA2B;QAChG,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC7C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,IAAW,eAAe;QACxB,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;IAClD,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QACpB,2DAA2D;QAC3D,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,C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;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACI,IAAI,CAAC,mBAAqE;QAC/E,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAA;QAC1G,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAA;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAA;QACrE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAA;QACtE,OAAO,MAAM,CAAC,oBAAoB,CAAA;IACpC,CAAC;CACF"}
@@ -38,6 +38,7 @@ export declare class FrameBufferWriter {
38
38
  * 1. `buffer`: A Float32Array representing the writable segment of the buffer.
39
39
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
40
40
  * for the current segment relative to the entire data.
41
+ *
41
42
  * The callback must return the number of frames it successfully wrote.
42
43
  * If the callback writes fewer frames than available in the current segment,
43
44
  * processing will stop early.
@@ -47,6 +47,7 @@ export class FrameBufferWriter {
47
47
  * 1. `buffer`: A Float32Array representing the writable segment of the buffer.
48
48
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
49
49
  * for the current segment relative to the entire data.
50
+ *
50
51
  * The callback must return the number of frames it successfully wrote.
51
52
  * If the callback writes fewer frames than available in the current segment,
52
53
  * processing will stop early.
@@ -1 +1 @@
1
- {"version":3,"file":"buffer-writer.js","sourceRoot":"","sources":["../../src/frame-buffer/buffer-writer.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IACX,YAAY,CAAa;IACzB,mBAAmB,CAAa;IAChC,YAAY,CAAgB;IACrC,MAAM,GAAW,CAAC,CAAA;IAE1B;;;;;OAKG;IACH,Y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ACH,YAAY,WAAwB,EAAE,kBAA+B,EAAE,WAA2B;QAChG,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAA;QAC7C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;IACjC,CAAC;IAED;;;;OAIG;IACH,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAA;IACjF,CAAC;IAED;;;;OAIG;IACH,IAAW,WAAW;QACpB,2DAA2D;QAC3D,4DAA4D;QAC5D,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAA;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACI,KAAK,CAAC,mBAAqE;QAChF,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAA;QAC1G,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,SAAS,CAAA;QAC9B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAA;QACrE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAA;QACtE,OAAO,MAAM,CAAC,oBAAoB,CAAA;IACpC,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ain1084/audio-worklet-stream",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -52,6 +52,7 @@ export class FrameBufferReader {
52
52
  * 1. `buffer`: A Float32Array representing the readable segment of the buffer.
53
53
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
54
54
  * for the current segment relative to the entire data.
55
+ *
55
56
  * The callback must return the number of frames it successfully processed.
56
57
  * If the callback processes fewer frames than available in the current segment,
57
58
  * processing will stop early.
@@ -53,6 +53,7 @@ export class FrameBufferWriter {
53
53
  * 1. `buffer`: A Float32Array representing the writable segment of the buffer.
54
54
  * 2. `offset`: The cumulative number of frames processed so far, used as the starting index
55
55
  * for the current segment relative to the entire data.
56
+ *
56
57
  * The callback must return the number of frames it successfully wrote.
57
58
  * If the callback writes fewer frames than available in the current segment,
58
59
  * processing will stop early.