Crate raplay

Source
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§

Callback
Mutexed callback function.
Sink
A player that can play Source
Timestamp

Enums§

BufferSize
CallbackInfo
Callback type and asociated information
CpalError
Error
Error type of this crate
PrefetchState
SampleBufferMut
Buffer of samples, this is enum that contains the possible types of samples in a buffer

Functions§

write_silence
Writes silence to the buffer

Type Aliases§

OptionBox
Result
Result with this crate error type Error