{
private:
FILE *f;
- double speed;
double p;
int in_pos;
short prev_sample;
public:
- InterpolatingReader(FILE *f) : f(f), speed(1.0), p(0.0), in_pos(-1) {}
+ InterpolatingReader(FILE *f) : f(f), p(0.0), in_pos(-1) {}
- void update_speed(double speed)
- {
- this->speed = speed;
- }
-
- double read_sample()
+ double read_sample(double speed)
{
short sample;
f2.update(s);
} while (!f2.check_flag() || !f2.get_status());
- double speed = 1.000;
-
InterpolatingReader intp(in2);
- intp.update_speed(speed); // test to see if we can resync OK
+ double speed = 1.000;
while (!feof(in1) && !feof(in2)) {
short refs;
// same here
unsigned num_inp = 0;
while (!feof(in2) && !f2.check_flag()) {
- double s = intp.read_sample();
+ double s = intp.read_sample(speed);
f2.update((short)s);
++num_inp;
}
printf("%u vs. %u -- ratio %.3f, speed %.3f, filtered speed %.3f\n", num_inp, num_ref,
double(num_inp) / double(num_ref), speed * double(num_inp) / double(num_ref), ns);
speed = ns;
- intp.update_speed(ns);
}
}