rodio_playback_position: Track the Playback Position of a Rodio Source at runtime.
A crate that provides a small playback backend for rodio sources, with support for a high-precision interpolated playback position counter.
This is useful for applications that need to sync visuals or other events with audio playback at runtime, such as rhythm games or music players. For scheduling and synchronizing the playback of multiple sources simultaneously, see the rodio_scheduler crate.
CPAL/rodio compatibility
rodio_playback_position version |
cpal version |
rodio version |
|---|---|---|
| 0.1.2 | 0.16.0 | 0.21.1 |
| 0.2.0 | 0.17.3 | 0.22.2 |
Usage
Add this to your Cargo.toml:
[]
= { = "0.2.0" }
# Or alternatively, for 128 bit sample counters:
#rodio_playback_position = { version = "0.2.0", features = ["u128"] }
= "0.22.2"
= "0.17.3"
The u128 feature flag can be enabled to use u128 as the SampleType, increasing
the maximum uptime of the library, at the cost of increased memory usage.
Here is an example of how to use the library to start playback and keep track of the current playback position. For more information, see the Docs, as well as the cpal Docs.
use Duration;
use ;
use SineWave;
use Source;
use ;