mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-03-22 16:09:53 +01:00
fixed
This commit is contained in:
parent
75f8a45119
commit
fc9bc496cb
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <dsp/block.h>
|
#include <dsp/block.h>
|
||||||
#include <dsp/window.h>
|
#include <dsp/window.h>
|
||||||
#include <spdlog/
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
namespace dsp {
|
namespace dsp {
|
||||||
|
|
||||||
@ -127,8 +127,11 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
spdlog::warn("+++++++++++++ DEEMP READING");
|
||||||
count = _in->read();
|
count = _in->read();
|
||||||
if (count < 0) { return -1; }
|
if (count < 0) { spdlog::warn("++++++++++ DEEMP EXIT"); return -1; }
|
||||||
|
|
||||||
|
spdlog::warn("+++++++++++++ DEEMP PROC");
|
||||||
|
|
||||||
if (bypass) {
|
if (bypass) {
|
||||||
if (out.aquire() < 0) { return -1; }
|
if (out.aquire() < 0) { return -1; }
|
||||||
@ -146,6 +149,8 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
lastOut = out.data[count - 1];
|
lastOut = out.data[count - 1];
|
||||||
|
|
||||||
|
spdlog::warn("+++++++++++++ DEEMP DONE");
|
||||||
|
|
||||||
_in->flush();
|
_in->flush();
|
||||||
out.write(count);
|
out.write(count);
|
||||||
return count;
|
return count;
|
||||||
|
@ -96,16 +96,23 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int run() {
|
int run() {
|
||||||
|
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WAITING ========"); }
|
||||||
count = _in->read();
|
count = _in->read();
|
||||||
if (count < 0) { return -1; }
|
if (count < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int outCount = calcOutSize(count);
|
int outCount = calcOutSize(count);
|
||||||
|
|
||||||
memcpy(bufStart, _in->data, count * sizeof(T));
|
memcpy(bufStart, _in->data, count * sizeof(T));
|
||||||
_in->flush();
|
_in->flush();
|
||||||
|
|
||||||
|
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP GOT DATA ========"); }
|
||||||
|
|
||||||
// Write to output
|
// Write to output
|
||||||
if (out.aquire() < 0) { return -1; }
|
if (out.aquire() < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
int outIndex = 0;
|
int outIndex = 0;
|
||||||
if constexpr (std::is_same_v<T, float>) {
|
if constexpr (std::is_same_v<T, float>) {
|
||||||
for (int i = 0; outIndex < outCount; i += _decim) {
|
for (int i = 0; outIndex < outCount; i += _decim) {
|
||||||
@ -129,6 +136,8 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
out.write(count);
|
out.write(count);
|
||||||
|
|
||||||
|
if constexpr (std::is_same_v<T, float>) { spdlog::warn("======= RESAMP WRITTEN ========"); }
|
||||||
|
|
||||||
memmove(buffer, &buffer[count], tapCount * sizeof(T));
|
memmove(buffer, &buffer[count], tapCount * sizeof(T));
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
|
@ -96,4 +96,38 @@ namespace dsp {
|
|||||||
stream<T>* _in;
|
stream<T>* _in;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
class NullSink : public generic_block<NullSink<T>> {
|
||||||
|
public:
|
||||||
|
NullSink() {}
|
||||||
|
|
||||||
|
NullSink(stream<T>* in) { init(in); }
|
||||||
|
|
||||||
|
~NullSink() { generic_block<NullSink<T>>::stop(); }
|
||||||
|
|
||||||
|
void init(stream<T>* in) {
|
||||||
|
_in = in;
|
||||||
|
generic_block<NullSink<T>>::registerInput(_in);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setInput(stream<T>* in) {
|
||||||
|
std::lock_guard<std::mutex> lck(generic_block<NullSink<T>>::ctrlMtx);
|
||||||
|
generic_block<NullSink<T>>::tempStop();
|
||||||
|
_in = in;
|
||||||
|
generic_block<NullSink<T>>::tempStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
int run() {
|
||||||
|
count = _in->read();
|
||||||
|
if (count < 0) { return -1; }
|
||||||
|
_in->flush();
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int count;
|
||||||
|
stream<T>* _in;
|
||||||
|
|
||||||
|
};
|
||||||
}
|
}
|
@ -35,10 +35,13 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void write(int size) {
|
void write(int size) {
|
||||||
std::lock_guard<std::mutex> lck(sigMtx);
|
{
|
||||||
contentSize = size;
|
std::lock_guard<std::mutex> lck(sigMtx);
|
||||||
dataReady = true;
|
contentSize = size;
|
||||||
cv.notify_all();
|
dataReady = true;
|
||||||
|
lck.~lock_guard();
|
||||||
|
}
|
||||||
|
cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
int read() {
|
int read() {
|
||||||
@ -50,15 +53,21 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void flush() {
|
void flush() {
|
||||||
std::lock_guard<std::mutex> lck(sigMtx);
|
{
|
||||||
dataReady = false;
|
std::lock_guard<std::mutex> lck(sigMtx);
|
||||||
cv.notify_all();
|
dataReady = false;
|
||||||
|
lck.~lock_guard();
|
||||||
|
}
|
||||||
|
cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopReader() {
|
void stopReader() {
|
||||||
std::lock_guard<std::mutex> lck(sigMtx);
|
{
|
||||||
readerStop = true;
|
std::lock_guard<std::mutex> lck(sigMtx);
|
||||||
cv.notify_all();
|
readerStop = true;
|
||||||
|
lck.~lock_guard();
|
||||||
|
}
|
||||||
|
cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearReadStop() {
|
void clearReadStop() {
|
||||||
@ -66,9 +75,12 @@ namespace dsp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void stopWriter() {
|
void stopWriter() {
|
||||||
std::lock_guard<std::mutex> lck(sigMtx);
|
{
|
||||||
writerStop = true;
|
std::lock_guard<std::mutex> lck(sigMtx);
|
||||||
cv.notify_all();
|
writerStop = true;
|
||||||
|
lck.~lock_guard();
|
||||||
|
}
|
||||||
|
cv.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearWriteStop() {
|
void clearWriteStop() {
|
||||||
@ -80,12 +92,12 @@ namespace dsp {
|
|||||||
private:
|
private:
|
||||||
void waitReady() {
|
void waitReady() {
|
||||||
std::unique_lock<std::mutex> lck(sigMtx);
|
std::unique_lock<std::mutex> lck(sigMtx);
|
||||||
cv.wait(lck, [this]{ return !dataReady || writerStop; });
|
cv.wait(lck, [this]{ return (!dataReady || writerStop); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void waitData() {
|
void waitData() {
|
||||||
std::unique_lock<std::mutex> lck(sigMtx);
|
std::unique_lock<std::mutex> lck(sigMtx);
|
||||||
cv.wait(lck, [this]{ return dataReady || readerStop; });
|
cv.wait(lck, [this]{ return (dataReady || readerStop); });
|
||||||
}
|
}
|
||||||
|
|
||||||
std::mutex sigMtx;
|
std::mutex sigMtx;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include <path.h>
|
#include <path.h>
|
||||||
#include <signal_path/audio.h>
|
#include <signal_path/audio.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
SigPath::SigPath() {
|
SigPath::SigPath() {
|
||||||
|
|
||||||
@ -45,11 +46,13 @@ void SigPath::init(std::string vfoName, uint64_t sampleRate, int blockSize) {
|
|||||||
ssbDemod.init(vfo->output, 6000, 3000, dsp::SSBDemod::MODE_USB);
|
ssbDemod.init(vfo->output, 6000, 3000, dsp::SSBDemod::MODE_USB);
|
||||||
|
|
||||||
audioWin.init(24000, 24000, 200000);
|
audioWin.init(24000, 24000, 200000);
|
||||||
audioResamp.init(&demod.out, &audioWin, 200000, 48000);
|
audioResamp.init(&DUMMY_STREAM, &audioWin, 200000, 48000);
|
||||||
audioWin.setSampleRate(audioResamp.getInterpolation() * 200000);
|
audioWin.setSampleRate(audioResamp.getInterpolation() * 200000);
|
||||||
audioResamp.updateWindow(&audioWin);
|
audioResamp.updateWindow(&audioWin);
|
||||||
|
|
||||||
deemp.init(&audioResamp.out, 48000, 50e-6);
|
deemp.init(&audioResamp.out, 48000, 50e-6);
|
||||||
|
|
||||||
|
ns.init(&demod.out);
|
||||||
|
|
||||||
outputSampleRate = audio::registerMonoStream(&deemp.out, vfoName, vfoName, sampleRateChangeHandler, this);
|
outputSampleRate = audio::registerMonoStream(&deemp.out, vfoName, vfoName, sampleRateChangeHandler, this);
|
||||||
|
|
||||||
@ -284,6 +287,7 @@ void SigPath::setBandwidth(float bandWidth) {
|
|||||||
void SigPath::start() {
|
void SigPath::start() {
|
||||||
demod.start();
|
demod.start();
|
||||||
audioResamp.start();
|
audioResamp.start();
|
||||||
deemp.start();
|
//deemp.start();
|
||||||
|
ns.start();
|
||||||
audio::startStream(vfoName);
|
audio::startStream(vfoName);
|
||||||
}
|
}
|
@ -63,6 +63,10 @@ private:
|
|||||||
dsp::filter_window::BlackmanWindow audioWin;
|
dsp::filter_window::BlackmanWindow audioWin;
|
||||||
dsp::PolyphaseResampler<float> audioResamp;
|
dsp::PolyphaseResampler<float> audioResamp;
|
||||||
|
|
||||||
|
// Debug
|
||||||
|
dsp::NullSink<float> ns;
|
||||||
|
dsp::stream<float> DUMMY_STREAM;
|
||||||
|
|
||||||
std::string vfoName;
|
std::string vfoName;
|
||||||
|
|
||||||
float sampleRate;
|
float sampleRate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user