mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-29 09:39:12 -04:00
Partial refactor of channel filter frequency code.
Move channel filter frequency determination to baseband side, where the filtering is determined and performed. Add useful accessor methods to BlockDecimator.
This commit is contained in:
parent
ffc50785b7
commit
6f2cbd1ac5
4 changed files with 34 additions and 19 deletions
|
@ -32,26 +32,34 @@ class BlockDecimator {
|
|||
public:
|
||||
constexpr BlockDecimator(
|
||||
const size_t factor
|
||||
) : factor { factor }
|
||||
) : factor_ { factor }
|
||||
{
|
||||
}
|
||||
|
||||
void set_input_sampling_rate(const uint32_t new_sampling_rate) {
|
||||
if( new_sampling_rate != input_sampling_rate ) {
|
||||
input_sampling_rate = new_sampling_rate;
|
||||
if( new_sampling_rate != input_sampling_rate() ) {
|
||||
input_sampling_rate_ = new_sampling_rate;
|
||||
reset_state();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t input_sampling_rate() const {
|
||||
return input_sampling_rate_;
|
||||
}
|
||||
|
||||
void set_factor(const size_t new_factor) {
|
||||
if( new_factor != factor ) {
|
||||
factor = new_factor;
|
||||
if( new_factor != factor() ) {
|
||||
factor_ = new_factor;
|
||||
reset_state();
|
||||
}
|
||||
}
|
||||
|
||||
size_t factor() const {
|
||||
return factor_;
|
||||
}
|
||||
|
||||
uint32_t output_sampling_rate() const {
|
||||
return input_sampling_rate / factor;
|
||||
return input_sampling_rate() / factor();
|
||||
}
|
||||
|
||||
template<typename BlockCallback>
|
||||
|
@ -68,7 +76,7 @@ public:
|
|||
dst_i = 0;
|
||||
}
|
||||
|
||||
src_i += factor;
|
||||
src_i += factor();
|
||||
}
|
||||
|
||||
src_i -= src.count;
|
||||
|
@ -76,8 +84,8 @@ public:
|
|||
|
||||
private:
|
||||
std::array<complex16_t, N> buffer;
|
||||
uint32_t input_sampling_rate { 0 };
|
||||
size_t factor { 1 };
|
||||
uint32_t input_sampling_rate_ { 0 };
|
||||
size_t factor_ { 1 };
|
||||
size_t src_i { 0 };
|
||||
size_t dst_i { 0 };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue