mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-06-27 04:47:51 +02:00
new dsp
This commit is contained in:
@ -12,7 +12,7 @@ namespace audio {
|
||||
astr->deviceId = astr->audio->getDeviceId();
|
||||
double sampleRate = astr->audio->devices[astr->deviceId].sampleRates[0];
|
||||
int blockSize = sampleRate / 200.0; // default block size
|
||||
astr->monoAudioStream = new dsp::stream<float>(blockSize * 2);
|
||||
astr->monoAudioStream = new dsp::stream<float>;
|
||||
astr->audio->setBlockSize(blockSize);
|
||||
astr->audio->setStreamType(io::AudioSink::MONO);
|
||||
astr->audio->setMonoInput(astr->monoAudioStream);
|
||||
@ -21,8 +21,8 @@ namespace audio {
|
||||
astr->sampleRate = sampleRate;
|
||||
astr->monoStream = stream;
|
||||
astr->sampleRateChangeHandler = sampleRateChangeHandler;
|
||||
astr->monoDynSplit = new dsp::DynamicSplitter<float>(stream, blockSize);
|
||||
astr->monoDynSplit->bind(astr->monoAudioStream);
|
||||
astr->monoDynSplit = new dsp::Splitter<float>(stream);
|
||||
astr->monoDynSplit->bindStream(astr->monoAudioStream);
|
||||
astr->running = false;
|
||||
astr->volume = 1.0f;
|
||||
astr->sampleRateId = 0;
|
||||
@ -31,7 +31,7 @@ namespace audio {
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
double registerStereoStream(dsp::stream<dsp::StereoFloat_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx) {
|
||||
double registerStereoStream(dsp::stream<dsp::stereo_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx) {
|
||||
AudioStream_t* astr = new AudioStream_t;
|
||||
astr->type = STREAM_TYPE_STEREO;
|
||||
astr->ctx = ctx;
|
||||
@ -39,7 +39,7 @@ namespace audio {
|
||||
astr->audio->init(1);
|
||||
double sampleRate = astr->audio->devices[astr->audio->getDeviceId()].sampleRates[0];
|
||||
int blockSize = sampleRate / 200.0; // default block size
|
||||
astr->stereoAudioStream = new dsp::stream<dsp::StereoFloat_t>(blockSize * 2);
|
||||
astr->stereoAudioStream = new dsp::stream<dsp::stereo_t>;
|
||||
astr->audio->setBlockSize(blockSize);
|
||||
astr->audio->setStreamType(io::AudioSink::STEREO);
|
||||
astr->audio->setStereoInput(astr->stereoAudioStream);
|
||||
@ -48,8 +48,8 @@ namespace audio {
|
||||
astr->sampleRate = sampleRate;
|
||||
astr->stereoStream = stream;
|
||||
astr->sampleRateChangeHandler = sampleRateChangeHandler;
|
||||
astr->stereoDynSplit = new dsp::DynamicSplitter<dsp::StereoFloat_t>(stream, blockSize);
|
||||
astr->stereoDynSplit->bind(astr->stereoAudioStream);
|
||||
astr->stereoDynSplit = new dsp::Splitter<dsp::stereo_t>(stream);
|
||||
astr->stereoDynSplit->bindStream(astr->stereoAudioStream);
|
||||
astr->running = false;
|
||||
streams[name] = astr;
|
||||
astr->vfoName = vfoName;
|
||||
@ -103,20 +103,20 @@ namespace audio {
|
||||
bstr.streamRemovedHandler = streamRemovedHandler;
|
||||
bstr.sampleRateChangeHandler = sampleRateChangeHandler;
|
||||
if (astr->type == STREAM_TYPE_MONO) {
|
||||
bstr.monoStream = new dsp::stream<float>(astr->blockSize * 2);
|
||||
bstr.monoStream = new dsp::stream<float>;
|
||||
astr->monoDynSplit->stop();
|
||||
astr->monoDynSplit->bind(bstr.monoStream);
|
||||
astr->monoDynSplit->bindStream(bstr.monoStream);
|
||||
if (astr->running) {
|
||||
astr->monoDynSplit->start();
|
||||
}
|
||||
astr->boundStreams.push_back(bstr);
|
||||
return bstr.monoStream;
|
||||
}
|
||||
bstr.stereoStream = new dsp::stream<dsp::StereoFloat_t>(astr->blockSize * 2);
|
||||
bstr.s2m = new dsp::StereoToMono(bstr.stereoStream, astr->blockSize * 2);
|
||||
bstr.monoStream = &bstr.s2m->output;
|
||||
bstr.stereoStream = new dsp::stream<dsp::stereo_t>;
|
||||
bstr.s2m = new dsp::StereoToMono(bstr.stereoStream);
|
||||
bstr.monoStream = &bstr.s2m->out;
|
||||
astr->stereoDynSplit->stop();
|
||||
astr->stereoDynSplit->bind(bstr.stereoStream);
|
||||
astr->stereoDynSplit->bindStream(bstr.stereoStream);
|
||||
if (astr->running) {
|
||||
astr->stereoDynSplit->start();
|
||||
}
|
||||
@ -125,7 +125,7 @@ namespace audio {
|
||||
return bstr.monoStream;
|
||||
}
|
||||
|
||||
dsp::stream<dsp::StereoFloat_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx) {
|
||||
dsp::stream<dsp::stereo_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx) {
|
||||
AudioStream_t* astr = streams[name];
|
||||
BoundStream_t bstr;
|
||||
bstr.type = STREAM_TYPE_STEREO;
|
||||
@ -133,20 +133,20 @@ namespace audio {
|
||||
bstr.streamRemovedHandler = streamRemovedHandler;
|
||||
bstr.sampleRateChangeHandler = sampleRateChangeHandler;
|
||||
if (astr->type == STREAM_TYPE_STEREO) {
|
||||
bstr.stereoStream = new dsp::stream<dsp::StereoFloat_t>(astr->blockSize * 2);
|
||||
bstr.stereoStream = new dsp::stream<dsp::stereo_t>;
|
||||
astr->stereoDynSplit->stop();
|
||||
astr->stereoDynSplit->bind(bstr.stereoStream);
|
||||
astr->stereoDynSplit->bindStream(bstr.stereoStream);
|
||||
if (astr->running) {
|
||||
astr->stereoDynSplit->start();
|
||||
}
|
||||
astr->boundStreams.push_back(bstr);
|
||||
return bstr.stereoStream;
|
||||
}
|
||||
bstr.monoStream = new dsp::stream<float>(astr->blockSize * 2);
|
||||
bstr.m2s = new dsp::MonoToStereo(bstr.monoStream, astr->blockSize * 2);
|
||||
bstr.stereoStream = &bstr.m2s->output;
|
||||
bstr.monoStream = new dsp::stream<float>;
|
||||
bstr.m2s = new dsp::MonoToStereo(bstr.monoStream);
|
||||
bstr.stereoStream = &bstr.m2s->out;
|
||||
astr->monoDynSplit->stop();
|
||||
astr->monoDynSplit->bind(bstr.monoStream);
|
||||
astr->monoDynSplit->bindStream(bstr.monoStream);
|
||||
if (astr->running) {
|
||||
astr->monoDynSplit->start();
|
||||
}
|
||||
@ -156,35 +156,37 @@ namespace audio {
|
||||
}
|
||||
|
||||
void setBlockSize(std::string name, int blockSize) {
|
||||
AudioStream_t* astr = streams[name];
|
||||
if (astr->running) {
|
||||
return;
|
||||
}
|
||||
if (astr->type == STREAM_TYPE_MONO) {
|
||||
astr->monoDynSplit->setBlockSize(blockSize);
|
||||
for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
BoundStream_t bstr = astr->boundStreams[i];
|
||||
bstr.monoStream->setMaxLatency(blockSize * 2);
|
||||
if (bstr.type == STREAM_TYPE_STEREO) {
|
||||
bstr.m2s->stop();
|
||||
bstr.m2s->setBlockSize(blockSize);
|
||||
bstr.m2s->start();
|
||||
}
|
||||
}
|
||||
astr->blockSize = blockSize;
|
||||
return;
|
||||
}
|
||||
astr->monoDynSplit->setBlockSize(blockSize);
|
||||
for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
BoundStream_t bstr = astr->boundStreams[i];
|
||||
bstr.stereoStream->setMaxLatency(blockSize * 2);
|
||||
if (bstr.type == STREAM_TYPE_MONO) {
|
||||
bstr.s2m->stop();
|
||||
bstr.s2m->setBlockSize(blockSize);
|
||||
bstr.s2m->start();
|
||||
}
|
||||
}
|
||||
astr->blockSize = blockSize;
|
||||
// NOTE: THIS SHOULD NOT BE NEEDED ANYMORE
|
||||
|
||||
// AudioStream_t* astr = streams[name];
|
||||
// if (astr->running) {
|
||||
// return;
|
||||
// }
|
||||
// if (astr->type == STREAM_TYPE_MONO) {
|
||||
// astr->monoDynSplit->setBlockSize(blockSize);
|
||||
// for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
// BoundStream_t bstr = astr->boundStreams[i];
|
||||
// bstr.monoStream->setMaxLatency(blockSize * 2);
|
||||
// if (bstr.type == STREAM_TYPE_STEREO) {
|
||||
// bstr.m2s->stop();
|
||||
// bstr.m2s->setBlockSize(blockSize);
|
||||
// bstr.m2s->start();
|
||||
// }
|
||||
// }
|
||||
// astr->blockSize = blockSize;
|
||||
// return;
|
||||
// }
|
||||
// astr->monoDynSplit->setBlockSize(blockSize);
|
||||
// for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
// BoundStream_t bstr = astr->boundStreams[i];
|
||||
// bstr.stereoStream->setMaxLatency(blockSize * 2);
|
||||
// if (bstr.type == STREAM_TYPE_MONO) {
|
||||
// bstr.s2m->stop();
|
||||
// bstr.s2m->setBlockSize(blockSize);
|
||||
// bstr.s2m->start();
|
||||
// }
|
||||
// }
|
||||
// astr->blockSize = blockSize;
|
||||
}
|
||||
|
||||
void unbindFromStreamMono(std::string name, dsp::stream<float>* stream) {
|
||||
@ -196,7 +198,7 @@ namespace audio {
|
||||
}
|
||||
if (astr->type == STREAM_TYPE_STEREO) {
|
||||
astr->stereoDynSplit->stop();
|
||||
astr->stereoDynSplit->unbind(bstr.stereoStream);
|
||||
astr->stereoDynSplit->unbindStream(bstr.stereoStream);
|
||||
if (astr->running) {
|
||||
astr->stereoDynSplit->start();
|
||||
}
|
||||
@ -205,7 +207,7 @@ namespace audio {
|
||||
return;
|
||||
}
|
||||
astr->monoDynSplit->stop();
|
||||
astr->monoDynSplit->unbind(bstr.monoStream);
|
||||
astr->monoDynSplit->unbindStream(bstr.monoStream);
|
||||
if (astr->running) {
|
||||
astr->monoDynSplit->start();
|
||||
}
|
||||
@ -214,7 +216,7 @@ namespace audio {
|
||||
}
|
||||
}
|
||||
|
||||
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::StereoFloat_t>* stream) {
|
||||
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::stereo_t>* stream) {
|
||||
AudioStream_t* astr = streams[name];
|
||||
for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
BoundStream_t bstr = astr->boundStreams[i];
|
||||
@ -223,7 +225,7 @@ namespace audio {
|
||||
}
|
||||
if (astr->type == STREAM_TYPE_MONO) {
|
||||
astr->monoDynSplit->stop();
|
||||
astr->monoDynSplit->unbind(bstr.monoStream);
|
||||
astr->monoDynSplit->unbindStream(bstr.monoStream);
|
||||
if (astr->running) {
|
||||
astr->monoDynSplit->start();
|
||||
}
|
||||
@ -232,7 +234,7 @@ namespace audio {
|
||||
return;
|
||||
}
|
||||
astr->stereoDynSplit->stop();
|
||||
astr->stereoDynSplit->unbind(bstr.stereoStream);
|
||||
astr->stereoDynSplit->unbindStream(bstr.stereoStream);
|
||||
if (astr->running) {
|
||||
astr->stereoDynSplit->start();
|
||||
}
|
||||
@ -255,16 +257,19 @@ namespace audio {
|
||||
if (astr->running) {
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE: All the blocksize stuff needs removal
|
||||
|
||||
int blockSize = astr->sampleRateChangeHandler(astr->ctx, sampleRate);
|
||||
astr->audio->setSampleRate(sampleRate);
|
||||
astr->audio->setBlockSize(blockSize);
|
||||
//astr->audio->setBlockSize(blockSize);
|
||||
if (astr->type == STREAM_TYPE_MONO) {
|
||||
astr->monoDynSplit->setBlockSize(blockSize);
|
||||
//astr->monoDynSplit->setBlockSize(blockSize);
|
||||
for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
BoundStream_t bstr = astr->boundStreams[i];
|
||||
if (bstr.type == STREAM_TYPE_STEREO) {
|
||||
bstr.m2s->stop();
|
||||
bstr.m2s->setBlockSize(blockSize);
|
||||
//bstr.m2s->setBlockSize(blockSize);
|
||||
bstr.sampleRateChangeHandler(bstr.ctx, sampleRate, blockSize);
|
||||
bstr.m2s->start();
|
||||
continue;
|
||||
@ -273,12 +278,12 @@ namespace audio {
|
||||
}
|
||||
}
|
||||
else {
|
||||
astr->stereoDynSplit->setBlockSize(blockSize);
|
||||
//astr->stereoDynSplit->setBlockSize(blockSize);
|
||||
for (int i = 0; i < astr->boundStreams.size(); i++) {
|
||||
BoundStream_t bstr = astr->boundStreams[i];
|
||||
if (bstr.type == STREAM_TYPE_MONO) {
|
||||
bstr.s2m->stop();
|
||||
bstr.s2m->setBlockSize(blockSize);
|
||||
//bstr.s2m->setBlockSize(blockSize);
|
||||
bstr.sampleRateChangeHandler(bstr.ctx, sampleRate, blockSize);
|
||||
bstr.s2m->start();
|
||||
continue;
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include <dsp/stream.h>
|
||||
#include <dsp/routing.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <io/audio.h>
|
||||
#include <map>
|
||||
|
||||
@ -15,7 +16,7 @@ namespace audio {
|
||||
|
||||
struct BoundStream_t {
|
||||
dsp::stream<float>* monoStream;
|
||||
dsp::stream<dsp::StereoFloat_t>* stereoStream;
|
||||
dsp::stream<dsp::stereo_t>* stereoStream;
|
||||
dsp::StereoToMono* s2m;
|
||||
dsp::MonoToStereo* m2s;
|
||||
void (*streamRemovedHandler)(void* ctx);
|
||||
@ -27,12 +28,12 @@ namespace audio {
|
||||
struct AudioStream_t {
|
||||
io::AudioSink* audio;
|
||||
dsp::stream<float>* monoAudioStream;
|
||||
dsp::stream<dsp::StereoFloat_t>* stereoAudioStream;
|
||||
dsp::stream<dsp::stereo_t>* stereoAudioStream;
|
||||
std::vector<BoundStream_t> boundStreams;
|
||||
dsp::stream<float>* monoStream;
|
||||
dsp::DynamicSplitter<float>* monoDynSplit;
|
||||
dsp::stream<dsp::StereoFloat_t>* stereoStream;
|
||||
dsp::DynamicSplitter<dsp::StereoFloat_t>* stereoDynSplit;
|
||||
dsp::Splitter<float>* monoDynSplit;
|
||||
dsp::stream<dsp::stereo_t>* stereoStream;
|
||||
dsp::Splitter<dsp::stereo_t>* stereoDynSplit;
|
||||
int (*sampleRateChangeHandler)(void* ctx, double sampleRate);
|
||||
double sampleRate;
|
||||
int blockSize;
|
||||
@ -48,15 +49,15 @@ namespace audio {
|
||||
extern std::map<std::string, AudioStream_t*> streams;
|
||||
|
||||
double registerMonoStream(dsp::stream<float>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
|
||||
double registerStereoStream(dsp::stream<dsp::StereoFloat_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
|
||||
double registerStereoStream(dsp::stream<dsp::stereo_t>* stream, std::string name, std::string vfoName, int (*sampleRateChangeHandler)(void* ctx, double sampleRate), void* ctx);
|
||||
void startStream(std::string name);
|
||||
void stopStream(std::string name);
|
||||
void removeStream(std::string name);
|
||||
dsp::stream<float>* bindToStreamMono(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
|
||||
dsp::stream<dsp::StereoFloat_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
|
||||
dsp::stream<dsp::stereo_t>* bindToStreamStereo(std::string name, void (*streamRemovedHandler)(void* ctx), void (*sampleRateChangeHandler)(void* ctx, double sampleRate, int blockSize), void* ctx);
|
||||
void setBlockSize(std::string name, int blockSize);
|
||||
void unbindFromStreamMono(std::string name, dsp::stream<float>* stream);
|
||||
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::StereoFloat_t>* stream);
|
||||
void unbindFromStreamStereo(std::string name, dsp::stream<dsp::stereo_t>* stream);
|
||||
std::string getNameFromVFO(std::string vfoName);
|
||||
void setSampleRate(std::string name, double sampleRate);
|
||||
void setAudioDevice(std::string name, int deviceId, double sampleRate);
|
||||
|
@ -4,54 +4,43 @@ SignalPath::SignalPath() {
|
||||
|
||||
}
|
||||
|
||||
void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*)) {
|
||||
void SignalPath::init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*,int,void*)) {
|
||||
this->sampleRate = sampleRate;
|
||||
this->fftRate = fftRate;
|
||||
this->fftSize = fftSize;
|
||||
inputBlockSize = sampleRate / 200.0f;
|
||||
|
||||
dcBiasRemover.init(input, 32000);
|
||||
dcBiasRemover.bypass = true;
|
||||
split.init(&dcBiasRemover.output, 32000);
|
||||
split.init(input);
|
||||
|
||||
fftBlockDec.init(&split.output_a, (sampleRate / fftRate) - fftSize, fftSize);
|
||||
fftHandlerSink.init(&fftBlockDec.output, fftBuffer, fftSize, fftHandler);
|
||||
|
||||
dynSplit.init(&split.output_b, 32000);
|
||||
reshape.init(&fftStream);
|
||||
fftHandlerSink.init(&reshape.out, fftHandler, NULL);
|
||||
}
|
||||
|
||||
void SignalPath::setSampleRate(double sampleRate) {
|
||||
this->sampleRate = sampleRate;
|
||||
inputBlockSize = sampleRate / 200.0f;
|
||||
|
||||
dcBiasRemover.stop();
|
||||
split.stop();
|
||||
fftBlockDec.stop();
|
||||
fftHandlerSink.stop();
|
||||
dynSplit.stop();
|
||||
//fftBlockDec.stop();
|
||||
//fftHandlerSink.stop();
|
||||
|
||||
for (auto const& [name, vfo] : vfos) {
|
||||
vfo.vfo->stop();
|
||||
}
|
||||
|
||||
dcBiasRemover.setBlockSize(inputBlockSize);
|
||||
split.setBlockSize(inputBlockSize);
|
||||
int skip = (sampleRate / fftRate) - fftSize;
|
||||
fftBlockDec.setSkip(skip);
|
||||
dynSplit.setBlockSize(inputBlockSize);
|
||||
// Claculate skip to maintain a constant fft rate
|
||||
//int skip = (sampleRate / fftRate) - fftSize;
|
||||
//fftBlockDec.setSkip(skip);
|
||||
|
||||
// TODO: Tell modules that the block size has changed
|
||||
// TODO: Tell modules that the block size has changed (maybe?)
|
||||
|
||||
for (auto const& [name, vfo] : vfos) {
|
||||
vfo.vfo->setInputSampleRate(sampleRate, inputBlockSize);
|
||||
vfo.vfo->setInSampleRate(sampleRate);
|
||||
vfo.vfo->start();
|
||||
}
|
||||
|
||||
fftHandlerSink.start();
|
||||
fftBlockDec.start();
|
||||
//fftHandlerSink.start();
|
||||
//fftBlockDec.start();
|
||||
split.start();
|
||||
dcBiasRemover.start();
|
||||
dynSplit.start();
|
||||
}
|
||||
|
||||
double SignalPath::getSampleRate() {
|
||||
@ -59,32 +48,23 @@ double SignalPath::getSampleRate() {
|
||||
}
|
||||
|
||||
void SignalPath::start() {
|
||||
dcBiasRemover.start();
|
||||
split.start();
|
||||
|
||||
fftBlockDec.start();
|
||||
reshape.start();
|
||||
fftHandlerSink.start();
|
||||
|
||||
dynSplit.start();
|
||||
}
|
||||
|
||||
void SignalPath::setDCBiasCorrection(bool enabled) {
|
||||
dcBiasRemover.bypass = !enabled;
|
||||
}
|
||||
|
||||
dsp::VFO* SignalPath::addVFO(std::string name, double outSampleRate, double bandwidth, double offset) {
|
||||
if (vfos.find(name) != vfos.end()) {
|
||||
return NULL;
|
||||
}
|
||||
dynSplit.stop();
|
||||
|
||||
VFO_t vfo;
|
||||
vfo.inputStream = new dsp::stream<dsp::complex_t>(inputBlockSize * 2);
|
||||
dynSplit.bind(vfo.inputStream);
|
||||
vfo.inputStream = new dsp::stream<dsp::complex_t>;
|
||||
split.bindStream(vfo.inputStream);
|
||||
vfo.vfo = new dsp::VFO();
|
||||
vfo.vfo->init(vfo.inputStream, sampleRate, outSampleRate, bandwidth, offset, inputBlockSize);
|
||||
vfo.vfo->init(vfo.inputStream, offset, sampleRate, outSampleRate, bandwidth);
|
||||
vfo.vfo->start();
|
||||
vfos[name] = vfo;
|
||||
dynSplit.start();
|
||||
return vfo.vfo;
|
||||
}
|
||||
|
||||
@ -93,30 +73,22 @@ void SignalPath::removeVFO(std::string name) {
|
||||
return;
|
||||
|
||||
}
|
||||
dynSplit.stop();
|
||||
VFO_t vfo = vfos[name];
|
||||
vfo.vfo->stop();
|
||||
dynSplit.unbind(vfo.inputStream);
|
||||
split.unbindStream(vfo.inputStream);
|
||||
delete vfo.vfo;
|
||||
delete vfo.inputStream;
|
||||
dynSplit.start();
|
||||
vfos.erase(name);
|
||||
}
|
||||
|
||||
void SignalPath::setInput(dsp::stream<dsp::complex_t>* input) {
|
||||
dcBiasRemover.stop();
|
||||
dcBiasRemover.setInput(input);
|
||||
dcBiasRemover.start();
|
||||
split.setInput(input);
|
||||
}
|
||||
|
||||
void SignalPath::bindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
||||
dynSplit.stop();
|
||||
dynSplit.bind(stream);
|
||||
dynSplit.start();
|
||||
split.bindStream(stream);
|
||||
}
|
||||
|
||||
void SignalPath::unbindIQStream(dsp::stream<dsp::complex_t>* stream) {
|
||||
dynSplit.stop();
|
||||
dynSplit.unbind(stream);
|
||||
dynSplit.start();
|
||||
split.unbindStream(stream);
|
||||
}
|
@ -6,7 +6,6 @@
|
||||
#include <dsp/demodulator.h>
|
||||
#include <dsp/routing.h>
|
||||
#include <dsp/sink.h>
|
||||
#include <dsp/correction.h>
|
||||
#include <dsp/vfo.h>
|
||||
#include <map>
|
||||
#include <module.h>
|
||||
@ -14,10 +13,9 @@
|
||||
class SignalPath {
|
||||
public:
|
||||
SignalPath();
|
||||
void init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*));
|
||||
void init(uint64_t sampleRate, int fftRate, int fftSize, dsp::stream<dsp::complex_t>* input, dsp::complex_t* fftBuffer, void fftHandler(dsp::complex_t*,int,void*));
|
||||
void start();
|
||||
void setSampleRate(double sampleRate);
|
||||
void setDCBiasCorrection(bool enabled);
|
||||
void setFFTRate(double rate);
|
||||
double getSampleRate();
|
||||
dsp::VFO* addVFO(std::string name, double outSampleRate, double bandwidth, double offset);
|
||||
@ -32,15 +30,14 @@ private:
|
||||
dsp::VFO* vfo;
|
||||
};
|
||||
|
||||
dsp::DCBiasRemover dcBiasRemover;
|
||||
dsp::Splitter split;
|
||||
dsp::Splitter<dsp::complex_t> split;
|
||||
|
||||
// FFT
|
||||
dsp::BlockDecimator fftBlockDec;
|
||||
dsp::HandlerSink fftHandlerSink;
|
||||
dsp::stream<dsp::complex_t> fftStream;
|
||||
dsp::Reshaper<dsp::complex_t> reshape;
|
||||
dsp::HandlerSink<dsp::complex_t> fftHandlerSink;
|
||||
|
||||
// VFO
|
||||
dsp::DynamicSplitter<dsp::complex_t> dynSplit;
|
||||
std::map<std::string, VFO_t> vfos;
|
||||
|
||||
double sampleRate;
|
||||
|
@ -8,7 +8,7 @@ VFOManager::VFO::VFO(std::string name, int reference, double offset, double band
|
||||
wtfVFO->setReference(reference);
|
||||
wtfVFO->setBandwidth(bandwidth);
|
||||
wtfVFO->setOffset(offset);
|
||||
output = dspVFO->output;
|
||||
output = dspVFO->out;
|
||||
gui::waterfall.vfos[name] = wtfVFO;
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ void VFOManager::VFO::setBandwidth(double bandwidth) {
|
||||
}
|
||||
|
||||
void VFOManager::VFO::setSampleRate(double sampleRate, double bandwidth) {
|
||||
dspVFO->setOutputSampleRate(sampleRate, bandwidth);
|
||||
dspVFO->setOutSampleRate(sampleRate, bandwidth);
|
||||
wtfVFO->setBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
@ -43,7 +43,8 @@ void VFOManager::VFO::setReference(int ref) {
|
||||
}
|
||||
|
||||
int VFOManager::VFO::getOutputBlockSize() {
|
||||
return dspVFO->getOutputBlockSize();
|
||||
// NOTE: This shouldn't be needed anymore
|
||||
return 1; //dspVFO->getOutputBlockSize();
|
||||
}
|
||||
|
||||
void VFOManager::VFO::setSnapInterval(double interval) {
|
||||
|
Reference in New Issue
Block a user