opus-codec 0.0.68 → 0.0.70

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.
Files changed (41) hide show
  1. package/es/actions/Client.d.ts +10 -0
  2. package/es/actions/Client.js +73 -0
  3. package/es/actions/actions.d.ts +112 -0
  4. package/es/actions/actions.js +79 -0
  5. package/es/actions/index.d.ts +1 -0
  6. package/es/actions/index.js +1 -0
  7. package/es/actions/opus.d.ts +255 -0
  8. package/es/actions/opus.js +293 -0
  9. package/es/opus/Decoder.d.ts +8 -0
  10. package/es/opus/Decoder.js +72 -0
  11. package/es/opus/Encoder.d.ts +24 -0
  12. package/es/opus/Encoder.js +81 -0
  13. package/es/opus/OpusGettersAndSetters.d.ts +44 -0
  14. package/es/opus/OpusGettersAndSetters.js +212 -0
  15. package/es/opus/RingBuffer.d.ts +6 -0
  16. package/es/opus/RingBuffer.js +46 -0
  17. package/es/opus/constants.d.ts +33 -0
  18. package/es/opus/constants.js +33 -0
  19. package/es/opus/index.d.ts +4 -0
  20. package/es/opus/index.js +4 -0
  21. package/es/runtime/Buffer.d.ts +10 -0
  22. package/es/runtime/Buffer.js +23 -0
  23. package/es/runtime/Integer.d.ts +11 -0
  24. package/es/runtime/Integer.js +27 -0
  25. package/es/runtime/ResourcesHolder.d.ts +9 -0
  26. package/es/runtime/ResourcesHolder.js +13 -0
  27. package/es/runtime/Runtime.d.ts +10 -0
  28. package/es/runtime/Runtime.js +25 -0
  29. package/es/runtime/index.d.ts +4 -0
  30. package/es/runtime/index.js +4 -0
  31. package/native/libopusenc-cmake/src/COPYING +29 -0
  32. package/native/libopusenc-cmake/src/README.md +11 -0
  33. package/native/opus/COPYING +44 -0
  34. package/native/opus/README +161 -0
  35. package/native/opus/README.draft +54 -0
  36. package/native/speexdsp-cmake/src/COPYING +35 -0
  37. package/native/speexdsp-cmake/src/README +3 -0
  38. package/native/speexdsp-cmake/src/README.Trimedia +103 -0
  39. package/native/speexdsp-cmake/src/README.blackfin +22 -0
  40. package/native/speexdsp-cmake/src/README.win32 +11 -0
  41. package/package.json +2 -2
