void add_input_samples(std::chrono::steady_clock::time_point ts, const float *samples, ssize_t num_samples, RateAdjustmentPolicy rate_adjustment_policy);
// Returns false if underrun.
bool get_output_samples(std::chrono::steady_clock::time_point ts, float *samples, ssize_t num_samples, RateAdjustmentPolicy rate_adjustment_policy);
+ // Instantly change delay by removing samples, or adding zeros.
+ // Does not correct a queue that is in bad shape; e.g., if you change
+ // delay from 100 to 110 ms but your queue had a real delay of 200 ms,
+ // 10 ms worth of zeros will be inserted nevertheless.
+ void change_expected_delay(double expected_delay_seconds);
private:
void init_loop_filter(double bandwidth_hz);
};
InputPoint a0, a1;
+ // If nonzero, how many samples we've added or removed as part of change_expected_delay().
+ int adjustment_samples = 0;
+
// The current rate at which we seem to get input samples, in Hz.
// For an ideal input, identical to freq_in.
double current_estimated_freq_in;
// How much delay we are expected to have, in input samples.
// If actual delay drifts too much away from this, we will start
// changing the resampling ratio to compensate.
- const double expected_delay;
+ double expected_delay;
// Input samples not yet fed into the resampler.
// TODO: Use a circular buffer instead, for efficiency.