1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-11 03:25:06 +00:00

Fixed: now outputting the requested output rate, rather than massively overproducing at the input rate.

This commit is contained in:
Thomas Harte
2016-01-14 23:12:40 -05:00
parent e63b6d22ae
commit b58e59e2bb

View File

@@ -77,7 +77,8 @@ template <class T> class Filter: public Speaker {
if(_coefficients_are_dirty) update_filter_coefficients(); if(_coefficients_are_dirty) update_filter_coefficients();
// point sample for now, as a temporary measure // point sample for now, as a temporary measure
while(input_cycles--) input_cycles += _input_cycles_carry;
while(input_cycles > 0)
{ {
// get a sample for the current location // get a sample for the current location
static_cast<T *>(this)->get_samples(1, &_buffer_in_progress[_buffer_in_progress_pointer]); static_cast<T *>(this)->get_samples(1, &_buffer_in_progress[_buffer_in_progress_pointer]);
@@ -97,11 +98,14 @@ template <class T> class Filter: public Speaker {
uint64_t steps = _stepper->update(); uint64_t steps = _stepper->update();
if(steps > 1) if(steps > 1)
static_cast<T *>(this)->skip_samples((unsigned int)(steps-1)); static_cast<T *>(this)->skip_samples((unsigned int)(steps-1));
input_cycles -= steps;
} }
_input_cycles_carry = input_cycles;
} }
private: private:
SignalProcessing::Stepper *_stepper; SignalProcessing::Stepper *_stepper;
int _input_cycles_carry;
void update_filter_coefficients() void update_filter_coefficients()
{ {