Skip to main content

include_wav

Macro include_wav 

Source
macro_rules! include_wav {
    ($filepath: literal) => { ... };
}
Expand description

Include a wav file to be used for sound effects or music.

The parameter is the path to the sound file relative to the root of your crate. This macro can be thought of returning a SoundData.

The include_wav macro does not do any resampling, so it is up to you to make sure that the frequency of the wav file matches the one you’ve configured the mixer with. If there is a mismatch, the audio will play at the wrong speed resulting in a higher or lower pitch.

You can import stereo, but you need to call SoundChannel::stereo() or it’ll play as mono at half speed.

use agb::{sound::mixer::SoundData, include_wav};

static JUMP_SOUND: SoundData = include_wav!("examples/sfx/jump.wav");