@jtarrio/webrtlsdr 3.0.2 → 3.0.4
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/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/fakertl/fakertl.d.ts +37 -0
- package/dist/fakertl/fakertl.d.ts.map +1 -0
- package/dist/fakertl/fakertl.js +119 -0
- package/dist/fakertl/fakertl.js.map +1 -0
- 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/rtlcom.d.ts.map +1 -1
- package/dist/rtlsdr/rtlcom.js.map +1 -1
- package/package.json +1 -1
- 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 -34
- package/dist/players/audioplayer.d.ts.map +0 -1
- package/dist/players/audioplayer.js +0 -71
- 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/errors.d.ts
CHANGED
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,qBAAa,UAAW,SAAQ,KAAK;gBAEjC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,iBAAiB;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB;IAoBxD,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,oBAAY,cAAc;IACxB,YAAY,IAAA;IACZ,gBAAgB,IAAA;IAChB,iBAAiB,IAAA;IACjB,gBAAgB,IAAA;IAChB,UAAU,IAAA;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAcA,qBAAa,UAAW,SAAQ,KAAK;gBAEjC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,iBAAiB;gBAEjB,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB;IAoBxD,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,oBAAY,cAAc;IACxB,YAAY,IAAA;IACZ,gBAAgB,IAAA;IAChB,iBAAiB,IAAA;IACjB,gBAAgB,IAAA;IAChB,UAAU,IAAA;CACX;AAED,KAAK,iBAAiB,GAAG;IACvB,KAAK,CAAC,EAAE,GAAG,CAAC;CACb,CAAC"}
|
package/dist/errors.js
CHANGED
|
@@ -32,6 +32,5 @@ export var RadioErrorType;
|
|
|
32
32
|
RadioErrorType[RadioErrorType["UnsupportedDevice"] = 2] = "UnsupportedDevice";
|
|
33
33
|
RadioErrorType[RadioErrorType["UsbTransferError"] = 3] = "UsbTransferError";
|
|
34
34
|
RadioErrorType[RadioErrorType["TunerError"] = 4] = "TunerError";
|
|
35
|
-
RadioErrorType[RadioErrorType["DemodulationError"] = 5] = "DemodulationError";
|
|
36
35
|
})(RadioErrorType || (RadioErrorType = {}));
|
|
37
36
|
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.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,MAAM,OAAO,UAAW,SAAQ,KAAK;IAQnC,YACE,OAAe,EACf,aAAkD,EAClD,OAA2B;QAE3B,KAAK,CACH,OAAO,EACP,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,OAAO,aAAa,KAAK,QAAQ;
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.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,MAAM,OAAO,UAAW,SAAQ,KAAK;IAQnC,YACE,OAAe,EACf,aAAkD,EAClD,OAA2B;QAE3B,KAAK,CACH,OAAO,EACP,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,OAAO,aAAa,KAAK,QAAQ;gBACnC,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,SAAS,CACd,CAAC;QACF,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;YACtC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;YAC1B,IAAI,CAAC,IAAI,GAAG,cAAc,cAAc,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5D,CAAC;IACH,CAAC;IAED,IAAI,CAAkB;CACvB;AAED,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,mEAAY,CAAA;IACZ,2EAAgB,CAAA;IAChB,6EAAiB,CAAA;IACjB,2EAAgB,CAAA;IAChB,+DAAU,CAAA;AACZ,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SampleGenerator } from "@jtarrio/signals/sources/generated.js";
|
|
2
|
+
import { DirectSampling, RtlDevice, RtlDeviceProvider, SampleBlock } from "../rtlsdr.js";
|
|
3
|
+
/** A provider for fake RTL-SDR devices. */
|
|
4
|
+
export declare class FakeRtlDeviceProvider implements RtlDeviceProvider {
|
|
5
|
+
private generator;
|
|
6
|
+
/**
|
|
7
|
+
* @param generator A SampleGenerator that returns the signals for the fake RTL-SDR device.
|
|
8
|
+
*/
|
|
9
|
+
constructor(generator: SampleGenerator);
|
|
10
|
+
get(): Promise<RtlDevice>;
|
|
11
|
+
}
|
|
12
|
+
/** A class that can be used to test without using a real RTL-SDR device. */
|
|
13
|
+
export declare class FakeRtlDevice implements RtlDevice {
|
|
14
|
+
constructor(generator: SampleGenerator);
|
|
15
|
+
private source;
|
|
16
|
+
private pool;
|
|
17
|
+
private gain;
|
|
18
|
+
private gainMultiplier;
|
|
19
|
+
private ppm;
|
|
20
|
+
private directSamplingMethod;
|
|
21
|
+
private biasTee;
|
|
22
|
+
setSampleRate(rate: number): Promise<number>;
|
|
23
|
+
setCenterFrequency(freq: number): Promise<number>;
|
|
24
|
+
setGain(gain: number | null): Promise<void>;
|
|
25
|
+
getGain(): number | null;
|
|
26
|
+
setFrequencyCorrection(ppm: number): Promise<void>;
|
|
27
|
+
getFrequencyCorrection(): number;
|
|
28
|
+
setDirectSamplingMethod(method: DirectSampling): Promise<void>;
|
|
29
|
+
getDirectSamplingMethod(): DirectSampling;
|
|
30
|
+
enableBiasTee(enable: boolean): Promise<void>;
|
|
31
|
+
isBiasTeeEnabled(): boolean;
|
|
32
|
+
resetBuffer(): Promise<void>;
|
|
33
|
+
readSamples(length: number): Promise<SampleBlock>;
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
private adaptSource;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=fakertl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakertl.d.ts","sourceRoot":"","sources":["../../src/fakertl/fakertl.ts"],"names":[],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,CAAC,WAAW,CAAC;IAcvD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,OAAO,CAAC,WAAW;CAuBpB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Copyright 2026 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
|
+
import { GeneratedSource, } from "@jtarrio/signals/sources/generated.js";
|
|
15
|
+
import { U8Pool } from "@jtarrio/signals/dsp/buffers.js";
|
|
16
|
+
import { DirectSampling, } from "../rtlsdr.js";
|
|
17
|
+
/** A provider for fake RTL-SDR devices. */
|
|
18
|
+
export class FakeRtlDeviceProvider {
|
|
19
|
+
generator;
|
|
20
|
+
/**
|
|
21
|
+
* @param generator A SampleGenerator that returns the signals for the fake RTL-SDR device.
|
|
22
|
+
*/
|
|
23
|
+
constructor(generator) {
|
|
24
|
+
this.generator = generator;
|
|
25
|
+
}
|
|
26
|
+
async get() {
|
|
27
|
+
return new FakeRtlDevice(this.generator);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/** A class that can be used to test without using a real RTL-SDR device. */
|
|
31
|
+
export class FakeRtlDevice {
|
|
32
|
+
constructor(generator) {
|
|
33
|
+
this.gain = null;
|
|
34
|
+
this.gainMultiplier = 1;
|
|
35
|
+
this.ppm = 0;
|
|
36
|
+
this.directSamplingMethod = DirectSampling.Off;
|
|
37
|
+
this.biasTee = false;
|
|
38
|
+
this.source = new GeneratedSource(this.adaptSource(generator));
|
|
39
|
+
this.source.setSampleRate(1024000);
|
|
40
|
+
this.pool = new U8Pool(8);
|
|
41
|
+
}
|
|
42
|
+
source;
|
|
43
|
+
pool;
|
|
44
|
+
gain;
|
|
45
|
+
gainMultiplier;
|
|
46
|
+
ppm;
|
|
47
|
+
directSamplingMethod;
|
|
48
|
+
biasTee;
|
|
49
|
+
setSampleRate(rate) {
|
|
50
|
+
return this.source.setSampleRate(Math.floor(rate));
|
|
51
|
+
}
|
|
52
|
+
async setCenterFrequency(freq) {
|
|
53
|
+
return this.source.setCenterFrequency(freq);
|
|
54
|
+
}
|
|
55
|
+
async setGain(gain) {
|
|
56
|
+
this.gain = gain;
|
|
57
|
+
if (gain != null) {
|
|
58
|
+
this.gainMultiplier = Math.pow(10, (gain - 25) / 20);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
getGain() {
|
|
62
|
+
return this.gain;
|
|
63
|
+
}
|
|
64
|
+
async setFrequencyCorrection(ppm) {
|
|
65
|
+
this.ppm = Math.floor(ppm);
|
|
66
|
+
}
|
|
67
|
+
getFrequencyCorrection() {
|
|
68
|
+
return this.ppm;
|
|
69
|
+
}
|
|
70
|
+
async setDirectSamplingMethod(method) {
|
|
71
|
+
this.directSamplingMethod = method;
|
|
72
|
+
}
|
|
73
|
+
getDirectSamplingMethod() {
|
|
74
|
+
return this.directSamplingMethod;
|
|
75
|
+
}
|
|
76
|
+
async enableBiasTee(enable) {
|
|
77
|
+
this.biasTee = enable;
|
|
78
|
+
}
|
|
79
|
+
isBiasTeeEnabled() {
|
|
80
|
+
return this.biasTee;
|
|
81
|
+
}
|
|
82
|
+
resetBuffer() {
|
|
83
|
+
return this.source.startReceiving();
|
|
84
|
+
}
|
|
85
|
+
async readSamples(length) {
|
|
86
|
+
let output = await this.source.readSamples(length);
|
|
87
|
+
let data = this.pool.get(output.I.length * 2);
|
|
88
|
+
for (let i = 0; i < output.I.length; ++i) {
|
|
89
|
+
data[2 * i] = output.I[i];
|
|
90
|
+
data[2 * i + 1] = output.Q[i];
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
frequency: output.frequency,
|
|
94
|
+
data: data.buffer,
|
|
95
|
+
directSampling: false,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
close() {
|
|
99
|
+
return this.source.close();
|
|
100
|
+
}
|
|
101
|
+
adaptSource(generator) {
|
|
102
|
+
return (firstSample, sampleRate, centerFrequency, I, Q) => {
|
|
103
|
+
centerFrequency = centerFrequency * (1 + this.ppm / 1e6);
|
|
104
|
+
generator(firstSample, sampleRate, centerFrequency, I, Q);
|
|
105
|
+
if (this.gain !== null) {
|
|
106
|
+
let mul = this.gainMultiplier;
|
|
107
|
+
for (let i = 0; i < I.length; ++i) {
|
|
108
|
+
I[i] = Math.max(-1, Math.min(I[i] * mul, 1));
|
|
109
|
+
Q[i] = Math.max(-1, Math.min(Q[i] * mul, 1));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (let i = 0; i < I.length; ++i) {
|
|
113
|
+
I[i] = Math.round(((I[i] + 1) * 255) / 2);
|
|
114
|
+
Q[i] = Math.round(((Q[i] + 1) * 255) / 2);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=fakertl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fakertl.js","sourceRoot":"","sources":["../../src/fakertl/fakertl.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,OAAO,EACL,eAAe,GAEhB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,i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;YACH,CAAC;YACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;gBAClC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;gBAC1C,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;CACF"}
|
package/dist/radio/radio.d.ts
CHANGED
|
@@ -1,97 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/** State machine to orchestrate the RTL2832, demodulation, and audio playing. */
|
|
2
|
+
import { Radio as BaseRadio, RadioEvent as BaseRadioEvent, RadioEventType as BaseRadioEventType, RadioOptions, SampleBlock } from "@jtarrio/signals/radio.js";
|
|
3
|
+
import { DirectSampling } from "../rtlsdr/rtldevice.js";
|
|
4
|
+
import { RtlParameter, RtlProvider } from "./source.js";
|
|
5
|
+
import { SampleReceiver } from "@jtarrio/signals/radio/sample_receiver.js";
|
|
6
|
+
export { type RadioOptions } from "@jtarrio/signals/radio/radio.js";
|
|
3
7
|
/** The information in a 'radio' event. */
|
|
4
|
-
export type RadioEventType = {
|
|
5
|
-
type: "started";
|
|
6
|
-
} | {
|
|
7
|
-
type: "stopped";
|
|
8
|
-
} | {
|
|
8
|
+
export type RadioEventType = BaseRadioEventType | {
|
|
9
9
|
type: "directSampling";
|
|
10
10
|
active: boolean;
|
|
11
|
-
} | {
|
|
12
|
-
type: "error";
|
|
13
|
-
exception: any;
|
|
14
11
|
};
|
|
15
12
|
/** The type of 'radio' events. */
|
|
16
13
|
export declare class RadioEvent extends CustomEvent<RadioEventType> {
|
|
17
14
|
constructor(e: RadioEventType);
|
|
18
15
|
}
|
|
19
|
-
/**
|
|
20
|
-
export
|
|
16
|
+
/** Provides controls to play, stop, and tune the radio. */
|
|
17
|
+
export declare class Radio extends BaseRadio<RtlParameter> {
|
|
21
18
|
/**
|
|
22
|
-
*
|
|
19
|
+
* Creates an instance of Radio.
|
|
23
20
|
*
|
|
24
|
-
*
|
|
25
|
-
* implies smaller buffers, thus smaller latency. It also increases your
|
|
26
|
-
* CPU requirements, though.
|
|
21
|
+
* Since this constructor sends commands, you should call `ready()` before using the radio.
|
|
27
22
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
23
|
+
* @param rtlProvider a RtlSignalSourceProvider instance.
|
|
24
|
+
* @param sampleReceiver the object that will receive the signals from the RTL source.
|
|
25
|
+
* @param options options for the radio.
|
|
30
26
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/** Provides controls to play, stop, and tune the radio. */
|
|
34
|
-
export declare class Radio extends EventTarget {
|
|
35
|
-
private rtlProvider;
|
|
36
|
-
private sampleReceiver;
|
|
37
|
-
private options?;
|
|
38
|
-
/** @param sampleReceiver the object that will receive the radio samples. */
|
|
39
|
-
constructor(rtlProvider: RtlDeviceProvider, sampleReceiver: SampleReceiver, options?: RadioOptions | undefined);
|
|
40
|
-
/** Current sample rate. */
|
|
41
|
-
private sampleRate;
|
|
42
|
-
/** Current state. */
|
|
43
|
-
private state;
|
|
44
|
-
/** Channel to send messages to the state machine. */
|
|
45
|
-
private channel;
|
|
46
|
-
/** Frequency correction factor, in PPM. */
|
|
47
|
-
private frequencyCorrection;
|
|
48
|
-
/** RF gain in dB, or null for automatic. */
|
|
49
|
-
private gain;
|
|
50
|
-
/** Currently tuned frequency. */
|
|
51
|
-
private frequency;
|
|
52
|
-
/** Whether direct sampling mode is enabled. */
|
|
53
|
-
private directSamplingMethod;
|
|
54
|
-
/** Whether the bias tee is enabled. */
|
|
55
|
-
private biasTeeEnabled;
|
|
56
|
-
/** Starts playing the radio. */
|
|
57
|
-
start(): void;
|
|
58
|
-
/** Stops playing the radio. */
|
|
59
|
-
stop(): void;
|
|
60
|
-
/** Returns whether the radio is playing (or scanning). */
|
|
61
|
-
isPlaying(): boolean;
|
|
62
|
-
/** Tunes the radio to this frequency. */
|
|
63
|
-
setFrequency(freq: number): void;
|
|
64
|
-
/** Returns the tuned frequency. */
|
|
65
|
-
getFrequency(): number;
|
|
27
|
+
constructor(rtlProvider: RtlProvider, sampleReceiver: SampleReceiver, options?: RadioOptions);
|
|
28
|
+
private directSampling;
|
|
66
29
|
/** Sets the frequency correction factor, in PPM. */
|
|
67
|
-
setFrequencyCorrection(ppm: number): void
|
|
30
|
+
setFrequencyCorrection(ppm: number): Promise<void>;
|
|
68
31
|
/** Returns the current frequency correction factor. */
|
|
69
32
|
getFrequencyCorrection(): number;
|
|
70
33
|
/**
|
|
71
34
|
* Sets the RF gain.
|
|
72
35
|
* @param gain the gain in dB, or null for automatic gain control.
|
|
73
36
|
*/
|
|
74
|
-
setGain(gain: number | null): void
|
|
37
|
+
setGain(gain: number | null): Promise<void>;
|
|
75
38
|
/**
|
|
76
39
|
* Returns the RF gain.
|
|
77
40
|
* @returns the gain in dB, or null for automatic gain control.
|
|
78
41
|
*/
|
|
79
42
|
getGain(): number | null;
|
|
80
43
|
/** Sets the direct sampling method. */
|
|
81
|
-
setDirectSamplingMethod(method: DirectSampling): void
|
|
44
|
+
setDirectSamplingMethod(method: DirectSampling): Promise<void>;
|
|
82
45
|
/** Returns the current direct sampling method. */
|
|
83
46
|
getDirectSamplingMethod(): DirectSampling;
|
|
84
|
-
/** Changes the sample rate. This change only takes effect when the radio is started. */
|
|
85
|
-
setSampleRate(sampleRate: number): void;
|
|
86
|
-
/** Returns the current sample rate. */
|
|
87
|
-
getSampleRate(): number;
|
|
88
47
|
/** Enables or disables the bias tee. */
|
|
89
|
-
enableBiasTee(enable: boolean): void
|
|
48
|
+
enableBiasTee(enable: boolean): Promise<void>;
|
|
90
49
|
/** Returns whether the bias tee is enabled. */
|
|
91
50
|
isBiasTeeEnabled(): boolean;
|
|
92
|
-
|
|
93
|
-
private runLoop;
|
|
51
|
+
onReceiveSamples(block: SampleBlock): void;
|
|
94
52
|
addEventListener(type: "radio", callback: (e: RadioEvent) => void | null, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
53
|
+
addEventListener(type: "radio", callback: (e: BaseRadioEvent) => void | null, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
95
54
|
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void;
|
|
96
55
|
}
|
|
97
56
|
//# sourceMappingURL=radio.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":"AAcA,iFAAiF;AAEjF,OAAO,EACL,KAAK,IAAI,SAAS,EAClB,UAAU,IAAI,cAAc,EAC5B,cAAc,IAAI,kBAAkB,EACpC,YAAY,EACZ,WAAW,EACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAEpE,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GACtB,kBAAkB,GAClB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC;AAEhD,kCAAkC;AAClC,qBAAa,UAAW,SAAQ,WAAW,CAAC,cAAc,CAAC;gBAC7C,CAAC,EAAE,cAAc;CAG9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