mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 04:37:37 +01:00
Fixed stall
This commit is contained in:
parent
fc9bc496cb
commit
35c7f0e3cf
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace dsp {
|
||||
class MonoToStereo : public generic_block<MonoToStereo> {
|
||||
@ -20,7 +19,9 @@ namespace dsp {
|
||||
void setInput(stream<float>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<MonoToStereo>::ctrlMtx);
|
||||
generic_block<MonoToStereo>::tempStop();
|
||||
generic_block<MonoToStereo>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<MonoToStereo>::registerInput(_in);
|
||||
generic_block<MonoToStereo>::tempStart();
|
||||
}
|
||||
|
||||
@ -64,7 +65,9 @@ namespace dsp {
|
||||
void setInput(stream<stereo_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<StereoToMono>::ctrlMtx);
|
||||
generic_block<StereoToMono>::tempStop();
|
||||
generic_block<StereoToMono>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<StereoToMono>::registerInput(_in);
|
||||
generic_block<StereoToMono>::tempStart();
|
||||
}
|
||||
|
||||
|
@ -20,15 +20,17 @@ namespace dsp {
|
||||
if (running) {
|
||||
return;
|
||||
}
|
||||
running = true;
|
||||
doStart();
|
||||
}
|
||||
|
||||
virtual void stop() {
|
||||
std::lock_guard<std::mutex> lck(ctrlMtx);
|
||||
if (!running && !tempStopped) {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
doStop();
|
||||
running = false;
|
||||
}
|
||||
|
||||
virtual int calcOutSize(int inSize) { return inSize; }
|
||||
@ -67,7 +69,6 @@ namespace dsp {
|
||||
}
|
||||
|
||||
virtual void doStart() {
|
||||
running = true;
|
||||
workerThread = std::thread(&generic_block::workerLoop, this);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#define FAST_ATAN2_COEF1 FL_M_PI / 4.0f
|
||||
#define FAST_ATAN2_COEF2 3.0f * FAST_ATAN2_COEF1
|
||||
@ -44,7 +43,9 @@ namespace dsp {
|
||||
void setInput(stream<complex_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<FMDemod>::ctrlMtx);
|
||||
generic_block<FMDemod>::tempStop();
|
||||
generic_block<FMDemod>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<FMDemod>::registerInput(_in);
|
||||
generic_block<FMDemod>::tempStart();
|
||||
}
|
||||
|
||||
@ -120,7 +121,9 @@ namespace dsp {
|
||||
void setInput(stream<complex_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<AMDemod>::ctrlMtx);
|
||||
generic_block<AMDemod>::tempStop();
|
||||
generic_block<AMDemod>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<AMDemod>::registerInput(_in);
|
||||
generic_block<AMDemod>::tempStart();
|
||||
}
|
||||
|
||||
@ -182,7 +185,9 @@ namespace dsp {
|
||||
void setInput(stream<complex_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<SSBDemod>::ctrlMtx);
|
||||
generic_block<SSBDemod>::tempStop();
|
||||
generic_block<SSBDemod>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<SSBDemod>::registerInput(_in);
|
||||
generic_block<SSBDemod>::tempStart();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <dsp/window.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
namespace dsp {
|
||||
|
||||
@ -34,7 +33,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<FIR<T>>::ctrlMtx);
|
||||
generic_block<FIR<T>>::tempStop();
|
||||
generic_block<FIR<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<FIR<T>>::registerInput(_in);
|
||||
generic_block<FIR<T>>::tempStart();
|
||||
}
|
||||
|
||||
@ -110,7 +111,9 @@ namespace dsp {
|
||||
void setInput(stream<float>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<BFMDeemp>::ctrlMtx);
|
||||
generic_block<BFMDeemp>::tempStop();
|
||||
generic_block<BFMDeemp>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<BFMDeemp>::registerInput(_in);
|
||||
generic_block<BFMDeemp>::tempStart();
|
||||
}
|
||||
|
||||
@ -127,11 +130,8 @@ namespace dsp {
|
||||
}
|
||||
|
||||
int run() {
|
||||
spdlog::warn("+++++++++++++ DEEMP READING");
|
||||
count = _in->read();
|
||||
if (count < 0) { spdlog::warn("++++++++++ DEEMP EXIT"); return -1; }
|
||||
|
||||
spdlog::warn("+++++++++++++ DEEMP PROC");
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
if (bypass) {
|
||||
if (out.aquire() < 0) { return -1; }
|
||||
@ -149,8 +149,6 @@ namespace dsp {
|
||||
}
|
||||
lastOut = out.data[count - 1];
|
||||
|
||||
spdlog::warn("+++++++++++++ DEEMP DONE");
|
||||
|
||||
_in->flush();
|
||||
out.write(count);
|
||||
return count;
|
||||
|
@ -16,13 +16,16 @@ namespace dsp {
|
||||
_freq = freq;
|
||||
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));
|
||||
generic_block<FrequencyXlator>::registerInput(_in);
|
||||
generic_block<FrequencyXlator>::registerOutput(&out);
|
||||
}
|
||||
|
||||
void setInputSize(stream<complex_t>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<FrequencyXlator>::ctrlMtx);
|
||||
generic_block<FrequencyXlator>::tempStop();
|
||||
generic_block<FrequencyXlator>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<FrequencyXlator>::registerInput(_in);
|
||||
generic_block<FrequencyXlator>::tempStart();
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
#include <dsp/block.h>
|
||||
#include <dsp/window.h>
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <numeric>
|
||||
|
||||
namespace dsp {
|
||||
template <class T>
|
||||
@ -46,7 +45,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<PolyphaseResampler<T>>::ctrlMtx);
|
||||
generic_block<PolyphaseResampler<T>>::tempStop();
|
||||
generic_block<PolyphaseResampler<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<PolyphaseResampler<T>>::registerInput(_in);
|
||||
generic_block<PolyphaseResampler<T>>::tempStart();
|
||||
}
|
||||
|
||||
@ -96,9 +97,10 @@ namespace dsp {
|
||||
}
|
||||
|
||||
int run() {
|
||||
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WAITING ========"); }
|
||||
if constexpr (std::is_same_v<T, float>) { spdlog::warn("--------- RESAMP START --------"); }
|
||||
count = _in->read();
|
||||
if (count < 0) {
|
||||
if constexpr (std::is_same_v<T, float>) { spdlog::warn("--------- RESAMP STOP --------"); }
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -107,8 +109,6 @@ namespace dsp {
|
||||
memcpy(bufStart, _in->data, count * sizeof(T));
|
||||
_in->flush();
|
||||
|
||||
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP GOT DATA ========"); }
|
||||
|
||||
// Write to output
|
||||
if (out.aquire() < 0) {
|
||||
return -1;
|
||||
@ -136,8 +136,6 @@ namespace dsp {
|
||||
}
|
||||
out.write(count);
|
||||
|
||||
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WRITTEN ========"); }
|
||||
|
||||
memmove(buffer, &buffer[count], tapCount * sizeof(T));
|
||||
|
||||
return count;
|
||||
|
@ -80,7 +80,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<Reshaper<T>>::ctrlMtx);
|
||||
generic_block<Reshaper<T>>::tempStop();
|
||||
generic_block<Reshaper<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<Reshaper<T>>::registerInput(_in);
|
||||
generic_block<Reshaper<T>>::tempStart();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<HandlerSink<T>>::ctrlMtx);
|
||||
generic_block<HandlerSink<T>>::tempStop();
|
||||
generic_block<HandlerSink<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<HandlerSink<T>>::registerInput(_in);
|
||||
generic_block<HandlerSink<T>>::tempStart();
|
||||
}
|
||||
|
||||
@ -67,7 +69,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<RingBufferSink<T>>::ctrlMtx);
|
||||
generic_block<RingBufferSink<T>>::tempStop();
|
||||
generic_block<RingBufferSink<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<RingBufferSink<T>>::registerInput(_in);
|
||||
generic_block<RingBufferSink<T>>::tempStart();
|
||||
}
|
||||
|
||||
@ -114,7 +118,9 @@ namespace dsp {
|
||||
void setInput(stream<T>* in) {
|
||||
std::lock_guard<std::mutex> lck(generic_block<NullSink<T>>::ctrlMtx);
|
||||
generic_block<NullSink<T>>::tempStop();
|
||||
generic_block<NullSink<T>>::unregisterInput(_in);
|
||||
_in = in;
|
||||
generic_block<NullSink<T>>::registerInput(_in);
|
||||
generic_block<NullSink<T>>::tempStart();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ namespace dsp {
|
||||
std::lock_guard<std::mutex> lck(sigMtx);
|
||||
contentSize = size;
|
||||
dataReady = true;
|
||||
lck.~lock_guard();
|
||||
}
|
||||
cv.notify_one();
|
||||
}
|
||||
@ -56,7 +55,6 @@ namespace dsp {
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(sigMtx);
|
||||
dataReady = false;
|
||||
lck.~lock_guard();
|
||||
}
|
||||
cv.notify_one();
|
||||
}
|
||||
@ -65,7 +63,6 @@ namespace dsp {
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(sigMtx);
|
||||
readerStop = true;
|
||||
lck.~lock_guard();
|
||||
}
|
||||
cv.notify_one();
|
||||
}
|
||||
@ -78,7 +75,6 @@ namespace dsp {
|
||||
{
|
||||
std::lock_guard<std::mutex> lck(sigMtx);
|
||||
writerStop = true;
|
||||
lck.~lock_guard();
|
||||
}
|
||||
cv.notify_one();
|
||||
}
|
||||
|
@ -46,13 +46,11 @@ void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
||||
ssbDemod.init(vfo->output, 6000, 3000, dsp::SSBDemod::MODE_USB);
|
||||
|
||||
audioWin.init(24000, 24000, 200000);
|
||||
audioResamp.init(&DUMMY_STREAM, &audioWin, 200000, 48000);
|
||||
audioResamp.init(&demod.out, &audioWin, 200000, 48000);
|
||||
audioWin.setSampleRate(audioResamp.getInterpolation() * 200000);
|
||||
audioResamp.updateWindow(&audioWin);
|
||||
|
||||
deemp.init(&audioResamp.out, 48000, 50e-6);
|
||||
|
||||
ns.init(&demod.out);
|
||||
|
||||
outputSampleRate = audio::registerMonoStream(&deemp.out, vfoName, vfoName, sampleRateChangeHandler, this);
|
||||
|
||||
@ -287,7 +285,6 @@ void SigPath::setBandwidth(float bandWidth) {
|
||||
void SigPath::start() {
|
||||
demod.start();
|
||||
audioResamp.start();
|
||||
//deemp.start();
|
||||
ns.start();
|
||||
deemp.start();
|
||||
audio::startStream(vfoName);
|
||||
}
|
@ -63,10 +63,6 @@ private:
|
||||
dsp::filter_window::BlackmanWindow audioWin;
|
||||
dsp::PolyphaseResampler<float> audioResamp;
|
||||
|
||||
// Debug
|
||||
dsp::NullSink<float> ns;
|
||||
dsp::stream<float> DUMMY_STREAM;
|
||||
|
||||
std::string vfoName;
|
||||
|
||||
float sampleRate;
|
||||
|
Loading…
Reference in New Issue
Block a user