mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-11-10 04:37:37 +01:00
attemt at a CI build with new DSP
This commit is contained in:
parent
d1318d3a0f
commit
36adc102ee
6
.github/workflows/build_all.yml
vendored
6
.github/workflows/build_all.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: cmake "$Env:GITHUB_WORKSPACE" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
run: cmake "$Env:GITHUB_WORKSPACE" "-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
@ -106,7 +106,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_PLUTOSDR_SOURCE=ON -DOPT_BUILD_SOAPY_SOURCE=OFF -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_AUDIO_SINK=OFF -DOPT_BUILD_PORTAUDIO_SINK=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF -DUSE_BUNDLE_DEFAULTS=ON -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
@ -309,7 +309,7 @@ jobs:
|
||||
|
||||
- name: Prepare CMake
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
run: cmake $GITHUB_WORKSPACE -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{runner.workspace}}/build
|
||||
|
@ -3,12 +3,22 @@
|
||||
|
||||
namespace dsp::bench {
|
||||
template<class T>
|
||||
class PeakLevelMeter : Sink<T> {
|
||||
class PeakLevelMeter : public Sink<T> {
|
||||
using base_type = Sink<T>;
|
||||
public:
|
||||
PeakLevelMeter() {}
|
||||
|
||||
PeakLevelMeter(stream<T>* in) { base_type::init(in); }
|
||||
PeakLevelMeter(stream<T>* in) { init(in); }
|
||||
|
||||
void init(stream<T>* in) {
|
||||
if constexpr (std::is_same_v<T, float>) {
|
||||
level = 0.0f;
|
||||
}
|
||||
if constexpr (std::is_same_v<T, complex_t> || std::is_same_v<T, stereo_t>) {
|
||||
level = { 0.0f, 0.0f };
|
||||
}
|
||||
base_type::init(in);
|
||||
}
|
||||
|
||||
T getLevel() {
|
||||
return level;
|
||||
|
@ -82,12 +82,12 @@ namespace dsp::channel {
|
||||
}
|
||||
|
||||
inline int process(int count, const complex_t* in, complex_t* out) {
|
||||
xlator.process(count, in, xlator.out.writeBuf);
|
||||
xlator.process(count, in, out);
|
||||
if (!filterNeeded) {
|
||||
return resamp.process(count, xlator.out.writeBuf, out);
|
||||
return resamp.process(count, out, out);
|
||||
}
|
||||
count = resamp.process(count, xlator.out.writeBuf, resamp.out.writeBuf);
|
||||
filter.process(count, resamp.out.writeBuf, out);
|
||||
count = resamp.process(count, out, out);
|
||||
filter.process(count, out, out);
|
||||
return count;
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,8 @@ namespace dsp::demod {
|
||||
void init(stream<complex_t>* in, AGCMode agcMode, double agcRate) {
|
||||
_agcMode = agcMode;
|
||||
|
||||
carrierAgc.init(NULL, 1.0, agcRate);
|
||||
audioAgc.init(NULL, 1.0, agcRate);
|
||||
carrierAgc.init(NULL, 1.0, agcRate, 10e6, 10.0);
|
||||
audioAgc.init(NULL, 1.0, agcRate, 10e6, 10.0);
|
||||
|
||||
base_type::init(in);
|
||||
}
|
||||
@ -63,6 +63,9 @@ namespace dsp::demod {
|
||||
if (_agcMode == AGCMode::AUDIO) {
|
||||
audioAgc.process(count, out, out);
|
||||
}
|
||||
else {
|
||||
volk_32f_s32f_add_32f(out, out, -1.0f, count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "fm.h"
|
||||
#include "../taps/low_pass.h"
|
||||
#include "../taps/band_pass.h"
|
||||
#include "../filter/fir.h"
|
||||
#include "../loop/pll.h"
|
||||
@ -18,7 +19,7 @@ namespace dsp::demod {
|
||||
public:
|
||||
BroadcastFM() {}
|
||||
|
||||
BroadcastFM(stream<complex_t>* in, double deviation, double samplerate, bool stereo = true) { init(in, deviation, samplerate, stereo); }
|
||||
BroadcastFM(stream<complex_t>* in, double deviation, double samplerate, bool stereo = true, bool lowPass = true) { init(in, deviation, samplerate, stereo, lowPass); }
|
||||
|
||||
~BroadcastFM() {
|
||||
if (!base_type::_block_init) { return; }
|
||||
@ -26,19 +27,26 @@ namespace dsp::demod {
|
||||
buffer::free(lmr);
|
||||
buffer::free(l);
|
||||
buffer::free(r);
|
||||
taps::free(pilotFirTaps);
|
||||
taps::free(audioFirTaps);
|
||||
}
|
||||
|
||||
virtual void init(stream<complex_t>* in, double deviation, double samplerate, bool stereo = true) {
|
||||
virtual void init(stream<complex_t>* in, double deviation, double samplerate, bool stereo = true, bool lowPass = true) {
|
||||
_deviation = deviation;
|
||||
_samplerate = samplerate;
|
||||
_stereo = stereo;
|
||||
_lowPass = lowPass;
|
||||
|
||||
demod.init(NULL, _deviation, _samplerate);
|
||||
pilotFirTaps = taps::bandPass<complex_t>(18750.0, 19250.0, 3000.0, _samplerate);
|
||||
pilotFirTaps = taps::bandPass<complex_t>(18750.0, 19250.0, 3000.0, _samplerate, true);
|
||||
pilotFir.init(NULL, pilotFirTaps);
|
||||
rtoc.init(NULL);
|
||||
pilotPLL.init(NULL, 0.1/*TODO: adapt to samplerate*/, 0.0, math::freqToOmega(19000.0, _samplerate), math::freqToOmega(18750.0, _samplerate), math::freqToOmega(19250.0, _samplerate));
|
||||
delay.init(NULL, pilotFirTaps.size / 2.0);
|
||||
pilotPLL.init(NULL, 25000.0 / _samplerate, 0.0, math::freqToOmega(19000.0, _samplerate), math::freqToOmega(18750.0, _samplerate), math::freqToOmega(19250.0, _samplerate));
|
||||
lprDelay.init(NULL, ((pilotFirTaps.size - 1) / 2) + 1);
|
||||
lmrDelay.init(NULL, ((pilotFirTaps.size - 1) / 2) + 1);
|
||||
audioFirTaps = taps::lowPass(15000.0, 4000.0, _samplerate);
|
||||
alFir.init(NULL, audioFirTaps);
|
||||
arFir.init(NULL, audioFirTaps);
|
||||
|
||||
lmr = buffer::alloc<float>(STREAM_BUFFER_SIZE);
|
||||
l = buffer::alloc<float>(STREAM_BUFFER_SIZE);
|
||||
@ -62,11 +70,18 @@ namespace dsp::demod {
|
||||
|
||||
demod.setDeviation(_deviation, _samplerate);
|
||||
taps::free(pilotFirTaps);
|
||||
pilotFirTaps = taps::bandPass<complex_t>(18750.0, 19250.0, 3000.0, samplerate);
|
||||
pilotFirTaps = taps::bandPass<complex_t>(18750.0, 19250.0, 3000.0, samplerate, true);
|
||||
pilotFir.setTaps(pilotFirTaps);
|
||||
|
||||
pilotPLL.setFrequencyLimits(math::freqToOmega(18750.0, _samplerate), math::freqToOmega(19250.0, _samplerate));
|
||||
pilotPLL.setInitialFreq(math::freqToOmega(19000.0, _samplerate));
|
||||
delay.setDelay(pilotFirTaps.size / 2);
|
||||
lprDelay.setDelay(((pilotFirTaps.size - 1) / 2) + 1);
|
||||
lmrDelay.setDelay(((pilotFirTaps.size - 1) / 2) + 1);
|
||||
|
||||
taps::free(audioFirTaps);
|
||||
audioFirTaps = taps::lowPass(15000.0, 4000.0, _samplerate);
|
||||
alFir.setTaps(audioFirTaps);
|
||||
arFir.setTaps(audioFirTaps);
|
||||
|
||||
reset();
|
||||
base_type::tempStart();
|
||||
@ -81,6 +96,15 @@ namespace dsp::demod {
|
||||
base_type::tempStart();
|
||||
}
|
||||
|
||||
void setLowPass(bool lowPass) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
base_type::tempStop();
|
||||
_lowPass = lowPass;
|
||||
reset();
|
||||
base_type::tempStart();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
@ -88,7 +112,10 @@ namespace dsp::demod {
|
||||
demod.reset();
|
||||
pilotFir.reset();
|
||||
pilotPLL.reset();
|
||||
delay.reset();
|
||||
lprDelay.reset();
|
||||
lmrDelay.reset();
|
||||
alFir.reset();
|
||||
arFir.reset();
|
||||
base_type::tempStart();
|
||||
}
|
||||
|
||||
@ -103,21 +130,40 @@ namespace dsp::demod {
|
||||
pilotFir.process(count, rtoc.out.writeBuf, pilotFir.out.writeBuf);
|
||||
pilotPLL.process(count, pilotFir.out.writeBuf, pilotPLL.out.writeBuf);
|
||||
|
||||
// Conjugate PLL output to down convert the L-R signal
|
||||
// Delay
|
||||
lprDelay.process(count, demod.out.writeBuf, demod.out.writeBuf);
|
||||
lmrDelay.process(count, rtoc.out.writeBuf, rtoc.out.writeBuf);
|
||||
|
||||
// Double and conjugate PLL output to down convert the L-R signal
|
||||
math::Multiply<dsp::complex_t>::process(count, pilotPLL.out.writeBuf, pilotPLL.out.writeBuf, pilotPLL.out.writeBuf);
|
||||
math::Conjugate::process(count, pilotPLL.out.writeBuf, pilotPLL.out.writeBuf);
|
||||
math::Multiply<dsp::complex_t>::process(count, rtoc.out.writeBuf, pilotPLL.out.writeBuf, rtoc.out.writeBuf);
|
||||
|
||||
// Convert output back to real for further processing
|
||||
convert::ComplexToReal::process(count, rtoc.out.writeBuf, lmr);
|
||||
|
||||
// Amplify by 2x
|
||||
volk_32f_s32f_multiply_32f(lmr, lmr, 2.0f, count);
|
||||
|
||||
// Do L = (L+R) + (L-R), R = (L+R) - (L-R)
|
||||
math::Add<float>::process(count, demod.out.writeBuf, lmr, l);
|
||||
math::Subtract<float>::process(count, demod.out.writeBuf, lmr, r);
|
||||
|
||||
// Filter if needed
|
||||
if (_lowPass) {
|
||||
alFir.process(count, l, l);
|
||||
arFir.process(count, r, r);
|
||||
}
|
||||
|
||||
// Interleave into stereo
|
||||
convert::LRToStereo::process(count, l, r, out);
|
||||
}
|
||||
else {
|
||||
// Filter if needed
|
||||
if (_lowPass) {
|
||||
alFir.process(count, demod.out.writeBuf, demod.out.writeBuf);
|
||||
}
|
||||
|
||||
// Interleave raw MPX to stereo
|
||||
convert::LRToStereo::process(count, demod.out.writeBuf, demod.out.writeBuf, out);
|
||||
}
|
||||
@ -140,13 +186,18 @@ namespace dsp::demod {
|
||||
double _deviation;
|
||||
double _samplerate;
|
||||
bool _stereo;
|
||||
bool _lowPass = true;
|
||||
|
||||
FM demod;
|
||||
tap<complex_t> pilotFirTaps;
|
||||
filter::FIR<complex_t, complex_t> pilotFir;
|
||||
convert::RealToComplex rtoc;
|
||||
loop::PLL pilotPLL;
|
||||
math::Delay<float> delay;
|
||||
math::Delay<float> lprDelay;
|
||||
math::Delay<complex_t> lmrDelay;
|
||||
tap<float> audioFirTaps;
|
||||
filter::FIR<float, float> arFir;
|
||||
filter::FIR<float, float> alFir;
|
||||
|
||||
float* lmr;
|
||||
float* l;
|
||||
|
@ -32,7 +32,7 @@ namespace dsp::demod {
|
||||
_bandwidth = bandwidth;
|
||||
_samplerate = samplerate;
|
||||
xlator.init(NULL, getTranslation(), _samplerate);
|
||||
agc.init(NULL, 1.0, agcRate);
|
||||
agc.init(NULL, 1.0, agcRate, 10e6, 10.0);
|
||||
base_type::init(in);
|
||||
}
|
||||
|
||||
|
@ -8,11 +8,14 @@ namespace dsp::loop {
|
||||
public:
|
||||
AGC() {}
|
||||
|
||||
AGC(stream<T>* in) { init(in); }
|
||||
AGC(stream<T>* in, double setPoint, double rate, double maxGain, double maxOutputAmp, double initGain = 1.0) { init(in, setPoint, rate, maxGain, maxOutputAmp, initGain); }
|
||||
|
||||
void init(stream<T>* in, double setPoint, double rate, double initGain = 1.0) {
|
||||
void init(stream<T>* in, double setPoint, double rate, double maxGain, double maxOutputAmp, double initGain = 1.0) {
|
||||
_setPoint = setPoint;
|
||||
_rate = rate;
|
||||
_invRate = 1.0f - _rate;
|
||||
_maxGain = maxGain;
|
||||
_maxOutputAmp = maxOutputAmp;
|
||||
_initGain = initGain;
|
||||
gain = _initGain;
|
||||
base_type::init(in);
|
||||
@ -28,6 +31,19 @@ namespace dsp::loop {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
_rate = rate;
|
||||
_invRate = 1.0f - _rate;
|
||||
}
|
||||
|
||||
void setMaxGain(double maxGain) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
_maxGain = maxGain;
|
||||
}
|
||||
|
||||
void setMaxOutputAmp(double maxOutputAmp) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
_maxOutputAmp = maxOutputAmp;
|
||||
}
|
||||
|
||||
void setInitialGain(double initGain) {
|
||||
@ -40,22 +56,29 @@ namespace dsp::loop {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
gain = _initGain;
|
||||
amp = 1.0f;
|
||||
}
|
||||
|
||||
inline int process(int count, T* in, T* out) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
// Scale output by gain
|
||||
out[i] = in[i] * gain;
|
||||
|
||||
// Update gain according to setpoint and rate
|
||||
// Get signal amplitude
|
||||
float inAmp;
|
||||
if constexpr (std::is_same_v<T, complex_t>) {
|
||||
gain += (_setPoint - out[i].amplitude()) * _rate;
|
||||
inAmp = in[i].amplitude();
|
||||
}
|
||||
if constexpr (std::is_same_v<T, float>) {
|
||||
gain += (_setPoint - fabsf(out[i])) * _rate;
|
||||
inAmp = fabsf(in[i]);
|
||||
}
|
||||
|
||||
// Update average amplitude
|
||||
if (inAmp != 0.0f) {
|
||||
amp = (amp * _invRate) + (inAmp * _rate);
|
||||
gain = std::min<float>(_setPoint / amp, _maxGain);
|
||||
}
|
||||
|
||||
// Scale output by gain
|
||||
out[i] = in[i] * gain;
|
||||
}
|
||||
printf("%f\n", gain);
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -73,9 +96,13 @@ namespace dsp::loop {
|
||||
protected:
|
||||
float _setPoint;
|
||||
float _rate;
|
||||
float _invRate;
|
||||
float _maxGain;
|
||||
float _maxOutputAmp;
|
||||
float _initGain;
|
||||
|
||||
float gain;
|
||||
float amp = 1.0;
|
||||
|
||||
};
|
||||
}
|
@ -35,6 +35,11 @@ namespace dsp::loop {
|
||||
beta = (4 * bandwidth * bandwidth) / denominator;
|
||||
}
|
||||
|
||||
void setCoefficients(T alpha, T beta) {
|
||||
_alpha = alpha:
|
||||
_beta = beta;
|
||||
}
|
||||
|
||||
void setPhaseLimits(T minPhase, T maxPhase) {
|
||||
assert(maxPhase > minPhase);
|
||||
_minPhase = minPhase;
|
||||
|
@ -24,6 +24,16 @@ namespace dsp::loop {
|
||||
base_type::init(in);
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
base_type::tempStop();
|
||||
float alpha, beta;
|
||||
PhaseControlLoop<float>::criticallyDamped(bandwidth, alpha, beta);
|
||||
|
||||
base_type::tempStart();
|
||||
}
|
||||
|
||||
void setInitialPhase(double initPhase) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
|
@ -19,7 +19,7 @@ namespace dsp::math {
|
||||
void init(stream<T>* in, int delay) {
|
||||
_delay = delay;
|
||||
|
||||
buffer = buffer::alloc<float>(STREAM_BUFFER_SIZE + 64000);
|
||||
buffer = buffer::alloc<T>(STREAM_BUFFER_SIZE + 64000);
|
||||
bufStart = &buffer[_delay];
|
||||
buffer::clear(buffer, _delay);
|
||||
|
||||
|
@ -60,8 +60,8 @@ namespace dsp::multirate {
|
||||
int last = stageCount - 1;
|
||||
for (int i = 0; i < stageCount; i++) {
|
||||
auto fir = decimFirs[i];
|
||||
count = fir->process(count, data, (i == last) ? out : fir->out.writeBuf);
|
||||
data = fir->out.writeBuf;
|
||||
count = fir->process(count, data, out);
|
||||
data = out;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
@ -63,8 +63,8 @@ namespace dsp::multirate {
|
||||
inline int process(int count, const T* in, T* out) {
|
||||
switch(mode) {
|
||||
case Mode::BOTH:
|
||||
count = decim.process(count, in, decim.out.writeBuf);
|
||||
return resamp.process(count, decim.out.writeBuf, out);
|
||||
count = decim.process(count, in, out);
|
||||
return resamp.process(count, out, out);
|
||||
case Mode::DECIM_ONLY:
|
||||
return decim.process(count, in, out);
|
||||
case Mode::RESAMP_ONLY:
|
||||
|
44
core/src/dsp/routing/stream_link.h
Normal file
44
core/src/dsp/routing/stream_link.h
Normal file
@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
#include "../sink.h"
|
||||
|
||||
namespace dsp::routing {
|
||||
template <class T>
|
||||
class StreamLink : public Sink<T> {
|
||||
using base_type = Sink<T>;
|
||||
public:
|
||||
StreamLink() {}
|
||||
|
||||
StreamLink(stream<T>* in, stream<T>* out) { init(in, out); }
|
||||
|
||||
void init(stream<T>* in, stream<T>* out) {
|
||||
_out = out;
|
||||
base_type::registerOutput(_out);
|
||||
base_type::init(in);
|
||||
}
|
||||
|
||||
void setOutput(stream<T>* out) {
|
||||
assert(base_type::_block_init);
|
||||
std::lock_guard<std::recursive_mutex> lck(base_type::ctrlMtx);
|
||||
base_type::tempStop();
|
||||
base_type::unregisterOutput(_out);
|
||||
_out = out;
|
||||
base_type::registerOutput(_out);
|
||||
base_type::tempStart();
|
||||
}
|
||||
|
||||
int run() {
|
||||
int count = _in->read();
|
||||
if (count < 0) { return -1; }
|
||||
|
||||
memcpy(_out->writeBuf, _in->readBuf, count * sizeof(T));
|
||||
|
||||
_in->flush();
|
||||
if (!_out->swap(count)) { return -1; }
|
||||
return count;
|
||||
}
|
||||
|
||||
protected:
|
||||
stream<T>* _out;
|
||||
|
||||
};
|
||||
}
|
@ -8,15 +8,18 @@
|
||||
|
||||
namespace dsp::taps {
|
||||
template<class T>
|
||||
inline tap<T> bandPass(double bandStart, double bandStop, double transWidth, double sampleRate) {
|
||||
inline tap<T> bandPass(double bandStart, double bandStop, double transWidth, double sampleRate, bool oddTapCount = false) {
|
||||
assert(bandStop > bandStart);
|
||||
float offsetOmega = math::freqToOmega((bandStart + bandStop) / 2.0, sampleRate);
|
||||
return windowedSinc<T>(estimateTapCount(transWidth, sampleRate), (bandStop - bandStart) / 2.0, sampleRate, [=](double n, double N) {
|
||||
int count = estimateTapCount(transWidth, sampleRate);
|
||||
if (oddTapCount && !(count % 2)) { count++; }
|
||||
return windowedSinc<T>(count, (bandStop - bandStart) / 2.0, sampleRate, [=](double n, double N) {
|
||||
if constexpr (std::is_same_v<T, float>) {
|
||||
return cosf(offsetOmega * (float)n) * window::nuttall(n, N);
|
||||
}
|
||||
if constexpr (std::is_same_v<T, complex_t>) {
|
||||
return math::phasor(offsetOmega * (float)n) * window::nuttall(n, N);
|
||||
// The offset is negative to flip the taps. Complex bandpass are asymetric
|
||||
return math::phasor(-offsetOmega * (float)n) * window::nuttall(n, N);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -4,8 +4,10 @@
|
||||
#include "../window/nuttall.h"
|
||||
|
||||
namespace dsp::taps {
|
||||
inline tap<float> highPass(double cutoff, double transWidth, double sampleRate) {
|
||||
return windowedSinc<float>(estimateTapCount(transWidth, sampleRate), (sampleRate / 2.0) - cutoff, sampleRate, [=](double n, double N){
|
||||
inline tap<float> highPass(double cutoff, double transWidth, double sampleRate, bool oddTapCount = false) {
|
||||
int count = estimateTapCount(transWidth, sampleRate);
|
||||
if (oddTapCount && !(count % 2)) { count++; }
|
||||
return windowedSinc<float>(count, (sampleRate / 2.0) - cutoff, sampleRate, [=](double n, double N){
|
||||
return window::nuttall(n, N) * (((int)round(n) % 2) ? -1.0f : 1.0f);
|
||||
});
|
||||
}
|
||||
|
@ -4,7 +4,9 @@
|
||||
#include "../window/nuttall.h"
|
||||
|
||||
namespace dsp::taps {
|
||||
inline tap<float> lowPass(double cutoff, double transWidth, double sampleRate) {
|
||||
return windowedSinc<float>(estimateTapCount(transWidth, sampleRate), cutoff, sampleRate, window::nuttall);
|
||||
inline tap<float> lowPass(double cutoff, double transWidth, double sampleRate, bool oddTapCount = false) {
|
||||
int count = estimateTapCount(transWidth, sampleRate);
|
||||
if (oddTapCount && !(count % 2)) { count++; }
|
||||
return windowedSinc<float>(count, cutoff, sampleRate, window::nuttall);
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
#pragma once
|
||||
|
||||
#define VERSION_STR "1.0.6"
|
||||
#define VERSION_STR "1.1.0"
|
@ -20,7 +20,7 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::AM::AGCMode::CARRIER, 200000.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::AM::AGCMode::CARRIER, 24.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace demod {
|
||||
// Define structure
|
||||
xlator.init(input, tone, getIFSampleRate());
|
||||
c2r.init(&xlator.out);
|
||||
agc.init(&c2r.out, 1.0, 200000.0 / getIFSampleRate());
|
||||
agc.init(&c2r.out, 1.0, 24.0 / getIFSampleRate(), 10e6, 10.0);
|
||||
m2s.init(&agc.out);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::DSB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::DSB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::LSB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::LSB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace demod {
|
||||
this->name = name;
|
||||
|
||||
// Define structure
|
||||
demod.init(input, dsp::demod::SSB::Mode::USB, bandwidth, getIFSampleRate(), 200000.0 / getIFSampleRate());
|
||||
demod.init(input, dsp::demod::SSB::Mode::USB, bandwidth, getIFSampleRate(), 24.0 / getIFSampleRate());
|
||||
m2s.init(&demod.out);
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,9 @@ namespace demod {
|
||||
_config->conf[name][getName()]["stereo"] = _stereo;
|
||||
_config->release(true);
|
||||
}
|
||||
if (ImGui::Checkbox(("Low Pass##_radio_wfm_lowpass_" + name).c_str(), &_lowPass)) {
|
||||
demod.setLowPass(_lowPass);
|
||||
}
|
||||
}
|
||||
|
||||
void setBandwidth(double bandwidth) {
|
||||
@ -93,6 +96,7 @@ namespace demod {
|
||||
ConfigManager* _config = NULL;
|
||||
|
||||
bool _stereo = false;
|
||||
bool _lowPass = true;
|
||||
|
||||
std::string name;
|
||||
EventHandler<dsp::stream<dsp::stereo_t>*> outputChangeHandler;
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -47,7 +47,7 @@ echo 'Cflags: -I/usr/include/codec2' >> /usr/share/pkgconfig/codec2.pc
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_OVERRIDE_STD_FILESYSTEM=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_BLADERF_SOURCE=OFF -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_OVERRIDE_STD_FILESYSTEM=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
# Generate package
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -18,7 +18,7 @@ cp inc/* /usr/include/
|
||||
cd SDRPlusPlus
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=ON
|
||||
cmake .. -DOPT_BUILD_BLADERF_SOURCE=ON -DOPT_BUILD_LIMESDR_SOURCE=ON -DOPT_BUILD_SDRPLAY_SOURCE=ON -DOPT_BUILD_NEW_PORTAUDIO_SINK=ON -DOPT_BUILD_M17_DECODER=OFF
|
||||
make VERBOSE=1 -j2
|
||||
|
||||
cd ..
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <gui/file_dialogs.h>
|
||||
#include <utils/freq_formatting.h>
|
||||
#include <gui/dialogs/dialog_box.h>
|
||||
#include <fstream>
|
||||
|
||||
SDRPP_MOD_INFO{
|
||||
/* Name: */ "frequency_manager",
|
||||
|
@ -3,7 +3,10 @@
|
||||
#include <wav.h>
|
||||
#include <dsp/types.h>
|
||||
#include <dsp/stream.h>
|
||||
#include <dsp/measure.h>
|
||||
#include <dsp/bench./peak_level_meter.h>
|
||||
#include <dsp/sink/handler_sink.h>
|
||||
#include <dsp/routing/splitter.h>
|
||||
#include <dsp/audio/volume.h>
|
||||
#include <thread>
|
||||
#include <ctime>
|
||||
#include <gui/gui.h>
|
||||
@ -72,7 +75,7 @@ public:
|
||||
config.release(created);
|
||||
|
||||
// Init audio path
|
||||
vol.init(&dummyStream, audioVolume);
|
||||
vol.init(&dummyStream, audioVolume, false);
|
||||
audioSplit.init(&vol.out);
|
||||
audioSplit.bindStream(&meterStream);
|
||||
meter.init(&meterStream);
|
||||
@ -269,13 +272,14 @@ private:
|
||||
if (recording) { style::endDisabled(); }
|
||||
|
||||
double frameTime = 1.0 / ImGui::GetIO().Framerate;
|
||||
lvlL = std::max<float>(lvlL - (frameTime * 50.0), -90);
|
||||
lvlR = std::max<float>(lvlR - (frameTime * 50.0), -90);
|
||||
lvlL = std::clamp<float>(lvlL - (frameTime * 50.0), -90.0f, 10.0f);
|
||||
lvlR = std::clamp<float>(lvlR - (frameTime * 50.0), -90.0f, 10.0f);
|
||||
|
||||
float _lvlL = meter.getLeftLevel();
|
||||
float _lvlR = meter.getRightLevel();
|
||||
if (_lvlL > lvlL) { lvlL = _lvlL; }
|
||||
if (_lvlR > lvlR) { lvlR = _lvlR; }
|
||||
dsp::stereo_t rawLvl = meter.getLevel();
|
||||
meter.resetLevel();
|
||||
dsp::stereo_t dbLvl = { 10.0f * log10f(rawLvl.l), 10.0f * log10f(rawLvl.r) };
|
||||
if (dbLvl.l > lvlL) { lvlL = dbLvl.l; }
|
||||
if (dbLvl.r > lvlR) { lvlR = dbLvl.r; }
|
||||
ImGui::VolumeMeter(lvlL, lvlL, -60, 10);
|
||||
ImGui::VolumeMeter(lvlR, lvlR, -60, 10);
|
||||
|
||||
@ -485,12 +489,12 @@ private:
|
||||
|
||||
// Audio path
|
||||
dsp::stream<dsp::stereo_t>* audioInput = NULL;
|
||||
dsp::Volume<dsp::stereo_t> vol;
|
||||
dsp::Splitter<dsp::stereo_t> audioSplit;
|
||||
dsp::audio::Volume vol;
|
||||
dsp::routing::Splitter<dsp::stereo_t> audioSplit;
|
||||
dsp::stream<dsp::stereo_t> meterStream;
|
||||
dsp::LevelMeter meter;
|
||||
dsp::bench::PeakLevelMeter<dsp::stereo_t> meter;
|
||||
dsp::stream<dsp::stereo_t> audioHandlerStream;
|
||||
dsp::HandlerSink<dsp::stereo_t> audioHandler;
|
||||
dsp::sink::Handler<dsp::stereo_t> audioHandler;
|
||||
WavWriter* audioWriter;
|
||||
|
||||
std::vector<std::string> streamNames;
|
||||
@ -501,7 +505,7 @@ private:
|
||||
|
||||
// Baseband path
|
||||
dsp::stream<dsp::complex_t> basebandStream;
|
||||
dsp::HandlerSink<dsp::complex_t> basebandHandler;
|
||||
dsp::sink::Handler<dsp::complex_t> basebandHandler;
|
||||
WavWriter* basebandWriter;
|
||||
|
||||
uint64_t samplesWritten;
|
||||
|
@ -4,8 +4,9 @@
|
||||
#include <gui/gui.h>
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <signal_path/sink.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <dsp/processing.h>
|
||||
#include <dsp/buffer/packer.h>
|
||||
#include <dsp/convert/stereo_to_mono.h>
|
||||
#include <dsp/sink/handler_sink.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <config.h>
|
||||
#include <gui/style.h>
|
||||
@ -271,10 +272,10 @@ private:
|
||||
}
|
||||
|
||||
SinkManager::Stream* _stream;
|
||||
dsp::Packer<dsp::stereo_t> packer;
|
||||
dsp::StereoToMono s2m;
|
||||
dsp::HandlerSink<float> monoSink;
|
||||
dsp::HandlerSink<dsp::stereo_t> stereoSink;
|
||||
dsp::buffer::Packer<dsp::stereo_t> packer;
|
||||
dsp::convert::StereoToMono s2m;
|
||||
dsp::sink::Handler<float> monoSink;
|
||||
dsp::sink::Handler<dsp::stereo_t> stereoSink;
|
||||
|
||||
std::string _streamName;
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
#include <signal_path/signal_path.h>
|
||||
#include <signal_path/sink.h>
|
||||
#include <portaudio.h>
|
||||
#include <dsp/audio.h>
|
||||
#include <dsp/processing.h>
|
||||
#include <dsp/buffer/packer.h>
|
||||
#include <dsp/convert/stereo_to_mono.h>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <config.h>
|
||||
#include <algorithm>
|
||||
@ -374,8 +374,8 @@ private:
|
||||
std::string selectedDevName;
|
||||
|
||||
SinkManager::Stream* _stream;
|
||||
dsp::Packer<dsp::stereo_t> packer;
|
||||
dsp::StereoToMono s2m;
|
||||
dsp::buffer::Packer<dsp::stereo_t> packer;
|
||||
dsp::convert::StereoToMono s2m;
|
||||
|
||||
PaStream* devStream;
|
||||
|
||||
|
@ -32,10 +32,10 @@ public:
|
||||
if (core::args["server"].b()) { return; }
|
||||
|
||||
// Initialize lists
|
||||
sampleTypeList.define("Int8", dsp::PCM_TYPE_I8);
|
||||
sampleTypeList.define("Int16", dsp::PCM_TYPE_I16);
|
||||
sampleTypeList.define("Float32", dsp::PCM_TYPE_F32);
|
||||
sampleTypeId = sampleTypeList.valueId(dsp::PCM_TYPE_I16);
|
||||
sampleTypeList.define("Int8", dsp::compression::PCM_TYPE_I8);
|
||||
sampleTypeList.define("Int16", dsp::compression::PCM_TYPE_I16);
|
||||
sampleTypeList.define("Float32", dsp::compression::PCM_TYPE_F32);
|
||||
sampleTypeId = sampleTypeList.valueId(dsp::compression::PCM_TYPE_I16);
|
||||
|
||||
handler.ctx = this;
|
||||
handler.selectHandler = menuSelected;
|
||||
@ -238,7 +238,7 @@ private:
|
||||
devConfName = buf;
|
||||
|
||||
// Load settings
|
||||
sampleTypeId = sampleTypeList.valueId(dsp::PCM_TYPE_I16);
|
||||
sampleTypeId = sampleTypeList.valueId(dsp::compression::PCM_TYPE_I16);
|
||||
if (config.conf["servers"][devConfName].contains("sampleType")) {
|
||||
std::string key = config.conf["servers"][devConfName]["sampleType"];
|
||||
if (sampleTypeList.keyExists(key)) { sampleTypeId = sampleTypeList.keyId(key); }
|
||||
@ -269,7 +269,7 @@ private:
|
||||
dsp::stream<dsp::complex_t> stream;
|
||||
SourceManager::SourceHandler handler;
|
||||
|
||||
OptionList<std::string, dsp::PCMType> sampleTypeList;
|
||||
OptionList<std::string, dsp::compression::PCMType> sampleTypeList;
|
||||
int sampleTypeId;
|
||||
bool compression = false;
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace server {
|
||||
return currentSampleRate;
|
||||
}
|
||||
|
||||
void ClientClass::setSampleType(dsp::PCMType type) {
|
||||
void ClientClass::setSampleType(dsp::compression::PCMType type) {
|
||||
s_cmd_data[0] = type;
|
||||
sendCommand(COMMAND_SET_SAMPLE_TYPE, 1);
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include <atomic>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <dsp/compression.h>
|
||||
#include <dsp/compression/sample_stream_decompressor.h>
|
||||
#include <dsp/sink.h>
|
||||
#include <dsp/link.h>
|
||||
#include <dsp/routing/stream_link.h>
|
||||
#include <zstd.h>
|
||||
|
||||
#define RFSPACE_MAX_SIZE 8192
|
||||
@ -85,7 +85,7 @@ namespace server {
|
||||
void setFrequency(double freq);
|
||||
double getSampleRate();
|
||||
|
||||
void setSampleType(dsp::PCMType type);
|
||||
void setSampleType(dsp::compression::PCMType type);
|
||||
void setCompression(bool enabled);
|
||||
|
||||
void start();
|
||||
@ -115,8 +115,8 @@ namespace server {
|
||||
net::Conn client;
|
||||
|
||||
dsp::stream<uint8_t> decompIn;
|
||||
dsp::DynamicRangeDecompressor decomp;
|
||||
dsp::Link<dsp::complex_t> link;
|
||||
dsp::compression::SampleStreamDecompressor decomp;
|
||||
dsp::routing::StreamLink<dsp::complex_t> link;
|
||||
dsp::stream<dsp::complex_t>* output;
|
||||
|
||||
uint8_t* rbuffer = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user