Expand description
Helper crate to easily use the Rodio audio playback library by providing helper functions
This crate aims to simplify using Rodio in your projects by providing many functions to easily create sinks and play audio with only a few lines of code.
Playing a sound is as simple as this:
use rotilities::*;
fn main() {
let (_stream, stream_handle) = init();
let sink = new_sink(&stream_handle);
play_audio(&sink, "path/to/file.mp3");
loop{}
}
§A detailed documentation is coming soom.
Functions§
- get_
source - Internal helper function for this crate
- init
- This function “initiates” the crucial part of audio output, the stream and stream handle, and is thus always required
- new_
sink - This function creates a sink (audio stream) and returns it (for example to a variable). Needs an existing stream handle. -> Maximum control, all Rodio sink functions work with this
- pause_
audio - Pauses audio playback of a sink without affecting the sink’s queue. Requires an existing sink
- play_
audio - Add an audio file to the queue of a sink. Requires an existing sink
- resume_
audio - Resumes audio playback of a sink. Requires an existing sink
- set_
audio_ volume - Set the volume level of a sink. Requires an existing sink
- stop_
audio - Stops audio playback and clears the queue of a sink Requires an existing sink