throw DecodeError (_("could not open audio file for reading"));
}
+ _done = 0;
_remaining = _info.frames;
}
SndfileDecoder::~SndfileDecoder ()
{
- if (_sndfile) {
- sf_close (_sndfile);
- }
+ sf_close (_sndfile);
}
bool
shared_ptr<AudioBuffers> audio (new AudioBuffers (_sndfile_content->audio_channels(), this_time));
sf_read_float (_sndfile, audio->data(0), this_time);
audio->set_frames (this_time);
- Audio (audio);
+ Audio (audio, double(_done) / audio_frame_rate());
+ _done += this_time;
_remaining -= this_time;
return (_remaining == 0);