mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 23:02:43 +00:00
even more stuff
This commit is contained in:
23
core/src/dsp/taps/band_pass.h
Normal file
23
core/src/dsp/taps/band_pass.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "../types.h"
|
||||
#include "windowed_sinc.h"
|
||||
#include "estimate_tap_count.h"
|
||||
#include "../window/nuttall.h"
|
||||
#include "../math/phasor.h"
|
||||
#include "../math/freq_to_omega.h"
|
||||
|
||||
namespace dsp::taps {
|
||||
template<class T>
|
||||
inline tap<T> bandPass(double bandStart, double bandStop, double transWidth, double sampleRate) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user