replace fixed-point linear interpolation with double-based version, thereby removing noise at low speeds and drift issues

git-svn-id: svn://localhost/ardour2/branches/3.0@5392 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Hans Baier
2009-07-19 22:30:36 +00:00
parent c1b2d8af7a
commit de58b257ae
4 changed files with 10 additions and 10 deletions

View File

@@ -146,7 +146,7 @@ class AudioDiskstream : public Diskstream
}
}
FixedPointLinearInterpolation interpolation;
LinearInterpolation interpolation;
XMLNode* deprecated_io_node;

View File

@@ -13,9 +13,9 @@ class Interpolation {
double _speed, _target_speed;
public:
Interpolation () { _speed = 1.0; }
Interpolation () { _speed = 1.0; _target_speed = 1.0; }
void set_speed (double new_speed) { _speed = new_speed; }
void set_speed (double new_speed) { _speed = new_speed; _target_speed = new_speed; }
void set_target_speed (double new_speed) { _target_speed = new_speed; }
double target_speed() const { return _target_speed; }

View File

@@ -1016,7 +1016,7 @@ class Session : public PBD::StatefulDestructible, public boost::noncopyable
volatile double _transport_speed;
double _last_transport_speed;
double _target_transport_speed;
FixedPointLinearInterpolation interpolation;
LinearInterpolation interpolation;
bool auto_play_legal;
nframes_t _last_slave_transport_frame;

View File

@@ -34,7 +34,6 @@ FixedPointLinearInterpolation::interpolate (int channel, nframes_t nframes, Samp
if (input && output) {
// Linearly interpolate into the output buffer
// using fixed point math
output[outsample] =
input[i] * (1.0f - fractional_phase_part) +
input[i+1] * fractional_phase_part;
@@ -85,10 +84,11 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
acceleration = 0.0;
}
printf("phase before: %lf\n", phase[channel]);
distance = phase[channel];
//printf("processing channel: %d\n", channel);
//printf("phase before: %lf\n", phase[channel]);
for (nframes_t outsample = 0; outsample < nframes; ++outsample) {
i = distance;
i = floor(distance);
Sample fractional_phase_part = distance - i;
if (fractional_phase_part >= 1.0) {
fractional_phase_part -= 1.0;
@@ -107,11 +107,11 @@ LinearInterpolation::interpolate (int channel, nframes_t nframes, Sample *input,
//printf("distance after: %lf, _speed: %lf\n", distance, _speed);
}
printf("before assignment: i: %d, distance: %lf\n", i, distance);
//printf("before assignment: i: %d, distance: %lf\n", i, distance);
i = floor(distance);
printf("after assignment: i: %d, distance: %16lf\n", i, distance);
//printf("after assignment: i: %d, distance: %16lf\n", i, distance);
phase[channel] = distance - floor(distance);
printf("speed: %16lf, i after: %d, distance after: %16lf, phase after: %16lf\n", _speed, i, distance, phase[channel]);
//printf("speed: %16lf, i after: %d, distance after: %16lf, phase after: %16lf\n", _speed, i, distance, phase[channel]);
return i;
}