}
uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) {
- uint_t resampled_pos = (uint_t)ROUND(pos * s->ratio);
+ uint_t resampled_pos = (uint_t)ROUND(pos / s->ratio);
return sf_seek (s->handle, resampled_pos, SEEK_SET);
}
beach:
del_fvec (vec);
+ // check that we got exactly the same number of frames
assert ( old_n_frames_2 == old_n_frames_1 );
- assert ( old_n_frames_3 == (uint_t)floor(old_n_frames_1 / 2. + .5) );
+ // check that we got about half the frames, with 3 decimals
+ assert ( roundf(1.e3 * old_n_frames_1 / old_n_frames_3) / 1.e3 == 2.);
return err;
}