Skip to content

Commit 7fba663

Browse files
authored
fix(@soundtouchjs/core): Correction bits (#48)
Forcing builds to resolve versioning conflicts
1 parent 6846de0 commit 7fba663

7 files changed

Lines changed: 479 additions & 74 deletions

File tree

nx.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"!{projectRoot}/tsconfig.spec.json"
1010
]
1111
},
12+
"neverConnectToCloud": true,
13+
"daemon": true,
1214
"plugins": [
1315
{
1416
"plugin": "@nx/js/typescript",

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@soundtouchjs/monorepo",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"private": true,
55
"description": "SoundTouchJS monorepo",
66
"license": "LGPL-2.1",
@@ -20,6 +20,8 @@
2020
"@commitlint/config-conventional": "^20.4.3",
2121
"@nx/js": "22.5.4",
2222
"@nx/vite": "22.5.4",
23+
"@swc-node/register": "^1.11.1",
24+
"@swc/core": "^1.15.18",
2325
"@types/node": "^25.3.5",
2426
"@vitest/coverage-v8": "^4.0.18",
2527
"husky": "^9.1.7",

packages/audio-worklet/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@soundtouchjs/audio-worklet",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "AudioWorklet implementation of the SoundTouchJS library",
55
"license": "LGPL-2.1",
66
"type": "module",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@soundtouchjs/core",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "An audio processing library for manipulating Web Audio Contexts",
55
"license": "LGPL-2.1",
66
"type": "module",

packages/core/src/AbstractFifoSamplePipe.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ import FifoSampleBuffer from './FifoSampleBuffer.js';
3232
*/
3333
export default class AbstractFifoSamplePipe {
3434
/**
35-
* Input buffer for audio samples.
35+
* Input buffer for audio samples
3636
*/
3737
protected _inputBuffer: FifoSampleBuffer | null;
3838

3939
/**
40-
* Output buffer for processed audio samples.
40+
* Output buffer for processed audio samples
4141
*/
4242
protected _outputBuffer: FifoSampleBuffer | null;
4343

4444
/**
45-
* Constructs an AbstractFifoSamplePipe.
45+
* Constructs an AbstractFifoSamplePipe
4646
* @param createBuffers If true, initializes input and output buffers.
4747
*/
4848
constructor(createBuffers?: boolean) {
@@ -56,35 +56,35 @@ export default class AbstractFifoSamplePipe {
5656
}
5757

5858
/**
59-
* Gets the input buffer.
59+
* Gets the input buffer
6060
*/
6161
get inputBuffer(): FifoSampleBuffer | null {
6262
return this._inputBuffer;
6363
}
6464

6565
/**
66-
* Sets the input buffer.
66+
* Sets the input buffer
6767
*/
6868
set inputBuffer(inputBuffer: FifoSampleBuffer | null) {
6969
this._inputBuffer = inputBuffer;
7070
}
7171

7272
/**
73-
* Gets the output buffer.
73+
* Gets the output buffer
7474
*/
7575
get outputBuffer(): FifoSampleBuffer | null {
7676
return this._outputBuffer;
7777
}
7878

7979
/**
80-
* Sets the output buffer.
80+
* Sets the output buffer
8181
*/
8282
set outputBuffer(outputBuffer: FifoSampleBuffer | null) {
8383
this._outputBuffer = outputBuffer;
8484
}
8585

8686
/**
87-
* Clears both input and output buffers.
87+
* Clears both input and output buffers
8888
*/
8989
clear(): void {
9090
this._inputBuffer?.clear();

packages/core/src/FifoSampleBuffer.ts

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -21,57 +21,57 @@
2121
*/
2222

2323
/**
24-
* Number of bytes per sample (Float32).
24+
* Number of bytes per sample (Float32)
2525
*/
2626
const BYTES_PER_SAMPLE = 4;
2727

2828
/**
29-
* Number of samples per audio frame (stereo).
29+
* Number of samples per audio frame (stereo)
3030
*/
3131
const SAMPLES_PER_FRAME = 2;
3232

3333
/**
34-
* Number of bytes per audio frame.
34+
* Number of bytes per audio frame
3535
*/
3636
const BYTES_PER_FRAME = BYTES_PER_SAMPLE * SAMPLES_PER_FRAME;
3737

3838
/**
39-
* Default maximum number of frames for buffer allocation.
39+
* Default maximum number of frames for buffer allocation
4040
*/
4141
const DEFAULT_MAX_FRAMES = 131072;
4242

4343
/**
44-
* Resizable interleaved sample buffer for audio processing.
45-
* Uses ES2024 ArrayBuffer for zero-allocation growth.
44+
* Resizable interleaved sample buffer for audio processing
45+
* Uses ES2024 ArrayBuffer for zero-allocation growth
4646
*
4747
* @remarks
48-
* Stores stereo audio samples in a contiguous Float32Array.
49-
* Provides methods for efficient buffer management and sample transfer.
48+
* Stores stereo audio samples in a contiguous Float32Array
49+
* Provides methods for efficient buffer management and sample transfer
5050
*/
5151
export default class FifoSampleBuffer {
5252
/**
53-
* Backing ArrayBuffer for sample storage.
53+
* Backing ArrayBuffer for sample storage
5454
*/
5555
private _buffer: ArrayBuffer;
5656

5757
/**
58-
* Float32Array view of the buffer.
58+
* Float32Array view of the buffer
5959
*/
6060
private _vector: Float32Array;
6161

6262
/**
63-
* Current read position (frame index).
63+
* Current read position (frame index)
6464
*/
6565
private _position: number;
6666

6767
/**
68-
* Number of frames currently stored.
68+
* Number of frames currently stored
6969
*/
7070
private _frameCount: number;
7171

7272
/**
73-
* Creates a new FifoSampleBuffer.
74-
* @param maxFrames Maximum number of frames for buffer allocation.
73+
* Creates a new FifoSampleBuffer
74+
* @param maxFrames Maximum number of frames for buffer allocation
7575
*/
7676
constructor(maxFrames = DEFAULT_MAX_FRAMES) {
7777
this._buffer = new ArrayBuffer(0, {
@@ -83,42 +83,42 @@ export default class FifoSampleBuffer {
8383
}
8484

8585
/**
86-
* Returns the Float32Array view of the buffer.
86+
* Returns the Float32Array view of the buffer
8787
*/
8888
get vector(): Float32Array {
8989
return this._vector;
9090
}
9191

9292
/**
93-
* Returns the current read position (frame index).
93+
* Returns the current read position (frame index)
9494
*/
9595
get position(): number {
9696
return this._position;
9797
}
9898

9999
/**
100-
* Returns the start sample index for reading.
100+
* Returns the start sample index for reading
101101
*/
102102
get startIndex(): number {
103103
return this._position * 2;
104104
}
105105

106106
/**
107-
* Returns the number of frames currently stored.
107+
* Returns the number of frames currently stored
108108
*/
109109
get frameCount(): number {
110110
return this._frameCount;
111111
}
112112

113113
/**
114-
* Returns the end sample index for reading.
114+
* Returns the end sample index for reading
115115
*/
116116
get endIndex(): number {
117117
return (this._position + this._frameCount) * 2;
118118
}
119119

120120
/**
121-
* Clears the buffer and resets position and frame count.
121+
* Clears the buffer and resets position and frame count
122122
*/
123123
clear(): void {
124124
this._vector.fill(0);
@@ -127,18 +127,18 @@ export default class FifoSampleBuffer {
127127
}
128128

129129
/**
130-
* Adds empty frames to the buffer.
131-
* @param numFrames Number of frames to add.
130+
* Adds empty frames to the buffer
131+
* @param numFrames Number of frames to add
132132
*/
133133
put(numFrames: number): void {
134134
this._frameCount += numFrames;
135135
}
136136

137137
/**
138-
* Adds samples to the buffer from a Float32Array.
139-
* @param samples Source samples (interleaved stereo).
140-
* @param position Start frame index in source.
141-
* @param numFrames Number of frames to copy (default: all available).
138+
* Adds samples to the buffer from a Float32Array
139+
* @param samples Source samples (interleaved stereo)
140+
* @param position Start frame index in source
141+
* @param numFrames Number of frames to copy (default: all available)
142142
*/
143143
putSamples(samples: Float32Array, position = 0, numFrames = 0): void {
144144
const sourceOffset = position * 2;
@@ -159,10 +159,10 @@ export default class FifoSampleBuffer {
159159
}
160160

161161
/**
162-
* Adds samples from another FifoSampleBuffer.
163-
* @param buffer Source buffer.
164-
* @param position Start frame index in source buffer.
165-
* @param numFrames Number of frames to copy (default: all available).
162+
* Adds samples from another FifoSampleBuffer
163+
* @param buffer Source buffer
164+
* @param position Start frame index in source buffer
165+
* @param numFrames Number of frames to copy (default: all available)
166166
*/
167167
putBuffer(buffer: FifoSampleBuffer, position = 0, numFrames = 0): void {
168168
if (!(numFrames >= 0) || numFrames === 0) {
@@ -172,8 +172,8 @@ export default class FifoSampleBuffer {
172172
}
173173

174174
/**
175-
* Advances the read position and reduces frame count.
176-
* @param numFrames Number of frames to receive (default: all available).
175+
* Advances the read position and reduces frame count
176+
* @param numFrames Number of frames to receive (default: all available)
177177
*/
178178
receive(numFrames?: number): void {
179179
if (
@@ -188,9 +188,9 @@ export default class FifoSampleBuffer {
188188
}
189189

190190
/**
191-
* Copies and receives samples into an output array.
192-
* @param output Destination Float32Array.
193-
* @param numFrames Number of frames to copy and receive.
191+
* Copies and receives samples into an output array
192+
* @param output Destination Float32Array
193+
* @param numFrames Number of frames to copy and receive
194194
*/
195195
receiveSamples(output: Float32Array, numFrames = 0): void {
196196
const numSamples = numFrames * 2;
@@ -200,10 +200,10 @@ export default class FifoSampleBuffer {
200200
}
201201

202202
/**
203-
* Extracts samples into an output array without advancing position.
204-
* @param output Destination Float32Array.
205-
* @param position Start frame index in buffer.
206-
* @param numFrames Number of frames to extract.
203+
* Extracts samples into an output array without advancing position
204+
* @param output Destination Float32Array
205+
* @param position Start frame index in buffer
206+
* @param numFrames Number of frames to extract
207207
*/
208208
extract(output: Float32Array, position = 0, numFrames = 0): void {
209209
const sourceOffset = this.startIndex + position * 2;
@@ -212,8 +212,8 @@ export default class FifoSampleBuffer {
212212
}
213213

214214
/**
215-
* Ensures the buffer has capacity for at least numFrames.
216-
* @param numFrames Minimum number of frames required.
215+
* Ensures the buffer has capacity for at least numFrames
216+
* @param numFrames Minimum number of frames required
217217
*/
218218
ensureCapacity(numFrames = 0): void {
219219
const minLength = Math.floor(numFrames * SAMPLES_PER_FRAME);
@@ -240,15 +240,15 @@ export default class FifoSampleBuffer {
240240
}
241241

242242
/**
243-
* Ensures buffer has capacity for additional frames.
244-
* @param numFrames Number of additional frames required.
243+
* Ensures buffer has capacity for additional frames
244+
* @param numFrames Number of additional frames required
245245
*/
246246
ensureAdditionalCapacity(numFrames = 0): void {
247247
this.ensureCapacity(this._frameCount + numFrames);
248248
}
249249

250250
/**
251-
* Moves all unread samples to the start of the buffer.
251+
* Moves all unread samples to the start of the buffer
252252
*/
253253
rewind(): void {
254254
if (this._position > 0) {

0 commit comments

Comments
 (0)