ExPixel / miniaudio-rs

Rust bindings for miniaudio C library.
https://crates.io/crates/miniaudio
MIT License
50 stars 20 forks source link

Add support for seeking and getting the length of the decoder's file #26

Closed sagacity closed 4 years ago

sagacity commented 4 years ago

This PR adds support for seeking in the decoder's stream, both on frame level and on (fractional) seconds level.

The example playback-decoder is adjusted so it plays the file twice, showing that seeking works.

sagacity commented 4 years ago

Oh hang on, I just saw the other PR which does approximately the same thing :) Feel free to close this one then.

ExPixel commented 4 years ago

Yeah, I just fixed that with a synchronizing decoder that uses a spinlock (dropping the lock guard on the Mutex might cause the audio thread to stutter). The implementation needs some work though which I'll be getting to later Today. Thank you for the PR though :)