mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-24 00:34:44 +01:00
DSP code cleanup
This commit is contained in:
parent
1f1b0cd45e
commit
ff030397a4
@ -12,9 +12,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<MonoToStereo>::registerInput(_in);
|
generic_block<MonoToStereo>::registerInput(_in);
|
||||||
generic_block<MonoToStereo>::registerOutput(&out);
|
generic_block<MonoToStereo>::registerOutput(&out);
|
||||||
|
generic_block<MonoToStereo>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in) {
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<MonoToStereo>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<MonoToStereo>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<MonoToStereo>::ctrlMtx);
|
||||||
generic_block<MonoToStereo>::tempStop();
|
generic_block<MonoToStereo>::tempStop();
|
||||||
generic_block<MonoToStereo>::unregisterInput(_in);
|
generic_block<MonoToStereo>::unregisterInput(_in);
|
||||||
@ -53,9 +55,11 @@ namespace dsp {
|
|||||||
generic_block<ChannelsToStereo>::registerInput(_in_left);
|
generic_block<ChannelsToStereo>::registerInput(_in_left);
|
||||||
generic_block<ChannelsToStereo>::registerInput(_in_right);
|
generic_block<ChannelsToStereo>::registerInput(_in_right);
|
||||||
generic_block<ChannelsToStereo>::registerOutput(&out);
|
generic_block<ChannelsToStereo>::registerOutput(&out);
|
||||||
|
generic_block<ChannelsToStereo>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in_left, stream<float>* in_right) {
|
void setInput(stream<float>* in_left, stream<float>* in_right) {
|
||||||
|
assert(generic_block<ChannelsToStereo>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<ChannelsToStereo>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<ChannelsToStereo>::ctrlMtx);
|
||||||
generic_block<ChannelsToStereo>::tempStop();
|
generic_block<ChannelsToStereo>::tempStop();
|
||||||
generic_block<ChannelsToStereo>::unregisterInput(_in_left);
|
generic_block<ChannelsToStereo>::unregisterInput(_in_left);
|
||||||
@ -100,9 +104,11 @@ namespace dsp {
|
|||||||
StereoToMono(stream<stereo_t>* in) { init(in); }
|
StereoToMono(stream<stereo_t>* in) { init(in); }
|
||||||
|
|
||||||
~StereoToMono() {
|
~StereoToMono() {
|
||||||
|
if (!generic_block<StereoToMono>::_block_init) { return; }
|
||||||
generic_block<StereoToMono>::stop();
|
generic_block<StereoToMono>::stop();
|
||||||
delete[] l_buf;
|
delete[] l_buf;
|
||||||
delete[] r_buf;
|
delete[] r_buf;
|
||||||
|
generic_block<StereoToMono>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<stereo_t>* in) {
|
void init(stream<stereo_t>* in) {
|
||||||
@ -111,9 +117,11 @@ namespace dsp {
|
|||||||
r_buf = new float[STREAM_BUFFER_SIZE];
|
r_buf = new float[STREAM_BUFFER_SIZE];
|
||||||
generic_block<StereoToMono>::registerInput(_in);
|
generic_block<StereoToMono>::registerInput(_in);
|
||||||
generic_block<StereoToMono>::registerOutput(&out);
|
generic_block<StereoToMono>::registerOutput(&out);
|
||||||
|
generic_block<StereoToMono>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<stereo_t>* in) {
|
void setInput(stream<stereo_t>* in) {
|
||||||
|
assert(generic_block<StereoToMono>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<StereoToMono>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<StereoToMono>::ctrlMtx);
|
||||||
generic_block<StereoToMono>::tempStop();
|
generic_block<StereoToMono>::tempStop();
|
||||||
generic_block<StereoToMono>::unregisterInput(_in);
|
generic_block<StereoToMono>::unregisterInput(_in);
|
||||||
@ -155,9 +163,11 @@ namespace dsp {
|
|||||||
generic_block<StereoToChannels>::registerInput(_in);
|
generic_block<StereoToChannels>::registerInput(_in);
|
||||||
generic_block<StereoToChannels>::registerOutput(&out_left);
|
generic_block<StereoToChannels>::registerOutput(&out_left);
|
||||||
generic_block<StereoToChannels>::registerOutput(&out_right);
|
generic_block<StereoToChannels>::registerOutput(&out_right);
|
||||||
|
generic_block<StereoToChannels>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<stereo_t>* in) {
|
void setInput(stream<stereo_t>* in) {
|
||||||
|
assert(generic_block<StereoToChannels>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<StereoToChannels>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<StereoToChannels>::ctrlMtx);
|
||||||
generic_block<StereoToChannels>::tempStop();
|
generic_block<StereoToChannels>::tempStop();
|
||||||
generic_block<StereoToChannels>::unregisterInput(_in);
|
generic_block<StereoToChannels>::unregisterInput(_in);
|
||||||
|
@ -24,10 +24,13 @@ namespace dsp {
|
|||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
|
|
||||||
virtual ~generic_block() {
|
virtual ~generic_block() {
|
||||||
|
if (!_block_init) { return; }
|
||||||
stop();
|
stop();
|
||||||
|
_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void start() {
|
virtual void start() {
|
||||||
|
assert(_block_init);
|
||||||
std::lock_guard<std::mutex> lck(ctrlMtx);
|
std::lock_guard<std::mutex> lck(ctrlMtx);
|
||||||
if (running) {
|
if (running) {
|
||||||
return;
|
return;
|
||||||
@ -37,6 +40,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void stop() {
|
virtual void stop() {
|
||||||
|
assert(_block_init);
|
||||||
std::lock_guard<std::mutex> lck(ctrlMtx);
|
std::lock_guard<std::mutex> lck(ctrlMtx);
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return;
|
return;
|
||||||
@ -46,6 +50,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tempStart() {
|
void tempStart() {
|
||||||
|
assert(_block_init);
|
||||||
if (tempStopped) {
|
if (tempStopped) {
|
||||||
doStart();
|
doStart();
|
||||||
tempStopped = false;
|
tempStopped = false;
|
||||||
@ -53,13 +58,17 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tempStop() {
|
void tempStop() {
|
||||||
|
assert(_block_init);
|
||||||
if (running && !tempStopped) {
|
if (running && !tempStopped) {
|
||||||
doStop();
|
doStop();
|
||||||
tempStopped = true;
|
tempStopped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int calcOutSize(int inSize) { return inSize; }
|
virtual int calcOutSize(int inSize) {
|
||||||
|
assert(_block_init);
|
||||||
|
return inSize;
|
||||||
|
}
|
||||||
|
|
||||||
virtual int run() = 0;
|
virtual int run() = 0;
|
||||||
|
|
||||||
@ -119,17 +128,18 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _block_init = false;
|
||||||
|
|
||||||
|
std::mutex ctrlMtx;
|
||||||
|
|
||||||
std::vector<untyped_steam*> inputs;
|
std::vector<untyped_steam*> inputs;
|
||||||
std::vector<untyped_steam*> outputs;
|
std::vector<untyped_steam*> outputs;
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
bool tempStopped = false;
|
bool tempStopped = false;
|
||||||
|
|
||||||
std::thread workerThread;
|
std::thread workerThread;
|
||||||
|
|
||||||
protected:
|
|
||||||
std::mutex ctrlMtx;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class BLOCK>
|
template <class BLOCK>
|
||||||
@ -138,10 +148,13 @@ namespace dsp {
|
|||||||
virtual void init() {}
|
virtual void init() {}
|
||||||
|
|
||||||
virtual ~generic_hier_block() {
|
virtual ~generic_hier_block() {
|
||||||
|
if (!_block_init) { return; }
|
||||||
stop();
|
stop();
|
||||||
|
_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void start() {
|
virtual void start() {
|
||||||
|
assert(_block_init);
|
||||||
std::lock_guard<std::mutex> lck(ctrlMtx);
|
std::lock_guard<std::mutex> lck(ctrlMtx);
|
||||||
if (running) {
|
if (running) {
|
||||||
return;
|
return;
|
||||||
@ -151,6 +164,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void stop() {
|
virtual void stop() {
|
||||||
|
assert(_block_init);
|
||||||
std::lock_guard<std::mutex> lck(ctrlMtx);
|
std::lock_guard<std::mutex> lck(ctrlMtx);
|
||||||
if (!running) {
|
if (!running) {
|
||||||
return;
|
return;
|
||||||
@ -160,6 +174,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tempStart() {
|
void tempStart() {
|
||||||
|
assert(_block_init);
|
||||||
if (tempStopped) {
|
if (tempStopped) {
|
||||||
doStart();
|
doStart();
|
||||||
tempStopped = false;
|
tempStopped = false;
|
||||||
@ -167,13 +182,17 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tempStop() {
|
void tempStop() {
|
||||||
|
assert(_block_init);
|
||||||
if (running && !tempStopped) {
|
if (running && !tempStopped) {
|
||||||
doStop();
|
doStop();
|
||||||
tempStopped = true;
|
tempStopped = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int calcOutSize(int inSize) { return inSize; }
|
virtual int calcOutSize(int inSize) {
|
||||||
|
assert(_block_init);
|
||||||
|
return inSize;
|
||||||
|
}
|
||||||
|
|
||||||
friend BLOCK;
|
friend BLOCK;
|
||||||
|
|
||||||
@ -203,6 +222,7 @@ namespace dsp {
|
|||||||
bool running = false;
|
bool running = false;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool _block_init = false;
|
||||||
std::mutex ctrlMtx;
|
std::mutex ctrlMtx;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,11 @@ namespace dsp {
|
|||||||
|
|
||||||
RingBuffer(int maxLatency) { init(maxLatency); }
|
RingBuffer(int maxLatency) { init(maxLatency); }
|
||||||
|
|
||||||
~RingBuffer() { delete _buffer; }
|
~RingBuffer() {
|
||||||
|
if (!_init) { return; }
|
||||||
|
delete _buffer;
|
||||||
|
_init = false;
|
||||||
|
}
|
||||||
|
|
||||||
void init(int maxLatency) {
|
void init(int maxLatency) {
|
||||||
size = RING_BUF_SZ;
|
size = RING_BUF_SZ;
|
||||||
@ -25,9 +29,11 @@ namespace dsp {
|
|||||||
readable = 0;
|
readable = 0;
|
||||||
writable = size;
|
writable = size;
|
||||||
memset(_buffer, 0, size * sizeof(T));
|
memset(_buffer, 0, size * sizeof(T));
|
||||||
|
_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int read(T* data, int len) {
|
int read(T* data, int len) {
|
||||||
|
assert(_init);
|
||||||
int dataRead = 0;
|
int dataRead = 0;
|
||||||
int toRead = 0;
|
int toRead = 0;
|
||||||
while (dataRead < len) {
|
while (dataRead < len) {
|
||||||
@ -57,6 +63,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int readAndSkip(T* data, int len, int skip) {
|
int readAndSkip(T* data, int len, int skip) {
|
||||||
|
assert(_init);
|
||||||
int dataRead = 0;
|
int dataRead = 0;
|
||||||
int toRead = 0;
|
int toRead = 0;
|
||||||
while (dataRead < len) {
|
while (dataRead < len) {
|
||||||
@ -102,6 +109,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int waitUntilReadable() {
|
int waitUntilReadable() {
|
||||||
|
assert(_init);
|
||||||
if (_stopReader) { return -1; }
|
if (_stopReader) { return -1; }
|
||||||
int _r = getReadable();
|
int _r = getReadable();
|
||||||
if (_r != 0) { return _r; }
|
if (_r != 0) { return _r; }
|
||||||
@ -112,6 +120,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getReadable(bool lock = true) {
|
int getReadable(bool lock = true) {
|
||||||
|
assert(_init);
|
||||||
if (lock) { _readable_mtx.lock(); };
|
if (lock) { _readable_mtx.lock(); };
|
||||||
int _r = readable;
|
int _r = readable;
|
||||||
if (lock) { _readable_mtx.unlock(); };
|
if (lock) { _readable_mtx.unlock(); };
|
||||||
@ -119,6 +128,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int write(T* data, int len) {
|
int write(T* data, int len) {
|
||||||
|
assert(_init);
|
||||||
int dataWritten = 0;
|
int dataWritten = 0;
|
||||||
int toWrite = 0;
|
int toWrite = 0;
|
||||||
while (dataWritten < len) {
|
while (dataWritten < len) {
|
||||||
@ -149,6 +159,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int waitUntilwritable() {
|
int waitUntilwritable() {
|
||||||
|
assert(_init);
|
||||||
if (_stopWriter) { return -1; }
|
if (_stopWriter) { return -1; }
|
||||||
int _w = getWritable();
|
int _w = getWritable();
|
||||||
if (_w != 0) { return _w; }
|
if (_w != 0) { return _w; }
|
||||||
@ -159,6 +170,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getWritable(bool lock = true) {
|
int getWritable(bool lock = true) {
|
||||||
|
assert(_init);
|
||||||
if (lock) { _writable_mtx.lock(); };
|
if (lock) { _writable_mtx.lock(); };
|
||||||
int _w = writable;
|
int _w = writable;
|
||||||
if (lock) { _writable_mtx.unlock(); _readable_mtx.lock(); };
|
if (lock) { _writable_mtx.unlock(); _readable_mtx.lock(); };
|
||||||
@ -168,37 +180,45 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stopReader() {
|
void stopReader() {
|
||||||
|
assert(_init);
|
||||||
_stopReader = true;
|
_stopReader = true;
|
||||||
canReadVar.notify_one();
|
canReadVar.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopWriter() {
|
void stopWriter() {
|
||||||
|
assert(_init);
|
||||||
_stopWriter = true;
|
_stopWriter = true;
|
||||||
canWriteVar.notify_one();
|
canWriteVar.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getReadStop() {
|
bool getReadStop() {
|
||||||
|
assert(_init);
|
||||||
return _stopReader;
|
return _stopReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getWriteStop() {
|
bool getWriteStop() {
|
||||||
|
assert(_init);
|
||||||
return _stopWriter;
|
return _stopWriter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearReadStop() {
|
void clearReadStop() {
|
||||||
|
assert(_init);
|
||||||
_stopReader = false;
|
_stopReader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearWriteStop() {
|
void clearWriteStop() {
|
||||||
|
assert(_init);
|
||||||
_stopWriter = false;
|
_stopWriter = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMaxLatency(int maxLatency) {
|
void setMaxLatency(int maxLatency) {
|
||||||
|
assert(_init);
|
||||||
this->maxLatency = maxLatency;
|
this->maxLatency = maxLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
T* _buffer = NULL;
|
bool _init = false;
|
||||||
|
T* _buffer;
|
||||||
int size;
|
int size;
|
||||||
int readc;
|
int readc;
|
||||||
int writec;
|
int writec;
|
||||||
@ -231,9 +251,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<SampleFrameBuffer<T>>::registerInput(in);
|
generic_block<SampleFrameBuffer<T>>::registerInput(in);
|
||||||
generic_block<SampleFrameBuffer<T>>::registerOutput(&out);
|
generic_block<SampleFrameBuffer<T>>::registerOutput(&out);
|
||||||
|
generic_block<SampleFrameBuffer<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<SampleFrameBuffer<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<SampleFrameBuffer<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<SampleFrameBuffer<T>>::ctrlMtx);
|
||||||
generic_block<SampleFrameBuffer<T>>::tempStop();
|
generic_block<SampleFrameBuffer<T>>::tempStop();
|
||||||
generic_block<SampleFrameBuffer<T>>::unregisterInput(_in);
|
generic_block<SampleFrameBuffer<T>>::unregisterInput(_in);
|
||||||
|
@ -7,6 +7,7 @@ namespace dsp {
|
|||||||
class EdgeTrigClockRecovery : public generic_block<EdgeTrigClockRecovery> {
|
class EdgeTrigClockRecovery : public generic_block<EdgeTrigClockRecovery> {
|
||||||
public:
|
public:
|
||||||
EdgeTrigClockRecovery() {}
|
EdgeTrigClockRecovery() {}
|
||||||
|
|
||||||
EdgeTrigClockRecovery(stream<float>* in, int omega) { init(in, omega); }
|
EdgeTrigClockRecovery(stream<float>* in, int omega) { init(in, omega); }
|
||||||
|
|
||||||
void init(stream<float>* in, int omega) {
|
void init(stream<float>* in, int omega) {
|
||||||
@ -14,9 +15,11 @@ namespace dsp {
|
|||||||
samplesPerSymbol = omega;
|
samplesPerSymbol = omega;
|
||||||
generic_block<EdgeTrigClockRecovery>::registerInput(_in);
|
generic_block<EdgeTrigClockRecovery>::registerInput(_in);
|
||||||
generic_block<EdgeTrigClockRecovery>::registerOutput(&out);
|
generic_block<EdgeTrigClockRecovery>::registerOutput(&out);
|
||||||
|
generic_block<EdgeTrigClockRecovery>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in) {
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<EdgeTrigClockRecovery>::_block_init);
|
||||||
generic_block<EdgeTrigClockRecovery>::tempStop();
|
generic_block<EdgeTrigClockRecovery>::tempStop();
|
||||||
generic_block<EdgeTrigClockRecovery>::unregisterInput(_in);
|
generic_block<EdgeTrigClockRecovery>::unregisterInput(_in);
|
||||||
_in = in;
|
_in = in;
|
||||||
@ -69,6 +72,7 @@ namespace dsp {
|
|||||||
class MMClockRecovery : public generic_block<MMClockRecovery<T>> {
|
class MMClockRecovery : public generic_block<MMClockRecovery<T>> {
|
||||||
public:
|
public:
|
||||||
MMClockRecovery() {}
|
MMClockRecovery() {}
|
||||||
|
|
||||||
MMClockRecovery(stream<T>* in, float omega, float gainOmega, float muGain, float omegaRelLimit) {
|
MMClockRecovery(stream<T>* in, float omega, float gainOmega, float muGain, float omegaRelLimit) {
|
||||||
init(in, omega, gainOmega, muGain, omegaRelLimit);
|
init(in, omega, gainOmega, muGain, omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -88,9 +92,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<MMClockRecovery<T>>::registerInput(_in);
|
generic_block<MMClockRecovery<T>>::registerInput(_in);
|
||||||
generic_block<MMClockRecovery<T>>::registerOutput(&out);
|
generic_block<MMClockRecovery<T>>::registerOutput(&out);
|
||||||
|
generic_block<MMClockRecovery<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOmega(float omega, float omegaRelLimit) {
|
void setOmega(float omega, float omegaRelLimit) {
|
||||||
|
assert(generic_block<MMClockRecovery<T>>::_block_init);
|
||||||
generic_block<MMClockRecovery<T>>::tempStop();
|
generic_block<MMClockRecovery<T>>::tempStop();
|
||||||
omegaMin = _omega - (_omega * _omegaRelLimit);
|
omegaMin = _omega - (_omega * _omegaRelLimit);
|
||||||
omegaMax = _omega + (_omega * _omegaRelLimit);
|
omegaMax = _omega + (_omega * _omegaRelLimit);
|
||||||
@ -100,6 +106,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setGains(float omegaGain, float muGain) {
|
void setGains(float omegaGain, float muGain) {
|
||||||
|
assert(generic_block<MMClockRecovery<T>>::_block_init);
|
||||||
generic_block<MMClockRecovery<T>>::tempStop();
|
generic_block<MMClockRecovery<T>>::tempStop();
|
||||||
_gainOmega = omegaGain;
|
_gainOmega = omegaGain;
|
||||||
_muGain = muGain;
|
_muGain = muGain;
|
||||||
@ -107,6 +114,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setOmegaRelLimit(float omegaRelLimit) {
|
void setOmegaRelLimit(float omegaRelLimit) {
|
||||||
|
assert(generic_block<MMClockRecovery<T>>::_block_init);
|
||||||
generic_block<MMClockRecovery<T>>::tempStop();
|
generic_block<MMClockRecovery<T>>::tempStop();
|
||||||
_omegaRelLimit = omegaRelLimit;
|
_omegaRelLimit = omegaRelLimit;
|
||||||
omegaMin = _omega - (_omega * _omegaRelLimit);
|
omegaMin = _omega - (_omega * _omegaRelLimit);
|
||||||
@ -115,6 +123,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<MMClockRecovery<T>>::_block_init);
|
||||||
generic_block<MMClockRecovery<T>>::tempStop();
|
generic_block<MMClockRecovery<T>>::tempStop();
|
||||||
generic_block<MMClockRecovery<T>>::unregisterInput(_in);
|
generic_block<MMClockRecovery<T>>::unregisterInput(_in);
|
||||||
_in = in;
|
_in = in;
|
||||||
|
@ -14,9 +14,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<ComplexToStereo>::registerInput(_in);
|
generic_block<ComplexToStereo>::registerInput(_in);
|
||||||
generic_block<ComplexToStereo>::registerOutput(&out);
|
generic_block<ComplexToStereo>::registerOutput(&out);
|
||||||
|
generic_block<ComplexToStereo>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<ComplexToStereo>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<ComplexToStereo>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<ComplexToStereo>::ctrlMtx);
|
||||||
generic_block<ComplexToStereo>::tempStop();
|
generic_block<ComplexToStereo>::tempStop();
|
||||||
generic_block<ComplexToStereo>::unregisterInput(_in);
|
generic_block<ComplexToStereo>::unregisterInput(_in);
|
||||||
@ -53,9 +55,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<ComplexToReal>::registerInput(_in);
|
generic_block<ComplexToReal>::registerInput(_in);
|
||||||
generic_block<ComplexToReal>::registerOutput(&out);
|
generic_block<ComplexToReal>::registerOutput(&out);
|
||||||
|
generic_block<ComplexToReal>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<ComplexToReal>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<ComplexToReal>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<ComplexToReal>::ctrlMtx);
|
||||||
generic_block<ComplexToReal>::tempStop();
|
generic_block<ComplexToReal>::tempStop();
|
||||||
generic_block<ComplexToReal>::unregisterInput(_in);
|
generic_block<ComplexToReal>::unregisterInput(_in);
|
||||||
@ -92,9 +96,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<ComplexToImag>::registerInput(_in);
|
generic_block<ComplexToImag>::registerInput(_in);
|
||||||
generic_block<ComplexToImag>::registerOutput(&out);
|
generic_block<ComplexToImag>::registerOutput(&out);
|
||||||
|
generic_block<ComplexToImag>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<ComplexToImag>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<ComplexToImag>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<ComplexToImag>::ctrlMtx);
|
||||||
generic_block<ComplexToImag>::tempStop();
|
generic_block<ComplexToImag>::tempStop();
|
||||||
generic_block<ComplexToImag>::unregisterInput(_in);
|
generic_block<ComplexToImag>::unregisterInput(_in);
|
||||||
@ -129,8 +135,10 @@ namespace dsp {
|
|||||||
RealToComplex(stream<float>* in) { init(in); }
|
RealToComplex(stream<float>* in) { init(in); }
|
||||||
|
|
||||||
~RealToComplex() {
|
~RealToComplex() {
|
||||||
|
if (!generic_block<RealToComplex>::_block_init) { return; }
|
||||||
generic_block<RealToComplex>::stop();
|
generic_block<RealToComplex>::stop();
|
||||||
delete[] nullBuffer;
|
delete[] nullBuffer;
|
||||||
|
generic_block<RealToComplex>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<float>* in) {
|
void init(stream<float>* in) {
|
||||||
@ -139,9 +147,11 @@ namespace dsp {
|
|||||||
memset(nullBuffer, 0, STREAM_BUFFER_SIZE * sizeof(float));
|
memset(nullBuffer, 0, STREAM_BUFFER_SIZE * sizeof(float));
|
||||||
generic_block<RealToComplex>::registerInput(_in);
|
generic_block<RealToComplex>::registerInput(_in);
|
||||||
generic_block<RealToComplex>::registerOutput(&out);
|
generic_block<RealToComplex>::registerOutput(&out);
|
||||||
|
generic_block<RealToComplex>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in) {
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<RealToComplex>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<RealToComplex>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<RealToComplex>::ctrlMtx);
|
||||||
generic_block<RealToComplex>::tempStop();
|
generic_block<RealToComplex>::tempStop();
|
||||||
generic_block<RealToComplex>::unregisterInput(_in);
|
generic_block<RealToComplex>::unregisterInput(_in);
|
||||||
@ -179,9 +189,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<Int16CToComplex>::registerInput(_in);
|
generic_block<Int16CToComplex>::registerInput(_in);
|
||||||
generic_block<Int16CToComplex>::registerOutput(&out);
|
generic_block<Int16CToComplex>::registerOutput(&out);
|
||||||
|
generic_block<Int16CToComplex>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<int16_t>* in) {
|
void setInput(stream<int16_t>* in) {
|
||||||
|
assert(generic_block<Int16CToComplex>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Int16CToComplex>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Int16CToComplex>::ctrlMtx);
|
||||||
generic_block<Int16CToComplex>::tempStop();
|
generic_block<Int16CToComplex>::tempStop();
|
||||||
generic_block<Int16CToComplex>::unregisterInput(_in);
|
generic_block<Int16CToComplex>::unregisterInput(_in);
|
||||||
|
@ -13,7 +13,9 @@ namespace dsp {
|
|||||||
Deframer(stream<uint8_t>* in, int frameLen, uint8_t* syncWord, int syncLen) { init(in, frameLen, syncWord, syncLen); }
|
Deframer(stream<uint8_t>* in, int frameLen, uint8_t* syncWord, int syncLen) { init(in, frameLen, syncWord, syncLen); }
|
||||||
|
|
||||||
~Deframer() {
|
~Deframer() {
|
||||||
|
if (!generic_block<Deframer>::_block_init) { return; }
|
||||||
generic_block<Deframer>::stop();
|
generic_block<Deframer>::stop();
|
||||||
|
generic_block<Deframer>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<uint8_t>* in, int frameLen, uint8_t* syncWord, int syncLen) {
|
void init(stream<uint8_t>* in, int frameLen, uint8_t* syncWord, int syncLen) {
|
||||||
@ -29,6 +31,17 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<Deframer>::registerInput(_in);
|
generic_block<Deframer>::registerInput(_in);
|
||||||
generic_block<Deframer>::registerOutput(&out);
|
generic_block<Deframer>::registerOutput(&out);
|
||||||
|
generic_block<Deframer>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<Deframer>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Deframer>::ctrlMtx);
|
||||||
|
generic_block<Deframer>::tempStop();
|
||||||
|
generic_block<Deframer>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<Deframer>::registerInput(_in);
|
||||||
|
generic_block<Deframer>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -148,6 +161,17 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<ManchesterDeframer>::registerInput(_in);
|
generic_block<ManchesterDeframer>::registerInput(_in);
|
||||||
generic_block<ManchesterDeframer>::registerOutput(&out);
|
generic_block<ManchesterDeframer>::registerOutput(&out);
|
||||||
|
generic_block<ManchesterDeframer>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<ManchesterDeframer>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<ManchesterDeframer>::ctrlMtx);
|
||||||
|
generic_block<ManchesterDeframer>::tempStop();
|
||||||
|
generic_block<ManchesterDeframer>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<ManchesterDeframer>::registerInput(_in);
|
||||||
|
generic_block<ManchesterDeframer>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -226,6 +250,17 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<SymbolDeframer>::registerInput(_in);
|
generic_block<SymbolDeframer>::registerInput(_in);
|
||||||
generic_block<SymbolDeframer>::registerOutput(&out);
|
generic_block<SymbolDeframer>::registerOutput(&out);
|
||||||
|
generic_block<SymbolDeframer>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<SymbolDeframer>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<SymbolDeframer>::ctrlMtx);
|
||||||
|
generic_block<SymbolDeframer>::tempStop();
|
||||||
|
generic_block<SymbolDeframer>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<SymbolDeframer>::registerInput(_in);
|
||||||
|
generic_block<SymbolDeframer>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -296,6 +331,17 @@ namespace dsp {
|
|||||||
_inverted = inverted;
|
_inverted = inverted;
|
||||||
generic_block<ManchesterDecoder>::registerInput(_in);
|
generic_block<ManchesterDecoder>::registerInput(_in);
|
||||||
generic_block<ManchesterDecoder>::registerOutput(&out);
|
generic_block<ManchesterDecoder>::registerOutput(&out);
|
||||||
|
generic_block<ManchesterDecoder>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<ManchesterDecoder>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<ManchesterDecoder>::ctrlMtx);
|
||||||
|
generic_block<ManchesterDecoder>::tempStop();
|
||||||
|
generic_block<ManchesterDecoder>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<ManchesterDecoder>::registerInput(_in);
|
||||||
|
generic_block<ManchesterDecoder>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -337,6 +383,17 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<BitPacker>::registerInput(_in);
|
generic_block<BitPacker>::registerInput(_in);
|
||||||
generic_block<BitPacker>::registerOutput(&out);
|
generic_block<BitPacker>::registerOutput(&out);
|
||||||
|
generic_block<BitPacker>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<BitPacker>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<BitPacker>::ctrlMtx);
|
||||||
|
generic_block<BitPacker>::tempStop();
|
||||||
|
generic_block<BitPacker>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<BitPacker>::registerInput(_in);
|
||||||
|
generic_block<BitPacker>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
@ -44,9 +44,11 @@ namespace dsp {
|
|||||||
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
||||||
generic_block<FloatFMDemod>::registerInput(_in);
|
generic_block<FloatFMDemod>::registerInput(_in);
|
||||||
generic_block<FloatFMDemod>::registerOutput(&out);
|
generic_block<FloatFMDemod>::registerOutput(&out);
|
||||||
|
generic_block<FloatFMDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<FloatFMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
||||||
generic_block<FloatFMDemod>::tempStop();
|
generic_block<FloatFMDemod>::tempStop();
|
||||||
generic_block<FloatFMDemod>::unregisterInput(_in);
|
generic_block<FloatFMDemod>::unregisterInput(_in);
|
||||||
@ -56,6 +58,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert(generic_block<FloatFMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
||||||
generic_block<FloatFMDemod>::tempStop();
|
generic_block<FloatFMDemod>::tempStop();
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
@ -64,10 +67,12 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getSampleRate() {
|
float getSampleRate() {
|
||||||
|
assert(generic_block<FloatFMDemod>::_block_init);
|
||||||
return _sampleRate;
|
return _sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDeviation(float deviation) {
|
void setDeviation(float deviation) {
|
||||||
|
assert(generic_block<FloatFMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FloatFMDemod>::ctrlMtx);
|
||||||
generic_block<FloatFMDemod>::tempStop();
|
generic_block<FloatFMDemod>::tempStop();
|
||||||
_deviation = deviation;
|
_deviation = deviation;
|
||||||
@ -76,6 +81,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getDeviation() {
|
float getDeviation() {
|
||||||
|
assert(generic_block<FloatFMDemod>::_block_init);
|
||||||
return _deviation;
|
return _deviation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,9 +127,11 @@ namespace dsp {
|
|||||||
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
||||||
generic_block<FMDemod>::registerInput(_in);
|
generic_block<FMDemod>::registerInput(_in);
|
||||||
generic_block<FMDemod>::registerOutput(&out);
|
generic_block<FMDemod>::registerOutput(&out);
|
||||||
|
generic_block<FMDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<FMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FMDemod>::ctrlMtx);
|
||||||
generic_block<FMDemod>::tempStop();
|
generic_block<FMDemod>::tempStop();
|
||||||
generic_block<FMDemod>::unregisterInput(_in);
|
generic_block<FMDemod>::unregisterInput(_in);
|
||||||
@ -133,6 +141,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert(generic_block<FMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FMDemod>::ctrlMtx);
|
||||||
generic_block<FMDemod>::tempStop();
|
generic_block<FMDemod>::tempStop();
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
@ -141,15 +150,18 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float getSampleRate() {
|
float getSampleRate() {
|
||||||
|
assert(generic_block<FMDemod>::_block_init);
|
||||||
return _sampleRate;
|
return _sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDeviation(float deviation) {
|
void setDeviation(float deviation) {
|
||||||
|
assert(generic_block<FMDemod>::_block_init);
|
||||||
_deviation = deviation;
|
_deviation = deviation;
|
||||||
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
phasorSpeed = (2 * FL_M_PI) / (_sampleRate / _deviation);
|
||||||
}
|
}
|
||||||
|
|
||||||
float getDeviation() {
|
float getDeviation() {
|
||||||
|
assert(generic_block<FMDemod>::_block_init);
|
||||||
return _deviation;
|
return _deviation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,9 +206,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<AMDemod>::registerInput(_in);
|
generic_block<AMDemod>::registerInput(_in);
|
||||||
generic_block<AMDemod>::registerOutput(&out);
|
generic_block<AMDemod>::registerOutput(&out);
|
||||||
|
generic_block<AMDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<AMDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<AMDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<AMDemod>::ctrlMtx);
|
||||||
generic_block<AMDemod>::tempStop();
|
generic_block<AMDemod>::tempStop();
|
||||||
generic_block<AMDemod>::unregisterInput(_in);
|
generic_block<AMDemod>::unregisterInput(_in);
|
||||||
@ -237,8 +251,10 @@ namespace dsp {
|
|||||||
SSBDemod(stream<complex_t>* in, float sampleRate, float bandWidth, int mode) { init(in, sampleRate, bandWidth, mode); }
|
SSBDemod(stream<complex_t>* in, float sampleRate, float bandWidth, int mode) { init(in, sampleRate, bandWidth, mode); }
|
||||||
|
|
||||||
~SSBDemod() {
|
~SSBDemod() {
|
||||||
|
if (!generic_block<SSBDemod>::_block_init) { return; }
|
||||||
generic_block<SSBDemod>::stop();
|
generic_block<SSBDemod>::stop();
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
generic_block<SSBDemod>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -267,9 +283,11 @@ namespace dsp {
|
|||||||
buffer = new lv_32fc_t[STREAM_BUFFER_SIZE];
|
buffer = new lv_32fc_t[STREAM_BUFFER_SIZE];
|
||||||
generic_block<SSBDemod>::registerInput(_in);
|
generic_block<SSBDemod>::registerInput(_in);
|
||||||
generic_block<SSBDemod>::registerOutput(&out);
|
generic_block<SSBDemod>::registerOutput(&out);
|
||||||
|
generic_block<SSBDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<SSBDemod>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<SSBDemod>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<SSBDemod>::ctrlMtx);
|
||||||
generic_block<SSBDemod>::tempStop();
|
generic_block<SSBDemod>::tempStop();
|
||||||
generic_block<SSBDemod>::unregisterInput(_in);
|
generic_block<SSBDemod>::unregisterInput(_in);
|
||||||
@ -279,7 +297,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
// No need to restart
|
assert(generic_block<SSBDemod>::_block_init);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case MODE_USB:
|
case MODE_USB:
|
||||||
@ -295,7 +313,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBandWidth(float bandWidth) {
|
void setBandWidth(float bandWidth) {
|
||||||
// No need to restart
|
assert(generic_block<SSBDemod>::_block_init);
|
||||||
_bandWidth = bandWidth;
|
_bandWidth = bandWidth;
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case MODE_USB:
|
case MODE_USB:
|
||||||
@ -311,6 +329,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setMode(int mode) {
|
void setMode(int mode) {
|
||||||
|
assert(generic_block<SSBDemod>::_block_init);
|
||||||
_mode = mode;
|
_mode = mode;
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case MODE_USB:
|
case MODE_USB:
|
||||||
@ -352,6 +371,7 @@ namespace dsp {
|
|||||||
class MSKDemod : public generic_hier_block<MSKDemod> {
|
class MSKDemod : public generic_hier_block<MSKDemod> {
|
||||||
public:
|
public:
|
||||||
MSKDemod() {}
|
MSKDemod() {}
|
||||||
|
|
||||||
MSKDemod(stream<complex_t>* input, float sampleRate, float deviation, float baudRate, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
MSKDemod(stream<complex_t>* input, float sampleRate, float deviation, float baudRate, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
||||||
init(input, sampleRate, deviation, baudRate, omegaGain, muGain, omegaRelLimit);
|
init(input, sampleRate, deviation, baudRate, omegaGain, muGain, omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -370,9 +390,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_hier_block<MSKDemod>::registerBlock(&demod);
|
generic_hier_block<MSKDemod>::registerBlock(&demod);
|
||||||
generic_hier_block<MSKDemod>::registerBlock(&recov);
|
generic_hier_block<MSKDemod>::registerBlock(&recov);
|
||||||
|
generic_hier_block<MSKDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert(generic_hier_block<MSKDemod>::_block_init);
|
||||||
generic_hier_block<MSKDemod>::tempStop();
|
generic_hier_block<MSKDemod>::tempStop();
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
demod.setSampleRate(_sampleRate);
|
demod.setSampleRate(_sampleRate);
|
||||||
@ -381,23 +403,27 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setDeviation(float deviation) {
|
void setDeviation(float deviation) {
|
||||||
|
assert(generic_hier_block<MSKDemod>::_block_init);
|
||||||
_deviation = deviation;
|
_deviation = deviation;
|
||||||
demod.setDeviation(deviation);
|
demod.setDeviation(deviation);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBaudRate(float baudRate, float omegaRelLimit) {
|
void setBaudRate(float baudRate, float omegaRelLimit) {
|
||||||
|
assert(generic_hier_block<MSKDemod>::_block_init);
|
||||||
_baudRate = baudRate;
|
_baudRate = baudRate;
|
||||||
_omegaRelLimit = omegaRelLimit;
|
_omegaRelLimit = omegaRelLimit;
|
||||||
recov.setOmega(_sampleRate / _baudRate, _omegaRelLimit);
|
recov.setOmega(_sampleRate / _baudRate, _omegaRelLimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMMGains(float omegaGain, float myGain) {
|
void setMMGains(float omegaGain, float myGain) {
|
||||||
|
assert(generic_hier_block<MSKDemod>::_block_init);
|
||||||
_omegaGain = omegaGain;
|
_omegaGain = omegaGain;
|
||||||
_muGain = myGain;
|
_muGain = myGain;
|
||||||
recov.setGains(_omegaGain, _muGain);
|
recov.setGains(_omegaGain, _muGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOmegaRelLimit(float omegaRelLimit) {
|
void setOmegaRelLimit(float omegaRelLimit) {
|
||||||
|
assert(generic_hier_block<MSKDemod>::_block_init);
|
||||||
_omegaRelLimit = omegaRelLimit;
|
_omegaRelLimit = omegaRelLimit;
|
||||||
recov.setOmegaRelLimit(_omegaRelLimit);
|
recov.setOmegaRelLimit(_omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -420,6 +446,7 @@ namespace dsp {
|
|||||||
class PSKDemod : public generic_hier_block<PSKDemod<ORDER, OFFSET>> {
|
class PSKDemod : public generic_hier_block<PSKDemod<ORDER, OFFSET>> {
|
||||||
public:
|
public:
|
||||||
PSKDemod() {}
|
PSKDemod() {}
|
||||||
|
|
||||||
PSKDemod(stream<complex_t>* input, float sampleRate, float baudRate, int RRCTapCount = 31, float RRCAlpha = 0.32f, float agcRate = 10e-4, float costasLoopBw = 0.004f, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
PSKDemod(stream<complex_t>* input, float sampleRate, float baudRate, int RRCTapCount = 31, float RRCAlpha = 0.32f, float agcRate = 10e-4, float costasLoopBw = 0.004f, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
||||||
init(input, sampleRate, baudRate, RRCTapCount, RRCAlpha, agcRate, costasLoopBw, omegaGain, muGain, omegaRelLimit);
|
init(input, sampleRate, baudRate, RRCTapCount, RRCAlpha, agcRate, costasLoopBw, omegaGain, muGain, omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -456,13 +483,17 @@ namespace dsp {
|
|||||||
generic_hier_block<PSKDemod<ORDER, OFFSET>>::registerBlock(&recov);
|
generic_hier_block<PSKDemod<ORDER, OFFSET>>::registerBlock(&recov);
|
||||||
|
|
||||||
out = &recov.out;
|
out = &recov.out;
|
||||||
|
|
||||||
|
generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* input) {
|
void setInput(stream<complex_t>* input) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
agc.setInput(input);
|
agc.setInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
rrc.tempStop();
|
rrc.tempStop();
|
||||||
recov.tempStop();
|
recov.tempStop();
|
||||||
@ -474,6 +505,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBaudRate(float baudRate) {
|
void setBaudRate(float baudRate) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_baudRate = baudRate;
|
_baudRate = baudRate;
|
||||||
rrc.tempStop();
|
rrc.tempStop();
|
||||||
recov.tempStop();
|
recov.tempStop();
|
||||||
@ -485,6 +517,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setRRCParams(int RRCTapCount, float RRCAlpha) {
|
void setRRCParams(int RRCTapCount, float RRCAlpha) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_RRCTapCount = RRCTapCount;
|
_RRCTapCount = RRCTapCount;
|
||||||
_RRCAlpha = RRCAlpha;
|
_RRCAlpha = RRCAlpha;
|
||||||
taps.setTapCount(_RRCTapCount);
|
taps.setTapCount(_RRCTapCount);
|
||||||
@ -493,22 +526,26 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setAgcRate(float agcRate) {
|
void setAgcRate(float agcRate) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_agcRate = agcRate;
|
_agcRate = agcRate;
|
||||||
agc.setRate(_agcRate);
|
agc.setRate(_agcRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setCostasLoopBw(float costasLoopBw) {
|
void setCostasLoopBw(float costasLoopBw) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_costasLoopBw = costasLoopBw;
|
_costasLoopBw = costasLoopBw;
|
||||||
demod.setLoopBandwidth(_costasLoopBw);
|
demod.setLoopBandwidth(_costasLoopBw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMMGains(float omegaGain, float myGain) {
|
void setMMGains(float omegaGain, float myGain) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_omegaGain = omegaGain;
|
_omegaGain = omegaGain;
|
||||||
_muGain = myGain;
|
_muGain = myGain;
|
||||||
recov.setGains(_omegaGain, _muGain);
|
recov.setGains(_omegaGain, _muGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOmegaRelLimit(float omegaRelLimit) {
|
void setOmegaRelLimit(float omegaRelLimit) {
|
||||||
|
assert((generic_hier_block<PSKDemod<ORDER, OFFSET>>::_block_init));
|
||||||
_omegaRelLimit = omegaRelLimit;
|
_omegaRelLimit = omegaRelLimit;
|
||||||
recov.setOmegaRelLimit(_omegaRelLimit);
|
recov.setOmegaRelLimit(_omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -537,6 +574,7 @@ namespace dsp {
|
|||||||
class PMDemod : public generic_hier_block<PMDemod> {
|
class PMDemod : public generic_hier_block<PMDemod> {
|
||||||
public:
|
public:
|
||||||
PMDemod() {}
|
PMDemod() {}
|
||||||
|
|
||||||
PMDemod(stream<complex_t>* input, float sampleRate, float baudRate, float agcRate = 0.02e-3f, float pllLoopBandwidth = (0.06f*0.06f) / 4.0f, int rrcTapCount = 31, float rrcAlpha = 0.6f, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
PMDemod(stream<complex_t>* input, float sampleRate, float baudRate, float agcRate = 0.02e-3f, float pllLoopBandwidth = (0.06f*0.06f) / 4.0f, int rrcTapCount = 31, float rrcAlpha = 0.6f, float omegaGain = (0.01*0.01) / 4, float muGain = 0.01f, float omegaRelLimit = 0.005f) {
|
||||||
init(input, sampleRate, baudRate, agcRate, pllLoopBandwidth, rrcTapCount, rrcAlpha, omegaGain, muGain, omegaRelLimit);
|
init(input, sampleRate, baudRate, agcRate, pllLoopBandwidth, rrcTapCount, rrcAlpha, omegaGain, muGain, omegaRelLimit);
|
||||||
}
|
}
|
||||||
@ -564,23 +602,28 @@ namespace dsp {
|
|||||||
generic_hier_block<PMDemod>::registerBlock(&pll);
|
generic_hier_block<PMDemod>::registerBlock(&pll);
|
||||||
generic_hier_block<PMDemod>::registerBlock(&rrc);
|
generic_hier_block<PMDemod>::registerBlock(&rrc);
|
||||||
generic_hier_block<PMDemod>::registerBlock(&recov);
|
generic_hier_block<PMDemod>::registerBlock(&recov);
|
||||||
|
generic_hier_block<PMDemod>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* input) {
|
void setInput(stream<complex_t>* input) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
agc.setInput(input);
|
agc.setInput(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAgcRate(float agcRate) {
|
void setAgcRate(float agcRate) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
_agcRate = agcRate;
|
_agcRate = agcRate;
|
||||||
agc.setRate(_agcRate);
|
agc.setRate(_agcRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPllLoopBandwidth(float pllLoopBandwidth) {
|
void setPllLoopBandwidth(float pllLoopBandwidth) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
_pllLoopBandwidth = pllLoopBandwidth;
|
_pllLoopBandwidth = pllLoopBandwidth;
|
||||||
pll.setLoopBandwidth(_pllLoopBandwidth);
|
pll.setLoopBandwidth(_pllLoopBandwidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRRCParams(int rrcTapCount, float rrcAlpha) {
|
void setRRCParams(int rrcTapCount, float rrcAlpha) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
_rrcTapCount = rrcTapCount;
|
_rrcTapCount = rrcTapCount;
|
||||||
_rrcAlpha = rrcAlpha;
|
_rrcAlpha = rrcAlpha;
|
||||||
rrcwin.setTapCount(_rrcTapCount);
|
rrcwin.setTapCount(_rrcTapCount);
|
||||||
@ -589,12 +632,14 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setMMGains(float omegaGain, float muGain) {
|
void setMMGains(float omegaGain, float muGain) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
_omegaGain = omegaGain;
|
_omegaGain = omegaGain;
|
||||||
_muGain = muGain;
|
_muGain = muGain;
|
||||||
recov.setGains(_omegaGain, _muGain);
|
recov.setGains(_omegaGain, _muGain);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setOmegaRelLimit(float omegaRelLimit) {
|
void setOmegaRelLimit(float omegaRelLimit) {
|
||||||
|
assert(generic_hier_block<PMDemod>::_block_init);
|
||||||
_omegaRelLimit = omegaRelLimit;
|
_omegaRelLimit = omegaRelLimit;
|
||||||
recov.setOmegaRelLimit(_omegaRelLimit);
|
recov.setOmegaRelLimit(_omegaRelLimit);
|
||||||
}
|
}
|
||||||
|
@ -62,10 +62,6 @@ namespace dsp {
|
|||||||
|
|
||||||
FalconRS(stream<uint8_t>* in) { init(in); }
|
FalconRS(stream<uint8_t>* in) { init(in); }
|
||||||
|
|
||||||
~FalconRS() {
|
|
||||||
generic_block<FalconRS>::stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void init(stream<uint8_t>* in) {
|
void init(stream<uint8_t>* in) {
|
||||||
_in = in;
|
_in = in;
|
||||||
|
|
||||||
@ -76,6 +72,17 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<FalconRS>::registerInput(_in);
|
generic_block<FalconRS>::registerInput(_in);
|
||||||
generic_block<FalconRS>::registerOutput(&out);
|
generic_block<FalconRS>::registerOutput(&out);
|
||||||
|
generic_block<FalconRS>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<FalconRS>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<FalconRS>::ctrlMtx);
|
||||||
|
generic_block<FalconRS>::tempStop();
|
||||||
|
generic_block<FalconRS>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<FalconRS>::registerInput(_in);
|
||||||
|
generic_block<FalconRS>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
@ -14,15 +14,22 @@ namespace dsp {
|
|||||||
|
|
||||||
FalconPacketSync(stream<uint8_t>* in) { init(in); }
|
FalconPacketSync(stream<uint8_t>* in) { init(in); }
|
||||||
|
|
||||||
~FalconPacketSync() {
|
|
||||||
generic_block<FalconPacketSync>::stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void init(stream<uint8_t>* in) {
|
void init(stream<uint8_t>* in) {
|
||||||
_in = in;
|
_in = in;
|
||||||
|
|
||||||
generic_block<FalconPacketSync>::registerInput(_in);
|
generic_block<FalconPacketSync>::registerInput(_in);
|
||||||
generic_block<FalconPacketSync>::registerOutput(&out);
|
generic_block<FalconPacketSync>::registerOutput(&out);
|
||||||
|
generic_block<FalconPacketSync>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<FalconPacketSync>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<FalconPacketSync>::ctrlMtx);
|
||||||
|
generic_block<FalconPacketSync>::tempStop();
|
||||||
|
generic_block<FalconPacketSync>::unregisterInput(_in);
|
||||||
|
_in = in;
|
||||||
|
generic_block<FalconPacketSync>::registerInput(_in);
|
||||||
|
generic_block<FalconPacketSync>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
@ -13,9 +13,11 @@ namespace dsp {
|
|||||||
FIR(stream<T>* in, dsp::filter_window::generic_window* window) { init(in, window); }
|
FIR(stream<T>* in, dsp::filter_window::generic_window* window) { init(in, window); }
|
||||||
|
|
||||||
~FIR() {
|
~FIR() {
|
||||||
|
if (!generic_block<FIR<T>>::_block_init) { return; }
|
||||||
generic_block<FIR<T>>::stop();
|
generic_block<FIR<T>>::stop();
|
||||||
volk_free(buffer);
|
volk_free(buffer);
|
||||||
volk_free(taps);
|
volk_free(taps);
|
||||||
|
generic_block<FIR<T>>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<T>* in, dsp::filter_window::generic_window* window) {
|
void init(stream<T>* in, dsp::filter_window::generic_window* window) {
|
||||||
@ -29,9 +31,11 @@ namespace dsp {
|
|||||||
bufStart = &buffer[tapCount];
|
bufStart = &buffer[tapCount];
|
||||||
generic_block<FIR<T>>::registerInput(_in);
|
generic_block<FIR<T>>::registerInput(_in);
|
||||||
generic_block<FIR<T>>::registerOutput(&out);
|
generic_block<FIR<T>>::registerOutput(&out);
|
||||||
|
generic_block<FIR<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<FIR<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FIR<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FIR<T>>::ctrlMtx);
|
||||||
generic_block<FIR<T>>::tempStop();
|
generic_block<FIR<T>>::tempStop();
|
||||||
generic_block<FIR<T>>::unregisterInput(_in);
|
generic_block<FIR<T>>::unregisterInput(_in);
|
||||||
@ -41,6 +45,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void updateWindow(dsp::filter_window::generic_window* window) {
|
void updateWindow(dsp::filter_window::generic_window* window) {
|
||||||
|
assert(generic_block<FIR<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FIR<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FIR<T>>::ctrlMtx);
|
||||||
_window = window;
|
_window = window;
|
||||||
volk_free(taps);
|
volk_free(taps);
|
||||||
@ -99,8 +104,6 @@ namespace dsp {
|
|||||||
|
|
||||||
BFMDeemp(stream<stereo_t>* in, float sampleRate, float tau) { init(in, sampleRate, tau); }
|
BFMDeemp(stream<stereo_t>* in, float sampleRate, float tau) { init(in, sampleRate, tau); }
|
||||||
|
|
||||||
~BFMDeemp() { generic_block<BFMDeemp>::stop(); }
|
|
||||||
|
|
||||||
void init(stream<stereo_t>* in, float sampleRate, float tau) {
|
void init(stream<stereo_t>* in, float sampleRate, float tau) {
|
||||||
_in = in;
|
_in = in;
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
@ -109,9 +112,11 @@ namespace dsp {
|
|||||||
alpha = dt / (_tau + dt);
|
alpha = dt / (_tau + dt);
|
||||||
generic_block<BFMDeemp>::registerInput(_in);
|
generic_block<BFMDeemp>::registerInput(_in);
|
||||||
generic_block<BFMDeemp>::registerOutput(&out);
|
generic_block<BFMDeemp>::registerOutput(&out);
|
||||||
|
generic_block<BFMDeemp>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<stereo_t>* in) {
|
void setInput(stream<stereo_t>* in) {
|
||||||
|
assert(generic_block<BFMDeemp>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<BFMDeemp>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<BFMDeemp>::ctrlMtx);
|
||||||
generic_block<BFMDeemp>::tempStop();
|
generic_block<BFMDeemp>::tempStop();
|
||||||
generic_block<BFMDeemp>::unregisterInput(_in);
|
generic_block<BFMDeemp>::unregisterInput(_in);
|
||||||
@ -121,12 +126,14 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert(generic_block<BFMDeemp>::_block_init);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
float dt = 1.0f / _sampleRate;
|
float dt = 1.0f / _sampleRate;
|
||||||
alpha = dt / (_tau + dt);
|
alpha = dt / (_tau + dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTau(float tau) {
|
void setTau(float tau) {
|
||||||
|
assert(generic_block<BFMDeemp>::_block_init);
|
||||||
_tau = tau;
|
_tau = tau;
|
||||||
float dt = 1.0f / _sampleRate;
|
float dt = 1.0f / _sampleRate;
|
||||||
alpha = dt / (_tau + dt);
|
alpha = dt / (_tau + dt);
|
||||||
|
@ -16,6 +16,40 @@ namespace dsp {
|
|||||||
generic_block<Add<T>>::registerInput(a);
|
generic_block<Add<T>>::registerInput(a);
|
||||||
generic_block<Add<T>>::registerInput(b);
|
generic_block<Add<T>>::registerInput(b);
|
||||||
generic_block<Add<T>>::registerOutput(&out);
|
generic_block<Add<T>>::registerOutput(&out);
|
||||||
|
generic_block<Add<T>>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputs(stream<T>* a, stream<T>* b) {
|
||||||
|
assert(generic_block<Add<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Add<T>>::ctrlMtx);
|
||||||
|
generic_block<Add<T>>::tempStop();
|
||||||
|
generic_block<Add<T>>::unregisterInput(_a);
|
||||||
|
generic_block<Add<T>>::unregisterInput(_b);
|
||||||
|
_a = a;
|
||||||
|
_b = b;
|
||||||
|
generic_block<Add<T>>::registerInput(_a);
|
||||||
|
generic_block<Add<T>>::registerInput(_b);
|
||||||
|
generic_block<Add<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputA(stream<T>* a) {
|
||||||
|
assert(generic_block<Add<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Add<T>>::ctrlMtx);
|
||||||
|
generic_block<Add<T>>::tempStop();
|
||||||
|
generic_block<Add<T>>::unregisterInput(_a);
|
||||||
|
_a = a;
|
||||||
|
generic_block<Add<T>>::registerInput(_a);
|
||||||
|
generic_block<Add<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputB(stream<T>* b) {
|
||||||
|
assert(generic_block<Add<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Add<T>>::ctrlMtx);
|
||||||
|
generic_block<Add<T>>::tempStop();
|
||||||
|
generic_block<Add<T>>::unregisterInput(_b);
|
||||||
|
_b = b;
|
||||||
|
generic_block<Add<T>>::registerInput(_b);
|
||||||
|
generic_block<Add<T>>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -51,18 +85,52 @@ namespace dsp {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
class Substract : public generic_block<Substract<T>> {
|
class Subtract : public generic_block<Subtract<T>> {
|
||||||
public:
|
public:
|
||||||
Substract() {}
|
Subtract() {}
|
||||||
|
|
||||||
Substract(stream<T>* a, stream<T>* b) { init(a, b); }
|
Subtract(stream<T>* a, stream<T>* b) { init(a, b); }
|
||||||
|
|
||||||
void init(stream<T>* a, stream<T>* b) {
|
void init(stream<T>* a, stream<T>* b) {
|
||||||
_a = a;
|
_a = a;
|
||||||
_b = b;
|
_b = b;
|
||||||
generic_block<Substract<T>>::registerInput(a);
|
generic_block<Subtract<T>>::registerInput(a);
|
||||||
generic_block<Substract<T>>::registerInput(b);
|
generic_block<Subtract<T>>::registerInput(b);
|
||||||
generic_block<Substract<T>>::registerOutput(&out);
|
generic_block<Subtract<T>>::registerOutput(&out);
|
||||||
|
generic_block<Subtract<T>>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputs(stream<T>* a, stream<T>* b) {
|
||||||
|
assert(generic_block<Subtract<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Subtract<T>>::ctrlMtx);
|
||||||
|
generic_block<Subtract<T>>::tempStop();
|
||||||
|
generic_block<Subtract<T>>::unregisterInput(_a);
|
||||||
|
generic_block<Subtract<T>>::unregisterInput(_b);
|
||||||
|
_a = a;
|
||||||
|
_b = b;
|
||||||
|
generic_block<Subtract<T>>::registerInput(_a);
|
||||||
|
generic_block<Subtract<T>>::registerInput(_b);
|
||||||
|
generic_block<Subtract<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputA(stream<T>* a) {
|
||||||
|
assert(generic_block<Subtract<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Subtract<T>>::ctrlMtx);
|
||||||
|
generic_block<Subtract<T>>::tempStop();
|
||||||
|
generic_block<Subtract<T>>::unregisterInput(_a);
|
||||||
|
_a = a;
|
||||||
|
generic_block<Subtract<T>>::registerInput(_a);
|
||||||
|
generic_block<Subtract<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputB(stream<T>* b) {
|
||||||
|
assert(generic_block<Subtract<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Subtract<T>>::ctrlMtx);
|
||||||
|
generic_block<Subtract<T>>::tempStop();
|
||||||
|
generic_block<Subtract<T>>::unregisterInput(_b);
|
||||||
|
_b = b;
|
||||||
|
generic_block<Subtract<T>>::registerInput(_b);
|
||||||
|
generic_block<Subtract<T>>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
@ -110,6 +178,40 @@ namespace dsp {
|
|||||||
generic_block<Multiply>::registerInput(a);
|
generic_block<Multiply>::registerInput(a);
|
||||||
generic_block<Multiply>::registerInput(b);
|
generic_block<Multiply>::registerInput(b);
|
||||||
generic_block<Multiply>::registerOutput(&out);
|
generic_block<Multiply>::registerOutput(&out);
|
||||||
|
generic_block<Multiply>::_block_init = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputs(stream<T>* a, stream<T>* b) {
|
||||||
|
assert(generic_block<Multiply<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Multiply<T>>::ctrlMtx);
|
||||||
|
generic_block<Multiply<T>>::tempStop();
|
||||||
|
generic_block<Multiply<T>>::unregisterInput(_a);
|
||||||
|
generic_block<Multiply<T>>::unregisterInput(_b);
|
||||||
|
_a = a;
|
||||||
|
_b = b;
|
||||||
|
generic_block<Multiply<T>>::registerInput(_a);
|
||||||
|
generic_block<Multiply<T>>::registerInput(_b);
|
||||||
|
generic_block<Multiply<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputA(stream<T>* a) {
|
||||||
|
assert(generic_block<Multiply<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Multiply<T>>::ctrlMtx);
|
||||||
|
generic_block<Multiply<T>>::tempStop();
|
||||||
|
generic_block<Multiply<T>>::unregisterInput(_a);
|
||||||
|
_a = a;
|
||||||
|
generic_block<Multiply<T>>::registerInput(_a);
|
||||||
|
generic_block<Multiply<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInputB(stream<T>* b) {
|
||||||
|
assert(generic_block<Multiply<T>>::_block_init);
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<Multiply<T>>::ctrlMtx);
|
||||||
|
generic_block<Multiply<T>>::tempStop();
|
||||||
|
generic_block<Multiply<T>>::unregisterInput(_b);
|
||||||
|
_b = b;
|
||||||
|
generic_block<Multiply<T>>::registerInput(_b);
|
||||||
|
generic_block<Multiply<T>>::tempStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
@ -16,9 +16,11 @@ namespace dsp {
|
|||||||
void init(stream<stereo_t>* in) {
|
void init(stream<stereo_t>* in) {
|
||||||
_in = in;
|
_in = in;
|
||||||
generic_block<LevelMeter>::registerInput(_in);
|
generic_block<LevelMeter>::registerInput(_in);
|
||||||
|
generic_block<LevelMeter>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<stereo_t>* in) {
|
void setInput(stream<stereo_t>* in) {
|
||||||
|
assert(generic_block<LevelMeter>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<LevelMeter>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<LevelMeter>::ctrlMtx);
|
||||||
generic_block<LevelMeter>::tempStop();
|
generic_block<LevelMeter>::tempStop();
|
||||||
generic_block<LevelMeter>::unregisterInput(_in);
|
generic_block<LevelMeter>::unregisterInput(_in);
|
||||||
|
@ -18,9 +18,11 @@ namespace dsp {
|
|||||||
generic_block<HRPTDemux>::registerOutput(&SSPDOut);
|
generic_block<HRPTDemux>::registerOutput(&SSPDOut);
|
||||||
generic_block<HRPTDemux>::registerOutput(&MTVZAOut);
|
generic_block<HRPTDemux>::registerOutput(&MTVZAOut);
|
||||||
generic_block<HRPTDemux>::registerOutput(&MSUMROut);
|
generic_block<HRPTDemux>::registerOutput(&MSUMROut);
|
||||||
|
generic_block<HRPTDemux>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<uint8_t>* in) {
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<HRPTDemux>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HRPTDemux>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HRPTDemux>::ctrlMtx);
|
||||||
generic_block<HRPTDemux>::tempStop();
|
generic_block<HRPTDemux>::tempStop();
|
||||||
generic_block<HRPTDemux>::unregisterInput(_in);
|
generic_block<HRPTDemux>::unregisterInput(_in);
|
||||||
|
@ -22,9 +22,11 @@ namespace dsp {
|
|||||||
generic_block<MSUMRDemux>::registerOutput(&msumr4Out);
|
generic_block<MSUMRDemux>::registerOutput(&msumr4Out);
|
||||||
generic_block<MSUMRDemux>::registerOutput(&msumr5Out);
|
generic_block<MSUMRDemux>::registerOutput(&msumr5Out);
|
||||||
generic_block<MSUMRDemux>::registerOutput(&msumr6Out);
|
generic_block<MSUMRDemux>::registerOutput(&msumr6Out);
|
||||||
|
generic_block<MSUMRDemux>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<uint8_t>* in) {
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<MSUMRDemux>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<MSUMRDemux>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<MSUMRDemux>::ctrlMtx);
|
||||||
generic_block<MSUMRDemux>::tempStop();
|
generic_block<MSUMRDemux>::tempStop();
|
||||||
generic_block<MSUMRDemux>::unregisterInput(_in);
|
generic_block<MSUMRDemux>::unregisterInput(_in);
|
||||||
|
@ -31,9 +31,11 @@ namespace dsp {
|
|||||||
generic_block<HRPTDemux>::registerOutput(&AVHRRChan3Out);
|
generic_block<HRPTDemux>::registerOutput(&AVHRRChan3Out);
|
||||||
generic_block<HRPTDemux>::registerOutput(&AVHRRChan4Out);
|
generic_block<HRPTDemux>::registerOutput(&AVHRRChan4Out);
|
||||||
generic_block<HRPTDemux>::registerOutput(&AVHRRChan5Out);
|
generic_block<HRPTDemux>::registerOutput(&AVHRRChan5Out);
|
||||||
|
generic_block<HRPTDemux>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<uint8_t>* in) {
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<HRPTDemux>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HRPTDemux>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HRPTDemux>::ctrlMtx);
|
||||||
generic_block<HRPTDemux>::tempStop();
|
generic_block<HRPTDemux>::tempStop();
|
||||||
generic_block<HRPTDemux>::unregisterInput(_in);
|
generic_block<HRPTDemux>::unregisterInput(_in);
|
||||||
|
@ -17,9 +17,11 @@ namespace dsp {
|
|||||||
generic_block<TIPDemux>::registerOutput(&SEMOut);
|
generic_block<TIPDemux>::registerOutput(&SEMOut);
|
||||||
generic_block<TIPDemux>::registerOutput(&DCSOut);
|
generic_block<TIPDemux>::registerOutput(&DCSOut);
|
||||||
generic_block<TIPDemux>::registerOutput(&SBUVOut);
|
generic_block<TIPDemux>::registerOutput(&SBUVOut);
|
||||||
|
generic_block<TIPDemux>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<uint8_t>* in) {
|
void setInput(stream<uint8_t>* in) {
|
||||||
|
assert(generic_block<TIPDemux>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<TIPDemux>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<TIPDemux>::ctrlMtx);
|
||||||
generic_block<TIPDemux>::tempStop();
|
generic_block<TIPDemux>::tempStop();
|
||||||
generic_block<TIPDemux>::unregisterInput(_in);
|
generic_block<TIPDemux>::unregisterInput(_in);
|
||||||
|
@ -10,6 +10,7 @@ namespace dsp {
|
|||||||
class CostasLoop: public generic_block<CostasLoop<ORDER>> {
|
class CostasLoop: public generic_block<CostasLoop<ORDER>> {
|
||||||
public:
|
public:
|
||||||
CostasLoop() {}
|
CostasLoop() {}
|
||||||
|
|
||||||
CostasLoop(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
CostasLoop(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
||||||
|
|
||||||
void init(stream<complex_t>* in, float loopBandwidth) {
|
void init(stream<complex_t>* in, float loopBandwidth) {
|
||||||
@ -25,9 +26,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<CostasLoop<ORDER>>::registerInput(_in);
|
generic_block<CostasLoop<ORDER>>::registerInput(_in);
|
||||||
generic_block<CostasLoop<ORDER>>::registerOutput(&out);
|
generic_block<CostasLoop<ORDER>>::registerOutput(&out);
|
||||||
|
generic_block<CostasLoop<ORDER>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<CostasLoop<ORDER>>::_block_init);
|
||||||
generic_block<CostasLoop<ORDER>>::tempStop();
|
generic_block<CostasLoop<ORDER>>::tempStop();
|
||||||
generic_block<CostasLoop<ORDER>>::unregisterInput(_in);
|
generic_block<CostasLoop<ORDER>>::unregisterInput(_in);
|
||||||
_in = in;
|
_in = in;
|
||||||
@ -36,6 +39,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLoopBandwidth(float loopBandwidth) {
|
void setLoopBandwidth(float loopBandwidth) {
|
||||||
|
assert(generic_block<CostasLoop<ORDER>>::_block_init);
|
||||||
generic_block<CostasLoop<ORDER>>::tempStop();
|
generic_block<CostasLoop<ORDER>>::tempStop();
|
||||||
_loopBandwidth = loopBandwidth;
|
_loopBandwidth = loopBandwidth;
|
||||||
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
||||||
@ -121,6 +125,7 @@ namespace dsp {
|
|||||||
class CarrierTrackingPLL: public generic_block<CarrierTrackingPLL<T>> {
|
class CarrierTrackingPLL: public generic_block<CarrierTrackingPLL<T>> {
|
||||||
public:
|
public:
|
||||||
CarrierTrackingPLL() {}
|
CarrierTrackingPLL() {}
|
||||||
|
|
||||||
CarrierTrackingPLL(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
CarrierTrackingPLL(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
||||||
|
|
||||||
void init(stream<complex_t>* in, float loopBandwidth) {
|
void init(stream<complex_t>* in, float loopBandwidth) {
|
||||||
@ -136,9 +141,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<CarrierTrackingPLL<T>>::registerInput(_in);
|
generic_block<CarrierTrackingPLL<T>>::registerInput(_in);
|
||||||
generic_block<CarrierTrackingPLL<T>>::registerOutput(&out);
|
generic_block<CarrierTrackingPLL<T>>::registerOutput(&out);
|
||||||
|
generic_block<CarrierTrackingPLL<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<CarrierTrackingPLL<T>>::_block_init);
|
||||||
generic_block<CarrierTrackingPLL<T>>::tempStop();
|
generic_block<CarrierTrackingPLL<T>>::tempStop();
|
||||||
generic_block<CarrierTrackingPLL<T>>::unregisterInput(_in);
|
generic_block<CarrierTrackingPLL<T>>::unregisterInput(_in);
|
||||||
_in = in;
|
_in = in;
|
||||||
@ -147,6 +154,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLoopBandwidth(float loopBandwidth) {
|
void setLoopBandwidth(float loopBandwidth) {
|
||||||
|
assert(generic_block<CarrierTrackingPLL<T>>::_block_init);
|
||||||
generic_block<CarrierTrackingPLL<T>>::tempStop();
|
generic_block<CarrierTrackingPLL<T>>::tempStop();
|
||||||
_loopBandwidth = loopBandwidth;
|
_loopBandwidth = loopBandwidth;
|
||||||
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
||||||
@ -224,6 +232,7 @@ namespace dsp {
|
|||||||
class PLL: public generic_block<PLL> {
|
class PLL: public generic_block<PLL> {
|
||||||
public:
|
public:
|
||||||
PLL() {}
|
PLL() {}
|
||||||
|
|
||||||
PLL(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
PLL(stream<complex_t>* in, float loopBandwidth) { init(in, loopBandwidth); }
|
||||||
|
|
||||||
void init(stream<complex_t>* in, float loopBandwidth) {
|
void init(stream<complex_t>* in, float loopBandwidth) {
|
||||||
@ -239,9 +248,11 @@ namespace dsp {
|
|||||||
|
|
||||||
generic_block<PLL>::registerInput(_in);
|
generic_block<PLL>::registerInput(_in);
|
||||||
generic_block<PLL>::registerOutput(&out);
|
generic_block<PLL>::registerOutput(&out);
|
||||||
|
generic_block<PLL>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<PLL>::_block_init);
|
||||||
generic_block<PLL>::tempStop();
|
generic_block<PLL>::tempStop();
|
||||||
generic_block<PLL>::unregisterInput(_in);
|
generic_block<PLL>::unregisterInput(_in);
|
||||||
_in = in;
|
_in = in;
|
||||||
@ -250,6 +261,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLoopBandwidth(float loopBandwidth) {
|
void setLoopBandwidth(float loopBandwidth) {
|
||||||
|
assert(generic_block<PLL>::_block_init);
|
||||||
generic_block<PLL>::tempStop();
|
generic_block<PLL>::tempStop();
|
||||||
_loopBandwidth = loopBandwidth;
|
_loopBandwidth = loopBandwidth;
|
||||||
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
float dampningFactor = sqrtf(2.0f) / 2.0f;
|
||||||
|
@ -22,9 +22,11 @@ namespace dsp {
|
|||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
generic_block<FrequencyXlator<T>>::registerInput(_in);
|
generic_block<FrequencyXlator<T>>::registerInput(_in);
|
||||||
generic_block<FrequencyXlator<T>>::registerOutput(&out);
|
generic_block<FrequencyXlator<T>>::registerOutput(&out);
|
||||||
|
generic_block<FrequencyXlator<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInputSize(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<FrequencyXlator<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FrequencyXlator<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FrequencyXlator<T>>::ctrlMtx);
|
||||||
generic_block<FrequencyXlator<T>>::tempStop();
|
generic_block<FrequencyXlator<T>>::tempStop();
|
||||||
generic_block<FrequencyXlator<T>>::unregisterInput(_in);
|
generic_block<FrequencyXlator<T>>::unregisterInput(_in);
|
||||||
@ -34,22 +36,24 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
// No need to restart
|
assert(generic_block<FrequencyXlator<T>>::_block_init);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getSampleRate() {
|
float getSampleRate() {
|
||||||
|
assert(generic_block<FrequencyXlator<T>>::_block_init);
|
||||||
return _sampleRate;
|
return _sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFrequency(float freq) {
|
void setFrequency(float freq) {
|
||||||
// No need to restart
|
assert(generic_block<FrequencyXlator<T>>::_block_init);
|
||||||
_freq = freq;
|
_freq = freq;
|
||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getFrequency() {
|
float getFrequency() {
|
||||||
|
assert(generic_block<FrequencyXlator<T>>::_block_init);
|
||||||
return _freq;
|
return _freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,9 +98,11 @@ namespace dsp {
|
|||||||
_CorrectedFallRate = _fallRate / _sampleRate;
|
_CorrectedFallRate = _fallRate / _sampleRate;
|
||||||
generic_block<AGC>::registerInput(_in);
|
generic_block<AGC>::registerInput(_in);
|
||||||
generic_block<AGC>::registerOutput(&out);
|
generic_block<AGC>::registerOutput(&out);
|
||||||
|
generic_block<AGC>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in) {
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<AGC>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
||||||
generic_block<AGC>::tempStop();
|
generic_block<AGC>::tempStop();
|
||||||
generic_block<AGC>::unregisterInput(_in);
|
generic_block<AGC>::unregisterInput(_in);
|
||||||
@ -106,12 +112,14 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
|
assert(generic_block<AGC>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
_CorrectedFallRate = _fallRate / _sampleRate;
|
_CorrectedFallRate = _fallRate / _sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFallRate(float fallRate) {
|
void setFallRate(float fallRate) {
|
||||||
|
assert(generic_block<AGC>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<AGC>::ctrlMtx);
|
||||||
_fallRate = fallRate;
|
_fallRate = fallRate;
|
||||||
_CorrectedFallRate = _fallRate / _sampleRate;
|
_CorrectedFallRate = _fallRate / _sampleRate;
|
||||||
@ -160,9 +168,11 @@ namespace dsp {
|
|||||||
_rate = rate;
|
_rate = rate;
|
||||||
generic_block<ComplexAGC>::registerInput(_in);
|
generic_block<ComplexAGC>::registerInput(_in);
|
||||||
generic_block<ComplexAGC>::registerOutput(&out);
|
generic_block<ComplexAGC>::registerOutput(&out);
|
||||||
|
generic_block<ComplexAGC>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<ComplexAGC>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<ComplexAGC>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<ComplexAGC>::ctrlMtx);
|
||||||
generic_block<ComplexAGC>::tempStop();
|
generic_block<ComplexAGC>::tempStop();
|
||||||
generic_block<ComplexAGC>::unregisterInput(_in);
|
generic_block<ComplexAGC>::unregisterInput(_in);
|
||||||
@ -172,14 +182,17 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSetPoint(float setPoint) {
|
void setSetPoint(float setPoint) {
|
||||||
|
assert(generic_block<ComplexAGC>::_block_init);
|
||||||
_setPoint = setPoint;
|
_setPoint = setPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMaxGain(float maxGain) {
|
void setMaxGain(float maxGain) {
|
||||||
|
assert(generic_block<ComplexAGC>::_block_init);
|
||||||
_maxGain = maxGain;
|
_maxGain = maxGain;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setRate(float rate) {
|
void setRate(float rate) {
|
||||||
|
assert(generic_block<ComplexAGC>::_block_init);
|
||||||
_rate = rate;
|
_rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,9 +235,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
generic_block<DelayImag>::registerInput(_in);
|
generic_block<DelayImag>::registerInput(_in);
|
||||||
generic_block<DelayImag>::registerOutput(&out);
|
generic_block<DelayImag>::registerOutput(&out);
|
||||||
|
generic_block<DelayImag>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<DelayImag>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<DelayImag>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<DelayImag>::ctrlMtx);
|
||||||
generic_block<DelayImag>::tempStop();
|
generic_block<DelayImag>::tempStop();
|
||||||
generic_block<DelayImag>::unregisterInput(_in);
|
generic_block<DelayImag>::unregisterInput(_in);
|
||||||
@ -272,9 +287,11 @@ namespace dsp {
|
|||||||
_volume = volume;
|
_volume = volume;
|
||||||
generic_block<Volume<T>>::registerInput(_in);
|
generic_block<Volume<T>>::registerInput(_in);
|
||||||
generic_block<Volume<T>>::registerOutput(&out);
|
generic_block<Volume<T>>::registerOutput(&out);
|
||||||
|
generic_block<Volume<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInputSize(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<Volume<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Volume<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Volume<T>>::ctrlMtx);
|
||||||
generic_block<Volume<T>>::tempStop();
|
generic_block<Volume<T>>::tempStop();
|
||||||
generic_block<Volume<T>>::unregisterInput(_in);
|
generic_block<Volume<T>>::unregisterInput(_in);
|
||||||
@ -284,19 +301,23 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setVolume(float volume) {
|
void setVolume(float volume) {
|
||||||
|
assert(generic_block<Volume<T>>::_block_init);
|
||||||
_volume = volume;
|
_volume = volume;
|
||||||
level = powf(_volume, 2);
|
level = powf(_volume, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
float getVolume() {
|
float getVolume() {
|
||||||
|
assert(generic_block<Volume<T>>::_block_init);
|
||||||
return _volume;
|
return _volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMuted(bool muted) {
|
void setMuted(bool muted) {
|
||||||
|
assert(generic_block<Volume<T>>::_block_init);
|
||||||
_muted = muted;
|
_muted = muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getMuted() {
|
bool getMuted() {
|
||||||
|
assert(generic_block<Volume<T>>::_block_init);
|
||||||
return _muted;
|
return _muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,8 +364,10 @@ namespace dsp {
|
|||||||
Squelch(stream<complex_t>* in, float level) { init(in, level); }
|
Squelch(stream<complex_t>* in, float level) { init(in, level); }
|
||||||
|
|
||||||
~Squelch() {
|
~Squelch() {
|
||||||
|
if (!generic_block<Squelch>::_block_init) { return; }
|
||||||
generic_block<Squelch>::stop();
|
generic_block<Squelch>::stop();
|
||||||
delete[] normBuffer;
|
delete[] normBuffer;
|
||||||
|
generic_block<Squelch>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<complex_t>* in, float level) {
|
void init(stream<complex_t>* in, float level) {
|
||||||
@ -353,9 +376,11 @@ namespace dsp {
|
|||||||
normBuffer = new float[STREAM_BUFFER_SIZE];
|
normBuffer = new float[STREAM_BUFFER_SIZE];
|
||||||
generic_block<Squelch>::registerInput(_in);
|
generic_block<Squelch>::registerInput(_in);
|
||||||
generic_block<Squelch>::registerOutput(&out);
|
generic_block<Squelch>::registerOutput(&out);
|
||||||
|
generic_block<Squelch>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
void setInput(stream<complex_t>* in) {
|
||||||
|
assert(generic_block<Squelch>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Squelch>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Squelch>::ctrlMtx);
|
||||||
generic_block<Squelch>::tempStop();
|
generic_block<Squelch>::tempStop();
|
||||||
generic_block<Squelch>::unregisterInput(_in);
|
generic_block<Squelch>::unregisterInput(_in);
|
||||||
@ -365,10 +390,12 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLevel(float level) {
|
void setLevel(float level) {
|
||||||
|
assert(generic_block<Squelch>::_block_init);
|
||||||
_level = level;
|
_level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
float getLevel() {
|
float getLevel() {
|
||||||
|
assert(generic_block<Squelch>::_block_init);
|
||||||
return _level;
|
return _level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,9 +442,11 @@ namespace dsp {
|
|||||||
samples = count;
|
samples = count;
|
||||||
generic_block<Packer<T>>::registerInput(_in);
|
generic_block<Packer<T>>::registerInput(_in);
|
||||||
generic_block<Packer<T>>::registerOutput(&out);
|
generic_block<Packer<T>>::registerOutput(&out);
|
||||||
|
generic_block<Packer<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<Packer<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Packer<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Packer<T>>::ctrlMtx);
|
||||||
generic_block<Packer<T>>::tempStop();
|
generic_block<Packer<T>>::tempStop();
|
||||||
generic_block<Packer<T>>::unregisterInput(_in);
|
generic_block<Packer<T>>::unregisterInput(_in);
|
||||||
@ -427,6 +456,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSampleCount(int count) {
|
void setSampleCount(int count) {
|
||||||
|
assert(generic_block<Packer<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Packer<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Packer<T>>::ctrlMtx);
|
||||||
generic_block<Packer<T>>::tempStop();
|
generic_block<Packer<T>>::tempStop();
|
||||||
samples = count;
|
samples = count;
|
||||||
@ -473,8 +503,10 @@ namespace dsp {
|
|||||||
Threshold(stream<float>* in) { init(in); }
|
Threshold(stream<float>* in) { init(in); }
|
||||||
|
|
||||||
~Threshold() {
|
~Threshold() {
|
||||||
|
if (!generic_block<Threshold>::_block_init) { return; }
|
||||||
generic_block<Threshold>::stop();
|
generic_block<Threshold>::stop();
|
||||||
delete[] normBuffer;
|
delete[] normBuffer;
|
||||||
|
generic_block<Threshold>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<float>* in) {
|
void init(stream<float>* in) {
|
||||||
@ -482,9 +514,11 @@ namespace dsp {
|
|||||||
normBuffer = new float[STREAM_BUFFER_SIZE];
|
normBuffer = new float[STREAM_BUFFER_SIZE];
|
||||||
generic_block<Threshold>::registerInput(_in);
|
generic_block<Threshold>::registerInput(_in);
|
||||||
generic_block<Threshold>::registerOutput(&out);
|
generic_block<Threshold>::registerOutput(&out);
|
||||||
|
generic_block<Threshold>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<float>* in) {
|
void setInput(stream<float>* in) {
|
||||||
|
assert(generic_block<Threshold>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Threshold>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Threshold>::ctrlMtx);
|
||||||
generic_block<Threshold>::tempStop();
|
generic_block<Threshold>::tempStop();
|
||||||
generic_block<Threshold>::unregisterInput(_in);
|
generic_block<Threshold>::unregisterInput(_in);
|
||||||
@ -494,10 +528,12 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setLevel(float level) {
|
void setLevel(float level) {
|
||||||
|
assert(generic_block<Threshold>::_block_init);
|
||||||
_level = level;
|
_level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
float getLevel() {
|
float getLevel() {
|
||||||
|
assert(generic_block<Threshold>::_block_init);
|
||||||
return _level;
|
return _level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,10 +14,12 @@ namespace dsp {
|
|||||||
PolyphaseResampler(stream<T>* in, dsp::filter_window::generic_window* window, float inSampleRate, float outSampleRate) { init(in, window, inSampleRate, outSampleRate); }
|
PolyphaseResampler(stream<T>* in, dsp::filter_window::generic_window* window, float inSampleRate, float outSampleRate) { init(in, window, inSampleRate, outSampleRate); }
|
||||||
|
|
||||||
~PolyphaseResampler() {
|
~PolyphaseResampler() {
|
||||||
|
if (!generic_block<PolyphaseResampler<T>>::_block_init) { return; }
|
||||||
generic_block<PolyphaseResampler<T>>::stop();
|
generic_block<PolyphaseResampler<T>>::stop();
|
||||||
volk_free(buffer);
|
volk_free(buffer);
|
||||||
volk_free(taps);
|
volk_free(taps);
|
||||||
freeTapPhases();
|
freeTapPhases();
|
||||||
|
generic_block<PolyphaseResampler<T>>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<T>* in, dsp::filter_window::generic_window* window, float inSampleRate, float outSampleRate) {
|
void init(stream<T>* in, dsp::filter_window::generic_window* window, float inSampleRate, float outSampleRate) {
|
||||||
@ -40,9 +42,11 @@ namespace dsp {
|
|||||||
memset(buffer, 0, STREAM_BUFFER_SIZE * sizeof(T) * 2);
|
memset(buffer, 0, STREAM_BUFFER_SIZE * sizeof(T) * 2);
|
||||||
generic_block<PolyphaseResampler<T>>::registerInput(_in);
|
generic_block<PolyphaseResampler<T>>::registerInput(_in);
|
||||||
generic_block<PolyphaseResampler<T>>::registerOutput(&out);
|
generic_block<PolyphaseResampler<T>>::registerOutput(&out);
|
||||||
|
generic_block<PolyphaseResampler<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
||||||
generic_block<PolyphaseResampler<T>>::tempStop();
|
generic_block<PolyphaseResampler<T>>::tempStop();
|
||||||
generic_block<PolyphaseResampler<T>>::unregisterInput(_in);
|
generic_block<PolyphaseResampler<T>>::unregisterInput(_in);
|
||||||
@ -52,6 +56,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setInSampleRate(float inSampleRate) {
|
void setInSampleRate(float inSampleRate) {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
||||||
generic_block<PolyphaseResampler<T>>::tempStop();
|
generic_block<PolyphaseResampler<T>>::tempStop();
|
||||||
_inSampleRate = inSampleRate;
|
_inSampleRate = inSampleRate;
|
||||||
@ -63,6 +68,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setOutSampleRate(float outSampleRate) {
|
void setOutSampleRate(float outSampleRate) {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
||||||
generic_block<PolyphaseResampler<T>>::tempStop();
|
generic_block<PolyphaseResampler<T>>::tempStop();
|
||||||
_outSampleRate = outSampleRate;
|
_outSampleRate = outSampleRate;
|
||||||
@ -74,14 +80,17 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getInterpolation() {
|
int getInterpolation() {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
return _interp;
|
return _interp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getDecimation() {
|
int getDecimation() {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
return _decim;
|
return _decim;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateWindow(dsp::filter_window::generic_window* window) {
|
void updateWindow(dsp::filter_window::generic_window* window) {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
||||||
generic_block<PolyphaseResampler<T>>::tempStop();
|
generic_block<PolyphaseResampler<T>>::tempStop();
|
||||||
_window = window;
|
_window = window;
|
||||||
@ -94,6 +103,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int calcOutSize(int in) {
|
int calcOutSize(int in) {
|
||||||
|
assert(generic_block<PolyphaseResampler<T>>::_block_init);
|
||||||
return (in * _interp) / _decim;
|
return (in * _interp) / _decim;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,87 +197,4 @@ namespace dsp {
|
|||||||
std::vector<float*> tapPhases;
|
std::vector<float*> tapPhases;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PowerDecimator : public generic_block<PowerDecimator> {
|
|
||||||
public:
|
|
||||||
PowerDecimator() {}
|
|
||||||
|
|
||||||
PowerDecimator(stream<complex_t>* in, int power, int tapCount) { init(in, power, tapCount); }
|
|
||||||
|
|
||||||
void init(stream<complex_t>* in, int power, int tapCount) {
|
|
||||||
_in = in;
|
|
||||||
_power = power;
|
|
||||||
_tapCount = tapCount;
|
|
||||||
|
|
||||||
// Allocate buffers
|
|
||||||
for (int i = 0; i < _power; i++) {
|
|
||||||
buffers[i] = new complex_t[STREAM_BUFFER_SIZE / (i+1)];
|
|
||||||
bufferStart[i] = &buffers[i][_tapCount - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create taps
|
|
||||||
genHalfbandTaps();
|
|
||||||
|
|
||||||
generic_block<PowerDecimator>::registerInput(_in);
|
|
||||||
generic_block<PowerDecimator>::registerOutput(&out);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setInput(stream<complex_t>* in) {
|
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PowerDecimator>::ctrlMtx);
|
|
||||||
generic_block<PowerDecimator>::tempStop();
|
|
||||||
generic_block<PowerDecimator>::unregisterInput(_in);
|
|
||||||
_in = in;
|
|
||||||
generic_block<PowerDecimator>::registerInput(_in);
|
|
||||||
generic_block<PowerDecimator>::tempStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setPower(unsigned int power) {
|
|
||||||
std::lock_guard<std::mutex> lck(generic_block<PowerDecimator>::ctrlMtx);
|
|
||||||
generic_block<PowerDecimator>::tempStop();
|
|
||||||
_power = power;
|
|
||||||
generic_block<PowerDecimator>::tempStart();
|
|
||||||
}
|
|
||||||
|
|
||||||
int run() {
|
|
||||||
int count = _in->read();
|
|
||||||
if (count < 0) { return -1; }
|
|
||||||
|
|
||||||
if (!out.swap(count)) { return -1; }
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
stream<complex_t> out;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void genHalfbandTaps() {
|
|
||||||
if (taps != NULL) { delete[] taps; }
|
|
||||||
taps = new float[_tapCount];
|
|
||||||
|
|
||||||
// Using Blackman-harris windows
|
|
||||||
int half = _tapCount / 2;
|
|
||||||
for (int i = 0; i < _tapCount; i++) {
|
|
||||||
taps[i] = sinc((FL_M_PI / 2.0f) * (i-half)) * blackmanHarrisWin(i, _tapCount - 1);
|
|
||||||
printf("%f\n", taps[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline float sinc(float x) {
|
|
||||||
return ((x == 0) ? 1.0f : (sinf(x)/x)) / FL_M_PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline float blackmanHarrisWin(float n, float N) {
|
|
||||||
return 0.35875f - (0.48829f*cosf(2.0f*FL_M_PI*(n/N))) + (0.14128f*cosf(4.0f*FL_M_PI*(n/N))) - (0.01168f*cosf(6.0f*FL_M_PI*(n/N)));
|
|
||||||
}
|
|
||||||
|
|
||||||
int _power = 0;
|
|
||||||
int _tapCount = 31;
|
|
||||||
stream<complex_t>* _in;
|
|
||||||
|
|
||||||
// Buffer lists, sets max decimation to 2^32
|
|
||||||
complex_t* buffers[32];
|
|
||||||
complex_t* bufferStart[32];
|
|
||||||
|
|
||||||
float* taps = NULL;
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
}
|
@ -16,9 +16,11 @@ namespace dsp {
|
|||||||
void init(stream<T>* in) {
|
void init(stream<T>* in) {
|
||||||
_in = in;
|
_in = in;
|
||||||
generic_block<Splitter>::registerInput(_in);
|
generic_block<Splitter>::registerInput(_in);
|
||||||
|
generic_block<Splitter>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<Splitter>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
||||||
generic_block<Splitter>::tempStop();
|
generic_block<Splitter>::tempStop();
|
||||||
generic_block<Splitter>::unregisterInput(_in);
|
generic_block<Splitter>::unregisterInput(_in);
|
||||||
@ -28,6 +30,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void bindStream(stream<T>* stream) {
|
void bindStream(stream<T>* stream) {
|
||||||
|
assert(generic_block<Splitter>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
||||||
generic_block<Splitter>::tempStop();
|
generic_block<Splitter>::tempStop();
|
||||||
out.push_back(stream);
|
out.push_back(stream);
|
||||||
@ -36,6 +39,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void unbindStream(stream<T>* stream) {
|
void unbindStream(stream<T>* stream) {
|
||||||
|
assert(generic_block<Splitter>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Splitter>::ctrlMtx);
|
||||||
generic_block<Splitter>::tempStop();
|
generic_block<Splitter>::tempStop();
|
||||||
generic_block<Splitter>::unregisterOutput(stream);
|
generic_block<Splitter>::unregisterOutput(stream);
|
||||||
@ -71,6 +75,7 @@ namespace dsp {
|
|||||||
Reshaper(stream<T>* in, int keep, int skip) { init(in, keep, skip); }
|
Reshaper(stream<T>* in, int keep, int skip) { init(in, keep, skip); }
|
||||||
|
|
||||||
// NOTE: For some reason, the base class destrcutor doesn't get called.... this is a temporary fix I guess
|
// NOTE: For some reason, the base class destrcutor doesn't get called.... this is a temporary fix I guess
|
||||||
|
// I also don't check for _block_init for the exact sample reason, something's weird
|
||||||
~Reshaper() {
|
~Reshaper() {
|
||||||
generic_block<Reshaper<T>>::stop();
|
generic_block<Reshaper<T>>::stop();
|
||||||
}
|
}
|
||||||
@ -82,9 +87,11 @@ namespace dsp {
|
|||||||
ringBuf.init(keep * 2);
|
ringBuf.init(keep * 2);
|
||||||
generic_block<Reshaper<T>>::registerInput(_in);
|
generic_block<Reshaper<T>>::registerInput(_in);
|
||||||
generic_block<Reshaper<T>>::registerOutput(&out);
|
generic_block<Reshaper<T>>::registerOutput(&out);
|
||||||
|
generic_block<Reshaper<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<Reshaper<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
||||||
generic_block<Reshaper<T>>::tempStop();
|
generic_block<Reshaper<T>>::tempStop();
|
||||||
generic_block<Reshaper<T>>::unregisterInput(_in);
|
generic_block<Reshaper<T>>::unregisterInput(_in);
|
||||||
@ -94,6 +101,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setKeep(int keep) {
|
void setKeep(int keep) {
|
||||||
|
assert(generic_block<Reshaper<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
||||||
generic_block<Reshaper<T>>::tempStop();
|
generic_block<Reshaper<T>>::tempStop();
|
||||||
_keep = keep;
|
_keep = keep;
|
||||||
@ -102,6 +110,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setSkip(int skip) {
|
void setSkip(int skip) {
|
||||||
|
assert(generic_block<Reshaper<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
||||||
generic_block<Reshaper<T>>::tempStop();
|
generic_block<Reshaper<T>>::tempStop();
|
||||||
_skip = skip;
|
_skip = skip;
|
||||||
@ -183,6 +192,5 @@ namespace dsp {
|
|||||||
std::thread workThread;
|
std::thread workThread;
|
||||||
int _keep, _skip;
|
int _keep, _skip;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -16,9 +16,11 @@ namespace dsp {
|
|||||||
_handler = handler;
|
_handler = handler;
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
generic_block<HandlerSink<T>>::registerInput(_in);
|
generic_block<HandlerSink<T>>::registerInput(_in);
|
||||||
|
generic_block<HandlerSink<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<HandlerSink<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HandlerSink<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HandlerSink<T>>::ctrlMtx);
|
||||||
generic_block<HandlerSink<T>>::tempStop();
|
generic_block<HandlerSink<T>>::tempStop();
|
||||||
generic_block<HandlerSink<T>>::unregisterInput(_in);
|
generic_block<HandlerSink<T>>::unregisterInput(_in);
|
||||||
@ -28,6 +30,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setHandler(void (*handler)(T* data, int count, void* ctx), void* ctx) {
|
void setHandler(void (*handler)(T* data, int count, void* ctx), void* ctx) {
|
||||||
|
assert(generic_block<HandlerSink<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HandlerSink<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HandlerSink<T>>::ctrlMtx);
|
||||||
generic_block<HandlerSink<T>>::tempStop();
|
generic_block<HandlerSink<T>>::tempStop();
|
||||||
_handler = handler;
|
_handler = handler;
|
||||||
@ -61,9 +64,11 @@ namespace dsp {
|
|||||||
_in = in;
|
_in = in;
|
||||||
data.init(480); // TODO: Use an argument
|
data.init(480); // TODO: Use an argument
|
||||||
generic_block<RingBufferSink<T>>::registerInput(_in);
|
generic_block<RingBufferSink<T>>::registerInput(_in);
|
||||||
|
generic_block<RingBufferSink<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<RingBufferSink<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<RingBufferSink<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<RingBufferSink<T>>::ctrlMtx);
|
||||||
generic_block<RingBufferSink<T>>::tempStop();
|
generic_block<RingBufferSink<T>>::tempStop();
|
||||||
generic_block<RingBufferSink<T>>::unregisterInput(_in);
|
generic_block<RingBufferSink<T>>::unregisterInput(_in);
|
||||||
@ -107,9 +112,11 @@ namespace dsp {
|
|||||||
void init(stream<T>* in) {
|
void init(stream<T>* in) {
|
||||||
_in = in;
|
_in = in;
|
||||||
generic_block<NullSink<T>>::registerInput(_in);
|
generic_block<NullSink<T>>::registerInput(_in);
|
||||||
|
generic_block<NullSink<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<NullSink<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<NullSink<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<NullSink<T>>::ctrlMtx);
|
||||||
generic_block<NullSink<T>>::tempStop();
|
generic_block<NullSink<T>>::tempStop();
|
||||||
generic_block<NullSink<T>>::unregisterInput(_in);
|
generic_block<NullSink<T>>::unregisterInput(_in);
|
||||||
@ -138,17 +145,21 @@ namespace dsp {
|
|||||||
FileSink(stream<T>* in, std::string path) { init(in, path); }
|
FileSink(stream<T>* in, std::string path) { init(in, path); }
|
||||||
|
|
||||||
~FileSink() {
|
~FileSink() {
|
||||||
|
if (!generic_block<FileSink<T>>::_block_init) { return; }
|
||||||
generic_block<FileSink<T>>::stop();
|
generic_block<FileSink<T>>::stop();
|
||||||
if (file.is_open()) { file.close(); }
|
if (file.is_open()) { file.close(); }
|
||||||
|
generic_block<FileSink<T>>::_block_init = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(stream<T>* in, std::string path) {
|
void init(stream<T>* in, std::string path) {
|
||||||
_in = in;
|
_in = in;
|
||||||
file = std::ofstream(path, std::ios::binary);
|
file = std::ofstream(path, std::ios::binary);
|
||||||
generic_block<FileSink<T>>::registerInput(_in);
|
generic_block<FileSink<T>>::registerInput(_in);
|
||||||
|
generic_block<FileSink<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInput(stream<T>* in) {
|
void setInput(stream<T>* in) {
|
||||||
|
assert(generic_block<FileSink<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<FileSink<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<FileSink<T>>::ctrlMtx);
|
||||||
generic_block<FileSink<T>>::tempStop();
|
generic_block<FileSink<T>>::tempStop();
|
||||||
generic_block<FileSink<T>>::unregisterInput(_in);
|
generic_block<FileSink<T>>::unregisterInput(_in);
|
||||||
@ -158,6 +169,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isOpen() {
|
bool isOpen() {
|
||||||
|
assert(generic_block<FileSink<T>>::_block_init);
|
||||||
return file.is_open();
|
return file.is_open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,9 +20,11 @@ namespace dsp {
|
|||||||
phase = lv_cmake(1.0f, 0.0f);
|
phase = lv_cmake(1.0f, 0.0f);
|
||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
generic_block<SineSource>::registerOutput(&out);
|
generic_block<SineSource>::registerOutput(&out);
|
||||||
|
generic_block<SineSource>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBlockSize(int blockSize) {
|
void setBlockSize(int blockSize) {
|
||||||
|
assert(generic_block<SineSource>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<SineSource>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<SineSource>::ctrlMtx);
|
||||||
generic_block<SineSource>::tempStop();
|
generic_block<SineSource>::tempStop();
|
||||||
_blockSize = blockSize;
|
_blockSize = blockSize;
|
||||||
@ -30,26 +32,29 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int getBlockSize() {
|
int getBlockSize() {
|
||||||
|
assert(generic_block<SineSource>::_block_init);
|
||||||
return _blockSize;
|
return _blockSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSampleRate(float sampleRate) {
|
void setSampleRate(float sampleRate) {
|
||||||
// No need to restart
|
assert(generic_block<SineSource>::_block_init);
|
||||||
_sampleRate = sampleRate;
|
_sampleRate = sampleRate;
|
||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getSampleRate() {
|
float getSampleRate() {
|
||||||
|
assert(generic_block<SineSource>::_block_init);
|
||||||
return _sampleRate;
|
return _sampleRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFrequency(float freq) {
|
void setFrequency(float freq) {
|
||||||
// No need to restart
|
assert(generic_block<SineSource>::_block_init);
|
||||||
_freq = freq;
|
_freq = freq;
|
||||||
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
phaseDelta = lv_cmake(std::cos((_freq / _sampleRate) * 2.0f * FL_M_PI), std::sin((_freq / _sampleRate) * 2.0f * FL_M_PI));
|
||||||
}
|
}
|
||||||
|
|
||||||
float getFrequency() {
|
float getFrequency() {
|
||||||
|
assert(generic_block<SineSource>::_block_init);
|
||||||
return _freq;
|
return _freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,9 +87,11 @@ namespace dsp {
|
|||||||
_handler = handler;
|
_handler = handler;
|
||||||
_ctx = ctx;
|
_ctx = ctx;
|
||||||
generic_block<HandlerSource<T>>::registerOutput(&out);
|
generic_block<HandlerSource<T>>::registerOutput(&out);
|
||||||
|
generic_block<HandlerSource<T>>::_block_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHandler(int (*handler)(T* data, void* ctx), void* ctx) {
|
void setHandler(int (*handler)(T* data, void* ctx), void* ctx) {
|
||||||
|
assert(generic_block<HandlerSource<T>>::_block_init);
|
||||||
std::lock_guard<std::mutex> lck(generic_block<HandlerSource<T>>::ctrlMtx);
|
std::lock_guard<std::mutex> lck(generic_block<HandlerSource<T>>::ctrlMtx);
|
||||||
generic_block<HandlerSource<T>>::tempStop();
|
generic_block<HandlerSource<T>>::tempStop();
|
||||||
_handler = handler;
|
_handler = handler;
|
||||||
|
@ -10,7 +10,11 @@ namespace dsp {
|
|||||||
public:
|
public:
|
||||||
VFO() {}
|
VFO() {}
|
||||||
|
|
||||||
~VFO() { stop(); }
|
~VFO() {
|
||||||
|
if (!_init) { return; }
|
||||||
|
stop();
|
||||||
|
_init = false;
|
||||||
|
}
|
||||||
|
|
||||||
VFO(stream<complex_t>* in, float offset, float inSampleRate, float outSampleRate, float bandWidth) {
|
VFO(stream<complex_t>* in, float offset, float inSampleRate, float outSampleRate, float bandWidth) {
|
||||||
init(in, offset, inSampleRate, outSampleRate, bandWidth);
|
init(in, offset, inSampleRate, outSampleRate, bandWidth);
|
||||||
@ -33,21 +37,26 @@ namespace dsp {
|
|||||||
resamp.updateWindow(&win);
|
resamp.updateWindow(&win);
|
||||||
|
|
||||||
out = &resamp.out;
|
out = &resamp.out;
|
||||||
|
|
||||||
|
_init = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void start() {
|
void start() {
|
||||||
|
assert(_init);
|
||||||
if (running) { return; }
|
if (running) { return; }
|
||||||
xlator.start();
|
xlator.start();
|
||||||
resamp.start();
|
resamp.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stop() {
|
void stop() {
|
||||||
|
assert(_init);
|
||||||
if (!running) { return; }
|
if (!running) { return; }
|
||||||
xlator.stop();
|
xlator.stop();
|
||||||
resamp.stop();
|
resamp.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setInSampleRate(float inSampleRate) {
|
void setInSampleRate(float inSampleRate) {
|
||||||
|
assert(_init);
|
||||||
_inSampleRate = inSampleRate;
|
_inSampleRate = inSampleRate;
|
||||||
if (running) { xlator.stop(); resamp.stop(); }
|
if (running) { xlator.stop(); resamp.stop(); }
|
||||||
xlator.setSampleRate(_inSampleRate);
|
xlator.setSampleRate(_inSampleRate);
|
||||||
@ -61,6 +70,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setOutSampleRate(float outSampleRate) {
|
void setOutSampleRate(float outSampleRate) {
|
||||||
|
assert(_init);
|
||||||
_outSampleRate = outSampleRate;
|
_outSampleRate = outSampleRate;
|
||||||
if (running) { resamp.stop(); }
|
if (running) { resamp.stop(); }
|
||||||
resamp.setOutSampleRate(_outSampleRate);
|
resamp.setOutSampleRate(_outSampleRate);
|
||||||
@ -73,6 +83,7 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setOutSampleRate(float outSampleRate, float bandWidth) {
|
void setOutSampleRate(float outSampleRate, float bandWidth) {
|
||||||
|
assert(_init);
|
||||||
_outSampleRate = outSampleRate;
|
_outSampleRate = outSampleRate;
|
||||||
_bandWidth = bandWidth;
|
_bandWidth = bandWidth;
|
||||||
if (running) { resamp.stop(); }
|
if (running) { resamp.stop(); }
|
||||||
@ -86,11 +97,13 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setOffset(float offset) {
|
void setOffset(float offset) {
|
||||||
|
assert(_init);
|
||||||
_offset = offset;
|
_offset = offset;
|
||||||
xlator.setFrequency(-_offset);
|
xlator.setFrequency(-_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setBandwidth(float bandWidth) {
|
void setBandwidth(float bandWidth) {
|
||||||
|
assert(_init);
|
||||||
_bandWidth = bandWidth;
|
_bandWidth = bandWidth;
|
||||||
float realCutoff = std::min<float>(_bandWidth, std::min<float>(_inSampleRate, _outSampleRate)) / 2.0f;
|
float realCutoff = std::min<float>(_bandWidth, std::min<float>(_inSampleRate, _outSampleRate)) / 2.0f;
|
||||||
win.setCutoff(realCutoff);
|
win.setCutoff(realCutoff);
|
||||||
@ -101,6 +114,7 @@ namespace dsp {
|
|||||||
stream<complex_t>* out;
|
stream<complex_t>* out;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool _init = false;
|
||||||
bool running = false;
|
bool running = false;
|
||||||
float _offset, _inSampleRate, _outSampleRate, _bandWidth;
|
float _offset, _inSampleRate, _outSampleRate, _bandWidth;
|
||||||
filter_window::BlackmanWindow win;
|
filter_window::BlackmanWindow win;
|
||||||
|
@ -159,7 +159,7 @@ private:
|
|||||||
audioInput = sigpath::sinkManager.bindStream(name);
|
audioInput = sigpath::sinkManager.bindStream(name);
|
||||||
if (audioInput == NULL) { return; }
|
if (audioInput == NULL) { return; }
|
||||||
selectedStreamName = name;
|
selectedStreamName = name;
|
||||||
vol.setInputSize(audioInput);
|
vol.setInput(audioInput);
|
||||||
vol.start();
|
vol.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user