Module crankstart::sound

source ·
Expand description

Sound is the parent structure for the Playdate audio API, and you can get access specific subsystems through its ‘get’ methods.

For example, to play an audio sample (sound effect):

let sound = Sound::get();
let player = sound.get_sample_player()?;
let mut sample = sound.load_audio_sample("test.wav")?;
player.set_sample(&mut sample)?;
player.play(1, 1.0)?;

To play a music file:

let music = Sound::get().get_file_player()?;
music.load_into_player("music.pda")?;
music.play(0)?;

Re-exports

Modules

Structs

  • Sound is the main interface to the Playdate audio subsystems.