@libreaudio/la-call 0.0.2 → 0.0.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.
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
// Copyright 2026 Filipe Coelho <falktx@falktx.com>
|
|
2
2
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
interface WasmProcessorProperties {
|
|
5
|
+
intensity: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export declare const createWasmProcessor: (audioContext: AudioContext, properties: WasmProcessorProperties) => Promise<AudioNode>;
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const mapiProcJs = atob('Ly8gQ29weXJpZ2h0IDIwMjUtMjAyNiBGaWxpcGUgQ29lbGhvIDxmYWx
|
|
|
9
9
|
|
|
10
10
|
// create audio worklet or script processor
|
|
11
11
|
// we rely on script processor because worklets must run at 128 block size, which is not possible on low-spec machines
|
|
12
|
-
const createWasmProcessor = (audioContext) => {
|
|
12
|
+
const createWasmProcessor = (audioContext, properties) => {
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
14
|
if (typeof(WebAssembly) === 'undefined') {
|
|
15
15
|
reject('WebAssembly unsupported');
|
|
@@ -20,6 +20,8 @@ const createWasmProcessor = (audioContext) => {
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
const intensity = /*typedef(properties.intensity) === 'undefined' ? 100 :*/ properties.intensity;
|
|
24
|
+
|
|
23
25
|
if (! navigator.userAgent.match(/Android/i)) {
|
|
24
26
|
console.log("Using Audio Worklet");
|
|
25
27
|
|
|
@@ -37,12 +39,7 @@ const createWasmProcessor = (audioContext) => {
|
|
|
37
39
|
const processor = new AudioWorkletNode(audioContext, 'mapi-proc', options);
|
|
38
40
|
processor.port.onmessage = event => {
|
|
39
41
|
if (event.data.type == 'loaded') {
|
|
40
|
-
|
|
41
|
-
// processor.port.postMessage({ type: 'param', symbol: "leveler_target", value: -18 });
|
|
42
|
-
// processor.port.postMessage({ type: 'param', symbol: "sb_strength", value: 60 });
|
|
43
|
-
// processor.port.postMessage({ type: 'param', symbol: "mb_strength", value: 60 });
|
|
44
|
-
// processor.port.postMessage({ type: 'param', symbol: "pre_gain", value: 2 });
|
|
45
|
-
// processor.port.postMessage({ type: 'param', symbol: "post_gain", value: 0 });
|
|
42
|
+
processor.port.postMessage({ type: 'param', symbol: "intensity", value: intensity });
|
|
46
43
|
resolve(processor);
|
|
47
44
|
}
|
|
48
45
|
else if (event.data.type == 'error') {
|
|
@@ -92,6 +89,8 @@ const createWasmProcessor = (audioContext) => {
|
|
|
92
89
|
return csymbolData;
|
|
93
90
|
}
|
|
94
91
|
|
|
92
|
+
module._mapi_set_parameter(handle, csymbol("intensity"), intensity);
|
|
93
|
+
|
|
95
94
|
let enabled = true;
|
|
96
95
|
processor.onaudioprocess = function (e) {
|
|
97
96
|
if (! enabled) {
|