mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 23:02:43 +00:00
attemt at a CI build with new DSP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user