@@ -0,0 +1,212 @@
1
+ import { Integer } from '../runtime';
2
+ import constants from './constants';
3
+ export class OpusGettersAndSetters {
4
+ #opusEncoderOffset;
5
+ #runtime;
6
+ #value;
7
+ constructor(runtime, opusEncoderOffset) {
8
+ this.#runtime = runtime;
9
+ this.#value = new Integer(runtime);
10
+ this.#opusEncoderOffset = opusEncoderOffset;
11
+ }
12
+ setComplexity(x) {
13
+ const result = this.#runtime.originalRuntime()._opus_set_complexity(this.#opusEncoderOffset, x);
14
+ return result === constants.OPUS_OK;
15
+ }
16
+ getComplexity() {
17
+ const result = this.#runtime.originalRuntime()._opus_get_complexity(this.#opusEncoderOffset, this.#value.offset());
18
+ if (result != constants.OPUS_OK)
19
+ throw new Error('Failed to set OPUS_GET_COMPLEXITY');
20
+ return this.#value.value();
21
+ }
22
+ setBitrate(x) {
23
+ const result = this.#runtime.originalRuntime()._opus_set_bitrate(this.#opusEncoderOffset, x);
24
+ return result === constants.OPUS_OK;
25
+ }
26
+ getBitrate() {
27
+ const result = this.#runtime.originalRuntime()._opus_get_bitrate(this.#opusEncoderOffset, this.#value.offset());
28
+ if (result != constants.OPUS_OK)
29
+ throw new Error('Failed to set OPUS_GET_BITRATE');
30
+ return this.#value.value();
31
+ }
32
+ setVbr(x) {
33
+ const result = this.#runtime.originalRuntime()._opus_set_vbr(this.#opusEncoderOffset, x);
34
+ return result === constants.OPUS_OK;
35
+ }
36
+ getVbr() {
37
+ const result = this.#runtime.originalRuntime()._opus_get_vbr(this.#opusEncoderOffset, this.#value.offset());
38
+ if (result != constants.OPUS_OK)
39
+ throw new Error('Failed to set OPUS_GET_VBR');
40
+ return this.#value.value();
41
+ }
42
+ setVbrConstraint(x) {
43
+ const result = this.#runtime.originalRuntime()._opus_set_vbr_constraint(this.#opusEncoderOffset, x);
44
+ return result === constants.OPUS_OK;
45
+ }
46
+ getVbrConstraint() {
47
+ const result = this.#runtime.originalRuntime()._opus_get_vbr_constraint(this.#opusEncoderOffset, this.#value.offset());
48
+ if (result != constants.OPUS_OK)
49
+ throw new Error('Failed to set OPUS_GET_VBR_CONSTRAINT');
50
+ return this.#value.value();
51
+ }
52
+ setForceChannels(x) {
53
+ const result = this.#runtime.originalRuntime()._opus_set_force_channels(this.#opusEncoderOffset, x);
54
+ return result === constants.OPUS_OK;
55
+ }
56
+ getForceChannels() {
57
+ const result = this.#runtime.originalRuntime()._opus_get_force_channels(this.#opusEncoderOffset, this.#value.offset());
58
+ if (result != constants.OPUS_OK)
59
+ throw new Error('Failed to set OPUS_GET_FORCE_CHANNELS');
60
+ return this.#value.value();
61
+ }
62
+ setMaxBandwidth(x) {
63
+ const result = this.#runtime.originalRuntime()._opus_set_max_bandwidth(this.#opusEncoderOffset, x);
64
+ return result === constants.OPUS_OK;
65
+ }
66
+ getMaxBandwidth() {
67
+ const result = this.#runtime.originalRuntime()._opus_get_max_bandwidth(this.#opusEncoderOffset, this.#value.offset());
68
+ if (result != constants.OPUS_OK)
69
+ throw new Error('Failed to set OPUS_GET_MAX_BANDWIDTH');
70
+ return this.#value.value();
71
+ }
72
+ setBandwidth(x) {
73
+ const result = this.#runtime.originalRuntime()._opus_set_bandwidth(this.#opusEncoderOffset, x);
74
+ return result === constants.OPUS_OK;
75
+ }
76
+ setSignal(x) {
77
+ const result = this.#runtime.originalRuntime()._opus_set_signal(this.#opusEncoderOffset, x);
78
+ return result === constants.OPUS_OK;
79
+ }
80
+ getSignal() {
81
+ const result = this.#runtime.originalRuntime()._opus_get_signal(this.#opusEncoderOffset, this.#value.offset());
82
+ if (result != constants.OPUS_OK)
83
+ throw new Error('Failed to set OPUS_GET_SIGNAL');
84
+ return this.#value.value();
85
+ }
86
+ setApplication(x) {
87
+ const result = this.#runtime.originalRuntime()._opus_set_application(this.#opusEncoderOffset, x);
88
+ return result === constants.OPUS_OK;
89
+ }
90
+ getApplication() {
91
+ const result = this.#runtime.originalRuntime()._opus_get_application(this.#opusEncoderOffset, this.#value.offset());
92
+ if (result != constants.OPUS_OK)
93
+ throw new Error('Failed to set OPUS_GET_APPLICATION');
94
+ return this.#value.value();
95
+ }
96
+ getLookahead() {
97
+ const result = this.#runtime.originalRuntime()._opus_get_lookahead(this.#opusEncoderOffset, this.#value.offset());
98
+ if (result != constants.OPUS_OK)
99
+ throw new Error('Failed to set OPUS_GET_LOOKAHEAD');
100
+ return this.#value.value();
101
+ }
102
+ setInbandFec(x) {
103
+ const result = this.#runtime.originalRuntime()._opus_set_inband_fec(this.#opusEncoderOffset, x);
104
+ return result === constants.OPUS_OK;
105
+ }
106
+ getInbandFec() {
107
+ const result = this.#runtime.originalRuntime()._opus_get_inband_fec(this.#opusEncoderOffset, this.#value.offset());
108
+ if (result != constants.OPUS_OK)
109
+ throw new Error('Failed to set OPUS_GET_INBAND_FEC');
110
+ return this.#value.value();
111
+ }
112
+ setPacketLossperc(x) {
113
+ const result = this.#runtime.originalRuntime()._opus_set_packet_loss_perc(this.#opusEncoderOffset, x);
114
+ return result === constants.OPUS_OK;
115
+ }
116
+ getPacketLossperc() {
117
+ const result = this.#runtime.originalRuntime()._opus_get_packet_loss_perc(this.#opusEncoderOffset, this.#value.offset());
118
+ if (result != constants.OPUS_OK)
119
+ throw new Error('Failed to set OPUS_GET_PACKET_LOSS_PERC');
120
+ return this.#value.value();
121
+ }
122
+ setDtx(x) {
123
+ const result = this.#runtime.originalRuntime()._opus_set_dtx(this.#opusEncoderOffset, x);
124
+ return result === constants.OPUS_OK;
125
+ }
126
+ getDtx() {
127
+ const result = this.#runtime.originalRuntime()._opus_get_dtx(this.#opusEncoderOffset, this.#value.offset());
128
+ if (result != constants.OPUS_OK)
129
+ throw new Error('Failed to set OPUS_GET_DTX');
130
+ return this.#value.value();
131
+ }
132
+ setLsbDepth(x) {
133
+ const result = this.#runtime.originalRuntime()._opus_set_lsb_depth(this.#opusEncoderOffset, x);
134
+ return result === constants.OPUS_OK;
135
+ }
136
+ getLsbDepth() {
137
+ const result = this.#runtime.originalRuntime()._opus_get_lsb_depth(this.#opusEncoderOffset, this.#value.offset());
138
+ if (result != constants.OPUS_OK)
139
+ throw new Error('Failed to set OPUS_GET_LSB_DEPTH');
140
+ return this.#value.value();
141
+ }
142
+ setExpertFrameduration(x) {
143
+ const result = this.#runtime.originalRuntime()._opus_set_expert_frame_duration(this.#opusEncoderOffset, x);
144
+ return result === constants.OPUS_OK;
145
+ }
146
+ getExpertFrameduration() {
147
+ const result = this.#runtime.originalRuntime()._opus_get_expert_frame_duration(this.#opusEncoderOffset, this.#value.offset());
148
+ if (result != constants.OPUS_OK)
149
+ throw new Error('Failed to set OPUS_GET_EXPERT_FRAME_DURATION');
150
+ return this.#value.value();
151
+ }
152
+ setPredictionDisabled(x) {
153
+ const result = this.#runtime.originalRuntime()._opus_set_prediction_disabled(this.#opusEncoderOffset, x);
154
+ return result === constants.OPUS_OK;
155
+ }
156
+ getPredictionDisabled() {
157
+ const result = this.#runtime.originalRuntime()._opus_get_prediction_disabled(this.#opusEncoderOffset, this.#value.offset());
158
+ if (result != constants.OPUS_OK)
159
+ throw new Error('Failed to set OPUS_GET_PREDICTION_DISABLED');
160
+ return this.#value.value();
161
+ }
162
+ getBandwidth() {
163
+ const result = this.#runtime.originalRuntime()._opus_get_bandwidth(this.#opusEncoderOffset, this.#value.offset());
164
+ if (result != constants.OPUS_OK)
165
+ throw new Error('Failed to set OPUS_GET_BANDWIDTH');
166
+ return this.#value.value();
167
+ }
168
+ getSampleRate() {
169
+ const result = this.#runtime.originalRuntime()._opus_get_sample_rate(this.#opusEncoderOffset, this.#value.offset());
170
+ if (result != constants.OPUS_OK)
171
+ throw new Error('Failed to set OPUS_GET_SAMPLE_RATE');
172
+ return this.#value.value();
173
+ }
174
+ setPhaseInversiondisabled(x) {
175
+ const result = this.#runtime.originalRuntime()._opus_set_phase_inversion_disabled(this.#opusEncoderOffset, x);
176
+ return result === constants.OPUS_OK;
177
+ }
178
+ getPhaseInversiondisabled() {
179
+ const result = this.#runtime.originalRuntime()._opus_get_phase_inversion_disabled(this.#opusEncoderOffset, this.#value.offset());
180
+ if (result != constants.OPUS_OK)
181
+ throw new Error('Failed to set OPUS_GET_PHASE_INVERSION_DISABLED');
182
+ return this.#value.value();
183
+ }
184
+ getInDtx() {
185
+ const result = this.#runtime.originalRuntime()._opus_get_in_dtx(this.#opusEncoderOffset, this.#value.offset());
186
+ if (result != constants.OPUS_OK)
187
+ throw new Error('Failed to set OPUS_GET_IN_DTX');
188
+ return this.#value.value();
189
+ }
190
+ setGain(x) {
191
+ const result = this.#runtime.originalRuntime()._opus_set_gain(this.#opusEncoderOffset, x);
192
+ return result === constants.OPUS_OK;
193
+ }
194
+ getGain() {
195
+ const result = this.#runtime.originalRuntime()._opus_get_gain(this.#opusEncoderOffset, this.#value.offset());
196
+ if (result != constants.OPUS_OK)
197
+ throw new Error('Failed to set OPUS_GET_GAIN');
198
+ return this.#value.value();
199
+ }
200
+ getLastPacketduration() {
201
+ const result = this.#runtime.originalRuntime()._opus_get_last_packet_duration(this.#opusEncoderOffset, this.#value.offset());
202
+ if (result != constants.OPUS_OK)
203
+ throw new Error('Failed to set OPUS_GET_LAST_PACKET_DURATION');
204
+ return this.#value.value();
205
+ }
206
+ getPitch() {
207
+ const result = this.#runtime.originalRuntime()._opus_get_pitch(this.#opusEncoderOffset, this.#value.offset());
208
+ if (result != constants.OPUS_OK)
209
+ throw new Error('Failed to set OPUS_GET_PITCH');
210
+ return this.#value.value();
211
+ }
212
+ }
@@ -0,0 +1,6 @@
1
+ export default class RingBuffer {
2
+ #private;
3
+ constructor(frameSize: number);
4
+ write(value: Float32Array): void;
5
+ read(): Float32Array | null;
6
+ }
@@ -0,0 +1,46 @@
1
+ export default class RingBuffer {
2
+ #arrayBuffer;
3
+ #readOffset;
4
+ #writeOffset;
5
+ #frameSize;
6
+ constructor(frameSize) {
7
+ this.#readOffset = 0;
8
+ this.#writeOffset = 0;
9
+ this.#arrayBuffer = new ArrayBuffer(this.#initialSize());
10
+ this.#frameSize = frameSize;
11
+ }
12
+ #view() {
13
+ return new Float32Array(this.#arrayBuffer);
14
+ }
15
+ write(value) {
16
+ this.#maybeReallocate(value.length);
17
+ this.#view().set(value, this.#writeOffset);
18
+ this.#writeOffset += value.length;
19
+ }
20
+ read() {
21
+ const remainingBytes = this.#writeOffset - this.#readOffset;
22
+ if (remainingBytes >= this.#frameSize) {
23
+ const view = this.#view().subarray(this.#readOffset, this.#readOffset + this.#frameSize);
24
+ this.#readOffset += this.#frameSize;
25
+ if (this.#readOffset >= this.#writeOffset) {
26
+ this.#writeOffset = 0;
27
+ this.#readOffset = 0;
28
+ }
29
+ return view;
30
+ }
31
+ return null;
32
+ }
33
+ #maybeReallocate(samples) {
34
+ const sampleCountInBytes = samples * Float32Array.BYTES_PER_ELEMENT;
35
+ if (this.#view().length - this.#writeOffset <= samples) {
36
+ const oldArrayBuffer = this.#arrayBuffer;
37
+ this.#arrayBuffer = new ArrayBuffer(oldArrayBuffer.byteLength +
38
+ sampleCountInBytes +
39
+ this.#initialSize());
40
+ this.#view().set(new Float32Array(oldArrayBuffer));
41
+ }
42
+ }
43
+ #initialSize() {
44
+ return this.#frameSize * Float32Array.BYTES_PER_ELEMENT * 2;
45
+ }
46
+ }
@@ -0,0 +1,33 @@
1
+ declare const constants: {
2
+ OPUS_OK: number;
3
+ OPUS_BAD_ARG: number;
4
+ OPUS_BUFFER_TOO_SMALL: number;
5
+ OPUS_INTERNAL_ERROR: number;
6
+ OPUS_INVALID_PACKET: number;
7
+ OPUS_UNIMPLEMENTED: number;
8
+ OPUS_INVALID_STATE: number;
9
+ ' OPUS_ALLOC_FAIL': number;
10
+ OPUS_AUTO: number;
11
+ OPUS_BITRATE_MAX: number;
12
+ OPUS_APPLICATION_VOIP: number;
13
+ OPUS_APPLICATION_AUDIO: number;
14
+ OPUS_APPLICATION_RESTRICTED_LOWDELAY: number;
15
+ OPUS_SIGNAL_VOICE: number;
16
+ OPUS_SIGNAL_MUSIC: number;
17
+ OPUS_BANDWIDTH_NARROWBAND: number;
18
+ OPUS_BANDWIDTH_MEDIUMBAND: number;
19
+ OPUS_BANDWIDTH_WIDEBAND: number;
20
+ OPUS_BANDWIDTH_SUPERWIDEBAND: number;
21
+ OPUS_BANDWIDTH_FULLBAND: number;
22
+ OPUS_FRAMESIZE_ARG: number;
23
+ OPUS_FRAMESIZE_2_5_MS: number;
24
+ OPUS_FRAMESIZE_5_MS: number;
25
+ OPUS_FRAMESIZE_10_MS: number;
26
+ OPUS_FRAMESIZE_20_MS: number;
27
+ OPUS_FRAMESIZE_40_MS: number;
28
+ OPUS_FRAMESIZE_60_MS: number;
29
+ OPUS_FRAMESIZE_80_MS: number;
30
+ OPUS_FRAMESIZE_100_MS: number;
31
+ OPUS_FRAMESIZE_120_MS: number;
32
+ };
33
+ export default constants;
@@ -0,0 +1,33 @@
1
+ const constants = {
2
+ 'OPUS_OK': 0,
3
+ 'OPUS_BAD_ARG': -1,
4
+ 'OPUS_BUFFER_TOO_SMALL': -2,
5
+ 'OPUS_INTERNAL_ERROR': -3,
6
+ 'OPUS_INVALID_PACKET': -4,
7
+ 'OPUS_UNIMPLEMENTED': -5,
8
+ 'OPUS_INVALID_STATE': -6,
9
+ ' OPUS_ALLOC_FAIL': -7,
10
+ 'OPUS_AUTO': -1000,
11
+ 'OPUS_BITRATE_MAX': -1,
12
+ 'OPUS_APPLICATION_VOIP': 2048,
13
+ 'OPUS_APPLICATION_AUDIO': 2049,
14
+ 'OPUS_APPLICATION_RESTRICTED_LOWDELAY': 2051,
15
+ 'OPUS_SIGNAL_VOICE': 3001,
16
+ 'OPUS_SIGNAL_MUSIC': 3002,
17
+ 'OPUS_BANDWIDTH_NARROWBAND': 1101,
18
+ 'OPUS_BANDWIDTH_MEDIUMBAND': 1102,
19
+ 'OPUS_BANDWIDTH_WIDEBAND': 1103,
20
+ 'OPUS_BANDWIDTH_SUPERWIDEBAND': 1104,
21
+ 'OPUS_BANDWIDTH_FULLBAND': 1105,
22
+ 'OPUS_FRAMESIZE_ARG': 5000,
23
+ 'OPUS_FRAMESIZE_2_5_MS': 5001,
24
+ 'OPUS_FRAMESIZE_5_MS': 5002,
25
+ 'OPUS_FRAMESIZE_10_MS': 5003,
26
+ 'OPUS_FRAMESIZE_20_MS': 5004,
27
+ 'OPUS_FRAMESIZE_40_MS': 5005,
28
+ 'OPUS_FRAMESIZE_60_MS': 5006,
29
+ 'OPUS_FRAMESIZE_80_MS': 5007,
30
+ 'OPUS_FRAMESIZE_100_MS': 5008,
31
+ 'OPUS_FRAMESIZE_120_MS': 5009,
32
+ };
33
+ export default constants;
@@ -0,0 +1,4 @@
1
+ export { default as Encoder } from './Encoder';
2
+ export { default as Decoder } from './Decoder';
3
+ export { default as RingBuffer } from './RingBuffer';
4
+ export { default as constants } from './constants';
@@ -0,0 +1,4 @@
1
+ export { default as Encoder } from './Encoder';
2
+ export { default as Decoder } from './Decoder';
3
+ export { default as RingBuffer } from './RingBuffer';
4
+ export { default as constants } from './constants';
@@ -0,0 +1,10 @@
1
+ import { IResource } from "./ResourcesHolder";
2
+ import Runtime from "./Runtime";
3
+ export default class Buffer implements IResource {
4
+ #private;
5
+ constructor(runtime: Runtime, size: number);
6
+ offset(): number;
7
+ data(): Uint8Array;
8
+ size(): number;
9
+ destroy(): void;
10
+ }
@@ -0,0 +1,23 @@
1
+ export default class Buffer {
2
+ #offset;
3
+ #size;
4
+ #runtime;
5
+ constructor(runtime, size) {
6
+ this.#runtime = runtime;
7
+ this.#size = size;
8
+ this.#offset = runtime.malloc(size);
9
+ }
10
+ offset() {
11
+ return this.#offset;
12
+ }
13
+ data() {
14
+ return this.#runtime.subarray(this.#offset, this.#offset + this.#size);
15
+ }
16
+ size() {
17
+ return this.#size;
18
+ }
19
+ destroy() {
20
+ this.#runtime.free(this.#offset);
21
+ this.#offset = 0;
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ import { IResource } from './ResourcesHolder';
2
+ import Runtime from './Runtime';
3
+ export default class Integer implements IResource {
4
+ #private;
5
+ constructor(runtime: Runtime);
6
+ value(): number;
7
+ set(value: number): void;
8
+ size(): number;
9
+ offset(): number;
10
+ destroy(): void;
11
+ }
@@ -0,0 +1,27 @@
1
+ export default class Integer {
2
+ #runtime;
3
+ #offset;
4
+ constructor(runtime) {
5
+ this.#runtime = runtime;
6
+ this.#offset = runtime.malloc(runtime.originalRuntime()._size_of_int());
7
+ }
8
+ value() {
9
+ if (this.#runtime.originalRuntime()._size_of_int() !== 4) {
10
+ throw new Error('invalid integer byte size');
11
+ }
12
+ return this.#runtime.view().getInt32(this.#offset, true);
13
+ }
14
+ set(value) {
15
+ this.#runtime.view().setInt32(this.#offset, value, true);
16
+ }
17
+ size() {
18
+ return this.#runtime.originalRuntime()._size_of_int();
19
+ }
20
+ offset() {
21
+ return this.#offset;
22
+ }
23
+ destroy() {
24
+ this.#runtime.free(this.#offset);
25
+ this.#offset = 0;
26
+ }
27
+ }
@@ -0,0 +1,9 @@
1
+ export default class ResourcesHolder {
2
+ #private;
3
+ constructor();
4
+ add(resource: IResource): void;
5
+ destroy(): void;
6
+ }
7
+ export interface IResource {
8
+ destroy(): void;
9
+ }
@@ -0,0 +1,13 @@
1
+ export default class ResourcesHolder {
2
+ #resources = new Set();
3
+ constructor() {
4
+ }
5
+ add(resource) {
6
+ this.#resources.add(resource);
7
+ }
8
+ destroy() {
9
+ for (const r of this.#resources) {
10
+ r.destroy();
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,10 @@
1
+ import { EmscriptenRuntime } from "../native";
2
+ export default class Runtime {
3
+ #private;
4
+ constructor(runtime: EmscriptenRuntime);
5
+ originalRuntime(): EmscriptenRuntime;
6
+ subarray(start: number, end: number): Uint8Array;
7
+ free(offset: number): void;
8
+ view(): DataView;
9
+ malloc(len: number): number;
10
+ }
@@ -0,0 +1,25 @@
1
+ export default class Runtime {
2
+ #runtime;
3
+ constructor(runtime) {
4
+ this.#runtime = runtime;
5
+ }
6
+ originalRuntime() {
7
+ return this.#runtime;
8
+ }
9
+ subarray(start, end) {
10
+ return this.#runtime.HEAPU8.subarray(start, end);
11
+ }
12
+ free(offset) {
13
+ this.#runtime._free(offset);
14
+ }
15
+ view() {
16
+ return new DataView(this.#runtime.HEAPU8.buffer);
17
+ }
18
+ malloc(len) {
19
+ const offset = this.#runtime._malloc(len);
20
+ if (!offset) {
21
+ throw new Error(`failed to allocate ${len} bytes`);
22
+ }
23
+ return offset;
24
+ }
25
+ }
@@ -0,0 +1,4 @@
1
+ export { default as Integer } from './Integer';
2
+ export { default as Runtime } from './Runtime';
3
+ export { default as Buffer } from './Buffer';
4
+ export { default as ResourcesHolder, IResource } from './ResourcesHolder';
@@ -0,0 +1,4 @@
1
+ export { default as Integer } from './Integer';
2
+ export { default as Runtime } from './Runtime';
3
+ export { default as Buffer } from './Buffer';
4
+ export { default as ResourcesHolder } from './ResourcesHolder';
@@ -0,0 +1,29 @@
1
+ Copyright (c) 1994-2013 Xiph.Org Foundation and contributors
2
+ Copyright (c) 2017 Jean-Marc Valin
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions
6
+ are met:
7
+
8
+ - Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ - Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ - Neither the name of the Xiph.Org Foundation nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
23
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,11 @@
1
+ # Libopusenc
2
+
3
+ The libopusenc libraries provide a high-level API for
4
+ encoding .opus files. libopusenc depends only on libopus.
5
+
6
+ The library is in very early development.
7
+ Please give feedback
8
+ in #opus on irc.libera.chat or at opus@xiph.org.
9
+
10
+ Programming documentation is available in tree and online at
11
+ https://opus-codec.org/docs/
@@ -0,0 +1,44 @@
1
+ Copyright 2001-2011 Xiph.Org, Skype Limited, Octasic,
2
+ Jean-Marc Valin, Timothy B. Terriberry,
3
+ CSIRO, Gregory Maxwell, Mark Borgerding,
4
+ Erik de Castro Lopo
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions
8
+ are met:
9
+
10
+ - Redistributions of source code must retain the above copyright
11
+ notice, this list of conditions and the following disclaimer.
12
+
13
+ - Redistributions in binary form must reproduce the above copyright
14
+ notice, this list of conditions and the following disclaimer in the
15
+ documentation and/or other materials provided with the distribution.
16
+
17
+ - Neither the name of Internet Society, IETF or IETF Trust, nor the
18
+ names of specific contributors, may be used to endorse or promote
19
+ products derived from this software without specific prior written
20
+ permission.
21
+
22
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
26
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+
34
+ Opus is subject to the royalty-free patent licenses which are
35
+ specified at:
36
+
37
+ Xiph.Org Foundation:
38
+ https://datatracker.ietf.org/ipr/1524/
39
+
40
+ Microsoft Corporation:
41
+ https://datatracker.ietf.org/ipr/1914/
42
+
43
+ Broadcom Corporation:
44
+ https://datatracker.ietf.org/ipr/1526/