User Tools

Site Tools


development:csdk:2.0:headers:music

music.h

Functions

init_music

void init_music();

This should only need to be called once, after init_audio_coprocessor() and before doing any music or sound effects.

play_song

void play_song(const unsigned char* song, char bank_num, char loop);

song and bank_num can be given at once by using a generated asset macro.

loop should be one of:

  • REPEAT_NONE - Plays the song once and stops
  • REPEAT_LOOP - Replays the song continuously
  • REPEAT_RESUME - Play the song once, then resume the previous song.

tick_music

char tick_music();

Call this once per frame, ideally shortly after await_vsync()

play_sound_effect

void play_sound_effect(char sfx_id, char channel);

sfx_id is an index into the table of all assets with .sfx extensions. See the Generated Asset Macros page to get the ID for a sound effect.

channel gives the channel number to play the sound effect on, but also the priority. The channel used is the lower two bytes of channel while the priority used is given by the upper four bytes of channel.

stop_music

void stop_music();

pause_music

void pause_music();

unpause_music

void unpause_music();
development/csdk/2.0/headers/music.txt · Last modified: 2024/11/20 21:14 by clyde