Raquet / Wiki / v1x / Audio

Audio

Table of Contents

Supported Formats

 Raquet depends on the SDL2_Mixer library. Because of this, Raquet only supports what your copy of SDL2_Mixer supports. To check what your version supports, trial and error usually works. (By default, if you don't compile the library yourself, all supported formats for SDL2_Mixer should be included).

Loading, Playing, and Unloading Audio

To load an audio file into memory, we need to call Raquet_LoadSound() with a Raquet_Sound variable

Raquet_Sound snd_placeface;
snd_placeface = Raquet_LoadSound("./assets/2A03_Kevvviiinnn-Superfusion.wav");

Now that the audio is loaded into memory, we can play it with Raquet_PlaySound()

Raquet_PlaySound(snd_placeface, 0);

 Our first argument is the Raquet_Sound we want to play, and the second is the amount of times we want the sound to repeat. -1 will make it loop infinitely, and 0 will only make it play once.

After we're done with an audio file, we can unload it from memory with Raquet_FreeSound().

Raquet_FreeSound(snd_placeface);

That's all there is to it!