Crate rotilities

Source
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