@jtarrio/webrtlsdr 2.0.5 → 3.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 +5 -6
- package/dist/errors.d.ts +1 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +0 -1
- package/dist/errors.js.map +1 -1
- package/dist/radio/radio.d.ts +22 -63
- package/dist/radio/radio.d.ts.map +1 -1
- package/dist/radio/radio.js +41 -255
- package/dist/radio/radio.js.map +1 -1
- package/dist/radio/source.d.ts +25 -0
- package/dist/radio/source.d.ts.map +1 -0
- package/dist/radio/source.js +69 -0
- package/dist/radio/source.js.map +1 -0
- package/dist/radio.d.ts +2 -1
- package/dist/radio.d.ts.map +1 -1
- package/dist/radio.js +1 -1
- package/dist/radio.js.map +1 -1
- package/dist/rtlsdr/rtl2832u.d.ts.map +1 -1
- package/dist/rtlsdr/rtl2832u.js.map +1 -1
- package/dist/rtlsdr/rtlcom.d.ts.map +1 -1
- package/dist/rtlsdr/rtlcom.js.map +1 -1
- package/package.json +4 -4
- package/dist/demod/demod-am.d.ts +0 -54
- package/dist/demod/demod-am.d.ts.map +0 -1
- package/dist/demod/demod-am.js +0 -113
- package/dist/demod/demod-am.js.map +0 -1
- package/dist/demod/demod-cw.d.ts +0 -48
- package/dist/demod/demod-cw.d.ts.map +0 -1
- package/dist/demod/demod-cw.js +0 -101
- package/dist/demod/demod-cw.js.map +0 -1
- package/dist/demod/demod-nbfm.d.ts +0 -54
- package/dist/demod/demod-nbfm.d.ts.map +0 -1
- package/dist/demod/demod-nbfm.js +0 -114
- package/dist/demod/demod-nbfm.js.map +0 -1
- package/dist/demod/demod-ssb.d.ts +0 -55
- package/dist/demod/demod-ssb.d.ts.map +0 -1
- package/dist/demod/demod-ssb.js +0 -112
- package/dist/demod/demod-ssb.js.map +0 -1
- package/dist/demod/demod-wbfm.d.ts +0 -113
- package/dist/demod/demod-wbfm.d.ts.map +0 -1
- package/dist/demod/demod-wbfm.js +0 -212
- package/dist/demod/demod-wbfm.js.map +0 -1
- package/dist/demod/demodulator.d.ts +0 -3
- package/dist/demod/demodulator.d.ts.map +0 -1
- package/dist/demod/demodulator.js +0 -28
- package/dist/demod/demodulator.js.map +0 -1
- package/dist/demod/empty-demodulator.d.ts +0 -82
- package/dist/demod/empty-demodulator.d.ts.map +0 -1
- package/dist/demod/empty-demodulator.js +0 -149
- package/dist/demod/empty-demodulator.js.map +0 -1
- package/dist/demod/modes.d.ts +0 -107
- package/dist/demod/modes.d.ts.map +0 -1
- package/dist/demod/modes.js +0 -101
- package/dist/demod/modes.js.map +0 -1
- package/dist/demod/player.d.ts +0 -19
- package/dist/demod/player.d.ts.map +0 -1
- package/dist/demod/player.js +0 -15
- package/dist/demod/player.js.map +0 -1
- package/dist/demod/sample-counter.d.ts +0 -22
- package/dist/demod/sample-counter.d.ts.map +0 -1
- package/dist/demod/sample-counter.js +0 -57
- package/dist/demod/sample-counter.js.map +0 -1
- package/dist/demod/spectrum.d.ts +0 -23
- package/dist/demod/spectrum.d.ts.map +0 -1
- package/dist/demod/spectrum.js +0 -78
- package/dist/demod/spectrum.js.map +0 -1
- package/dist/dsp/buffers.d.ts +0 -72
- package/dist/dsp/buffers.d.ts.map +0 -1
- package/dist/dsp/buffers.js +0 -122
- package/dist/dsp/buffers.js.map +0 -1
- package/dist/dsp/coefficients.d.ts +0 -22
- package/dist/dsp/coefficients.d.ts.map +0 -1
- package/dist/dsp/coefficients.js +0 -77
- package/dist/dsp/coefficients.js.map +0 -1
- package/dist/dsp/converters.d.ts +0 -15
- package/dist/dsp/converters.d.ts.map +0 -1
- package/dist/dsp/converters.js +0 -43
- package/dist/dsp/converters.js.map +0 -1
- package/dist/dsp/demodulators.d.ts +0 -73
- package/dist/dsp/demodulators.d.ts.map +0 -1
- package/dist/dsp/demodulators.js +0 -244
- package/dist/dsp/demodulators.js.map +0 -1
- package/dist/dsp/fft.d.ts +0 -53
- package/dist/dsp/fft.d.ts.map +0 -1
- package/dist/dsp/fft.js +0 -175
- package/dist/dsp/fft.js.map +0 -1
- package/dist/dsp/filters.d.ts +0 -91
- package/dist/dsp/filters.d.ts.map +0 -1
- package/dist/dsp/filters.js +0 -250
- package/dist/dsp/filters.js.map +0 -1
- package/dist/dsp/power.d.ts +0 -2
- package/dist/dsp/power.d.ts.map +0 -1
- package/dist/dsp/power.js +0 -23
- package/dist/dsp/power.js.map +0 -1
- package/dist/dsp/resamplers.d.ts +0 -33
- package/dist/dsp/resamplers.d.ts.map +0 -1
- package/dist/dsp/resamplers.js +0 -91
- package/dist/dsp/resamplers.js.map +0 -1
- package/dist/players/audioplayer.d.ts +0 -25
- package/dist/players/audioplayer.d.ts.map +0 -1
- package/dist/players/audioplayer.js +0 -68
- package/dist/players/audioplayer.js.map +0 -1
- package/dist/radio/msgqueue.d.ts +0 -23
- package/dist/radio/msgqueue.d.ts.map +0 -1
- package/dist/radio/msgqueue.js +0 -52
- package/dist/radio/msgqueue.js.map +0 -1
- package/dist/radio/sample_receiver.d.ts +0 -19
- package/dist/radio/sample_receiver.d.ts.map +0 -1
- package/dist/radio/sample_receiver.js +0 -54
- package/dist/radio/sample_receiver.js.map +0 -1
package/dist/dsp/resamplers.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
-
// Copyright 2013 Google Inc. All rights reserved.
|
|
3
|
-
//
|
|
4
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
// you may not use this file except in compliance with the License.
|
|
6
|
-
// You may obtain a copy of the License at
|
|
7
|
-
//
|
|
8
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
//
|
|
10
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
// See the License for the specific language governing permissions and
|
|
14
|
-
// limitations under the License.
|
|
15
|
-
import { Float32Buffer } from "./buffers.js";
|
|
16
|
-
import { makeLowPassKernel } from "./coefficients.js";
|
|
17
|
-
import { FIRFilter } from "./filters.js";
|
|
18
|
-
/** A class to convert the input to a lower sample rate. */
|
|
19
|
-
class Downsampler {
|
|
20
|
-
ratio;
|
|
21
|
-
/**
|
|
22
|
-
* @param ratio The ratio of input/output sample rates.
|
|
23
|
-
* @param kernel The coefficients for the low-pass filter.
|
|
24
|
-
*/
|
|
25
|
-
constructor(ratio, kernel) {
|
|
26
|
-
this.ratio = ratio;
|
|
27
|
-
this.filter = new FIRFilter(kernel);
|
|
28
|
-
this.buffer = new Float32Buffer(2);
|
|
29
|
-
}
|
|
30
|
-
filter;
|
|
31
|
-
buffer;
|
|
32
|
-
/**
|
|
33
|
-
* Returns a downsampled version of the given samples.
|
|
34
|
-
* @param samples The sample block to downsample.
|
|
35
|
-
* @returns The downsampled block.
|
|
36
|
-
*/
|
|
37
|
-
downsample(samples) {
|
|
38
|
-
const ratio = this.ratio;
|
|
39
|
-
const len = Math.floor(samples.length / ratio);
|
|
40
|
-
let output = this.buffer.get(len);
|
|
41
|
-
this.filter.loadSamples(samples);
|
|
42
|
-
for (let i = 0; i < len; ++i) {
|
|
43
|
-
output[i] = this.filter.get(Math.floor(i * ratio));
|
|
44
|
-
}
|
|
45
|
-
return output;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** A class to convert a real input to a lower sample rate. */
|
|
49
|
-
export class RealDownsampler {
|
|
50
|
-
/**
|
|
51
|
-
* @param inRate The input sample rate.
|
|
52
|
-
* @param outRate The output sample rate.
|
|
53
|
-
* @param filterLen The size of the low-pass filter.
|
|
54
|
-
*/
|
|
55
|
-
constructor(inRate, outRate, filterLen) {
|
|
56
|
-
const kernel = makeLowPassKernel(inRate, outRate / 2, filterLen);
|
|
57
|
-
this.downsampler = new Downsampler(inRate / outRate, kernel);
|
|
58
|
-
}
|
|
59
|
-
downsampler;
|
|
60
|
-
/**
|
|
61
|
-
* @param input The signal in the original sample rate.
|
|
62
|
-
* @returns The resampled signal.
|
|
63
|
-
*/
|
|
64
|
-
downsample(input) {
|
|
65
|
-
return this.downsampler.downsample(input);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/** A class to convert a complex input to a lower sample rate. */
|
|
69
|
-
export class ComplexDownsampler {
|
|
70
|
-
/**
|
|
71
|
-
* @param inRate The input sample rate.
|
|
72
|
-
* @param outRate The output sample rate.
|
|
73
|
-
* @param filterLen The size of the low-pass filter.
|
|
74
|
-
*/
|
|
75
|
-
constructor(inRate, outRate, filterLen) {
|
|
76
|
-
const kernel = makeLowPassKernel(inRate, outRate / 2, filterLen);
|
|
77
|
-
this.downsamplerI = new Downsampler(inRate / outRate, kernel);
|
|
78
|
-
this.downsamplerQ = new Downsampler(inRate / outRate, kernel);
|
|
79
|
-
}
|
|
80
|
-
downsamplerI;
|
|
81
|
-
downsamplerQ;
|
|
82
|
-
/**
|
|
83
|
-
* @param I The signal's real component.
|
|
84
|
-
* @param Q The signal's imaginary component.
|
|
85
|
-
* @returns An array with the output's real and imaginary components.
|
|
86
|
-
*/
|
|
87
|
-
downsample(I, Q) {
|
|
88
|
-
return [this.downsamplerI.downsample(I), this.downsamplerQ.downsample(Q)];
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
//# sourceMappingURL=resamplers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resamplers.js","sourceRoot":"","sources":["../../src/dsp/resamplers.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,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GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;IAEO,WAAW,CAAc;IAEjC;;;OAGG;IACH,UAAU,CAAC,KAAmB;QAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;CACF;AAED,iEAAiE;AACjE,MAAM,OAAO,kBAAkB;IAC7B;;;;OAIG;IACH,YAAY,MAAc,EAAE,OAAe,EAAE,SAAiB;QAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;QACjE,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9D,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IAEO,YAAY,CAAc;IAC1B,YAAY,CAAc;IAElC;;;;OAIG;IACH,UAAU,CAAC,CAAe,EAAE,CAAe;QACzC,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Player } from "../demod/player.js";
|
|
2
|
-
/** A class to play a series of sample buffers at a constant rate using the Web Audio API. */
|
|
3
|
-
export declare class AudioPlayer implements Player {
|
|
4
|
-
private static OUT_RATE;
|
|
5
|
-
private static TIME_BUFFER;
|
|
6
|
-
constructor();
|
|
7
|
-
private lastPlayedAt;
|
|
8
|
-
private ac;
|
|
9
|
-
private gainNode;
|
|
10
|
-
private gain;
|
|
11
|
-
/**
|
|
12
|
-
* Queues the given samples for playing at the appropriate time.
|
|
13
|
-
* @param leftSamples The samples for the left speaker.
|
|
14
|
-
* @param rightSamples The samples for the right speaker.
|
|
15
|
-
*/
|
|
16
|
-
play(leftSamples: Float32Array, rightSamples: Float32Array): void;
|
|
17
|
-
/**
|
|
18
|
-
* Sets the volume for playing samples.
|
|
19
|
-
* @param volume The volume to set, between 0 and 1.
|
|
20
|
-
*/
|
|
21
|
-
setVolume(volume: number): void;
|
|
22
|
-
getVolume(): number;
|
|
23
|
-
get sampleRate(): number;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=audioplayer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audioplayer.d.ts","sourceRoot":"","sources":["../../src/players/audioplayer.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,6FAA6F;AAC7F,qBAAa,WAAY,YAAW,MAAM;IACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAS;IAChC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAQ;;IASlC,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,EAAE,CAA2B;IACrC,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,IAAI,CAAS;IAErB;;;;OAIG;IACH,IAAI,CAAC,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY;IAwB1D;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM;IAOxB,SAAS,IAAI,MAAM;IAInB,IAAI,UAAU,IAAI,MAAM,CAGvB;CACF"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// Copyright 2013 Google Inc. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
/** A class to play a series of sample buffers at a constant rate using the Web Audio API. */
|
|
15
|
-
export class AudioPlayer {
|
|
16
|
-
static OUT_RATE = 48000;
|
|
17
|
-
static TIME_BUFFER = 0.05;
|
|
18
|
-
constructor() {
|
|
19
|
-
this.lastPlayedAt = -1;
|
|
20
|
-
this.ac = undefined;
|
|
21
|
-
this.gainNode = undefined;
|
|
22
|
-
this.gain = 0;
|
|
23
|
-
}
|
|
24
|
-
lastPlayedAt;
|
|
25
|
-
ac;
|
|
26
|
-
gainNode;
|
|
27
|
-
gain;
|
|
28
|
-
/**
|
|
29
|
-
* Queues the given samples for playing at the appropriate time.
|
|
30
|
-
* @param leftSamples The samples for the left speaker.
|
|
31
|
-
* @param rightSamples The samples for the right speaker.
|
|
32
|
-
*/
|
|
33
|
-
play(leftSamples, rightSamples) {
|
|
34
|
-
if (this.ac === undefined || this.gainNode === undefined) {
|
|
35
|
-
this.ac = new AudioContext();
|
|
36
|
-
this.gainNode = this.ac.createGain();
|
|
37
|
-
this.gainNode.gain.value = this.gain;
|
|
38
|
-
this.gainNode.connect(this.ac.destination);
|
|
39
|
-
}
|
|
40
|
-
const buffer = this.ac.createBuffer(2, leftSamples.length, AudioPlayer.OUT_RATE);
|
|
41
|
-
buffer.getChannelData(0).set(leftSamples);
|
|
42
|
-
buffer.getChannelData(1).set(rightSamples);
|
|
43
|
-
let source = this.ac.createBufferSource();
|
|
44
|
-
source.buffer = buffer;
|
|
45
|
-
source.connect(this.gainNode);
|
|
46
|
-
this.lastPlayedAt = Math.max(this.lastPlayedAt + leftSamples.length / AudioPlayer.OUT_RATE, this.ac.currentTime + AudioPlayer.TIME_BUFFER);
|
|
47
|
-
source.start(this.lastPlayedAt);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Sets the volume for playing samples.
|
|
51
|
-
* @param volume The volume to set, between 0 and 1.
|
|
52
|
-
*/
|
|
53
|
-
setVolume(volume) {
|
|
54
|
-
this.gain = volume;
|
|
55
|
-
if (this.gainNode !== undefined) {
|
|
56
|
-
this.gainNode.gain.value = volume;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
getVolume() {
|
|
60
|
-
return this.gain;
|
|
61
|
-
}
|
|
62
|
-
get sampleRate() {
|
|
63
|
-
if (this.ac)
|
|
64
|
-
return this.ac.sampleRate;
|
|
65
|
-
return 48000;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=audioplayer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audioplayer.js","sourceRoot":"","sources":["../../src/players/audioplayer.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,6FAA6F;AAC7F,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;IAElC;QACE,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAChB,CAAC;IAEO,YAAY,CAAS;IACrB,EAAE,CAA2B;IAC7B,QAAQ,CAAuB;IAC/B,IAAI,CAAS;IAErB;;;;OAIG;IACH,IAAI,CAAC,WAAyB,EAAE,YAA0B;QACxD,IAAI,IAAI,CAAC,EAAE,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,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,MAAM,CAAC;QACpC,CAAC;IACH,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,IAAI,UAAU;QACZ,IAAI,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC"}
|
package/dist/radio/msgqueue.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** A message channel, in which messages are sent and received asynchronously. */
|
|
2
|
-
export declare class Channel<Msg> {
|
|
3
|
-
constructor();
|
|
4
|
-
/** Messages waiting to be delivered. */
|
|
5
|
-
private msgQueue;
|
|
6
|
-
/** Clients waiting to receive messages. */
|
|
7
|
-
private notifyQueue;
|
|
8
|
-
/**
|
|
9
|
-
* Sends a message.
|
|
10
|
-
*
|
|
11
|
-
* If there is a client waiting to receive a message, it is delivered straight to it.
|
|
12
|
-
* Otherwise, the message is added to the queue.
|
|
13
|
-
*/
|
|
14
|
-
send(msg: Msg): void;
|
|
15
|
-
/**
|
|
16
|
-
* Receives a message, returning a promise.
|
|
17
|
-
*
|
|
18
|
-
* If there is a message in the queue, the promise resolves to that message.
|
|
19
|
-
* Otherwise, the promise will resolve when a message is received.
|
|
20
|
-
*/
|
|
21
|
-
receive(): Promise<Msg>;
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=msgqueue.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msgqueue.d.ts","sourceRoot":"","sources":["../../src/radio/msgqueue.ts"],"names":[],"mappings":"AAcA,iFAAiF;AACjF,qBAAa,OAAO,CAAC,GAAG;;IAMtB,wCAAwC;IACxC,OAAO,CAAC,QAAQ,CAAQ;IACxB,2CAA2C;IAC3C,OAAO,CAAC,WAAW,CAAyB;IAE5C;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,GAAG;IASb;;;;;OAKG;IACH,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC;CAKxB"}
|
package/dist/radio/msgqueue.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
/** A message channel, in which messages are sent and received asynchronously. */
|
|
15
|
-
export class Channel {
|
|
16
|
-
constructor() {
|
|
17
|
-
this.msgQueue = [];
|
|
18
|
-
this.notifyQueue = [];
|
|
19
|
-
}
|
|
20
|
-
/** Messages waiting to be delivered. */
|
|
21
|
-
msgQueue;
|
|
22
|
-
/** Clients waiting to receive messages. */
|
|
23
|
-
notifyQueue;
|
|
24
|
-
/**
|
|
25
|
-
* Sends a message.
|
|
26
|
-
*
|
|
27
|
-
* If there is a client waiting to receive a message, it is delivered straight to it.
|
|
28
|
-
* Otherwise, the message is added to the queue.
|
|
29
|
-
*/
|
|
30
|
-
send(msg) {
|
|
31
|
-
let notif = this.notifyQueue.shift();
|
|
32
|
-
if (notif !== undefined) {
|
|
33
|
-
notif(msg);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.msgQueue.push(msg);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Receives a message, returning a promise.
|
|
41
|
-
*
|
|
42
|
-
* If there is a message in the queue, the promise resolves to that message.
|
|
43
|
-
* Otherwise, the promise will resolve when a message is received.
|
|
44
|
-
*/
|
|
45
|
-
receive() {
|
|
46
|
-
let msg = this.msgQueue.shift();
|
|
47
|
-
if (msg !== undefined)
|
|
48
|
-
return Promise.resolve(msg);
|
|
49
|
-
return new Promise((r) => this.notifyQueue.push(r));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=msgqueue.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msgqueue.js","sourceRoot":"","sources":["../../src/radio/msgqueue.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,iFAAiF;AACjF,MAAM,OAAO,OAAO;IAClB;QACE,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,wCAAwC;IAChC,QAAQ,CAAQ;IACxB,2CAA2C;IACnC,WAAW,CAAyB;IAE5C;;;;;OAKG;IACH,IAAI,CAAC,GAAQ;QACX,IAAI,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACrC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,OAAO;QACL,IAAI,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/** Interface for classes that get samples from a Radio class. */
|
|
2
|
-
export interface SampleReceiver {
|
|
3
|
-
/** Sets the sample rate. */
|
|
4
|
-
setSampleRate(sampleRate: number): void;
|
|
5
|
-
/** Receives samples that should be demodulated. */
|
|
6
|
-
receiveSamples(I: Float32Array, Q: Float32Array, frequency: number): void;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A "composite" sample receiver that executes its component receivers in sequence.
|
|
10
|
-
*/
|
|
11
|
-
export declare class CompositeReceiver implements SampleReceiver {
|
|
12
|
-
receivers: SampleReceiver[];
|
|
13
|
-
/** Creates a ReceiverSequence out of the given SampleReceivers. */
|
|
14
|
-
static of(first: SampleReceiver, ...rest: SampleReceiver[]): SampleReceiver;
|
|
15
|
-
private constructor();
|
|
16
|
-
setSampleRate(sampleRate: number): void;
|
|
17
|
-
receiveSamples(I: Float32Array, Q: Float32Array, frequency: number): void;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=sample_receiver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sample_receiver.d.ts","sourceRoot":"","sources":["../../src/radio/sample_receiver.ts"],"names":[],"mappings":"AAcA,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC,mDAAmD;IACnD,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3E;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,cAAc;IAoB3B,SAAS,EAAE,cAAc,EAAE;IAnBtD,mEAAmE;IACnE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,cAAc,EAAE,GAAG,cAAc;IAkB3E,OAAO;IAEP,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAMvC,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAK1E"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
/**
|
|
15
|
-
* A "composite" sample receiver that executes its component receivers in sequence.
|
|
16
|
-
*/
|
|
17
|
-
export class CompositeReceiver {
|
|
18
|
-
receivers;
|
|
19
|
-
/** Creates a ReceiverSequence out of the given SampleReceivers. */
|
|
20
|
-
static of(first, ...rest) {
|
|
21
|
-
let list = [];
|
|
22
|
-
if (first instanceof CompositeReceiver) {
|
|
23
|
-
list.push(...first.receivers);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
list.push(first);
|
|
27
|
-
}
|
|
28
|
-
for (let next of rest) {
|
|
29
|
-
if (next instanceof CompositeReceiver) {
|
|
30
|
-
list.push(...next.receivers);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
list.push(next);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (list.length == 1)
|
|
37
|
-
return list[0];
|
|
38
|
-
return new CompositeReceiver(list);
|
|
39
|
-
}
|
|
40
|
-
constructor(receivers) {
|
|
41
|
-
this.receivers = receivers;
|
|
42
|
-
}
|
|
43
|
-
setSampleRate(sampleRate) {
|
|
44
|
-
for (let receiver of this.receivers) {
|
|
45
|
-
receiver.setSampleRate(sampleRate);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
receiveSamples(I, Q, frequency) {
|
|
49
|
-
for (let receiver of this.receivers) {
|
|
50
|
-
receiver.receiveSamples(I, Q, frequency);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=sample_receiver.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sample_receiver.js","sourceRoot":"","sources":["../../src/radio/sample_receiver.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAWjC;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAoBD;IAnB3B,mEAAmE;IACnE,MAAM,CAAC,EAAE,CAAC,KAAqB,EAAE,GAAG,IAAsB;QACxD,IAAI,IAAI,GAAqB,EAAE,CAAC;QAChC,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;YACvC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;QACD,KAAK,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,IAAI,YAAY,iBAAiB,EAAE,CAAC;gBACtC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/B,CAAC;iBAAM,CAAC;gBACN,IA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