Expand description
§raplay
Library for playing audio
§Examples
§Play a sine wave
use raplay::{Sink, source::Sine};
let mut sink = Sink::default(); // Get the default output
let src = Sine::new(1000.); // Create 1000Hz sine source
sink.load(Box::new(src), true)?; // Play the sine wave
§Play a mp3 file
use std::fs::File;
use raplay::{Sink, source::Symph};
let mut sink = Sink::default(); // Get the default output
let file = File::open("music.mp3").unwrap(); // Open the mp3 file
let src = Symph::try_new(file, &Default::default())?; // Create a symphonia
// decoder source
sink.load(Box::new(src), true); // Play the mp3 file
§Known issues
- If the output device doesn’t support the required sample rate, aliasing may occur.
Re-exports§
pub use self::source::Source;
Modules§
- converters
- Useful conversions on samples.
- reexp
- Useful reexports.
- source
- Audio sources that can be played in
Sink
.
Macros§
- operate_
samples - Does operation on the variant of the buffer
- silence_
sbuf - Writes silence into the buffer
- slice_
sbuf - Creates slice from the buffer
Structs§
Enums§
- Buffer
Size - Callback
Info - Callback type and asociated information
- Cpal
Error - Error
- Error type of this crate
- Prefetch
State - Sample
Buffer Mut - Buffer of samples, this is enum that contains the possible types of samples in a buffer
Functions§
- write_
silence - Writes silence to the buffer