User Tools

Site Tools


development:csdk:2.0:headers:music

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
development:csdk:2.0:headers:music [2024/11/16 04:41] – created clydedevelopment:csdk:2.0:headers:music [2024/11/20 21:14] (current) clyde
Line 5: Line 5:
 void init_music(); void init_music();
 </code> </code>
 +This should only need to be called once, after ''init_audio_coprocessor()'' and before doing any music or sound effects.
 ==== play_song ==== ==== play_song ====
 <code C> <code C>
 void play_song(const unsigned char* song, char bank_num, char loop); void play_song(const unsigned char* song, char bank_num, char loop);
 </code> </code>
 +''song'' and ''bank_num'' can be given at once by using a [[development:csdk:2.0:genmacros|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 ==== ==== tick_music ====
 <code C> <code C>
 char tick_music(); char tick_music();
 </code> </code>
-==== do_noise_effect ====+Call this once per frame, ideally shortly after ''await_vsync()'' 
 +==== play_sound_effect ====
 <code C> <code C>
-void do_noise_effect(char notechar bend, char duration); +void play_sound_effect(char sfx_id, char channel);
-</code> +
-==== do_tone_effect ==== +
-<code C> +
-void do_tone_effect(char channel, char note, char bend, char duration);+
 </code> </code>
 +''sfx_id'' is an index into the table of all assets with .sfx extensions. See the [[development:csdk:2.0:genmacros|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 ==== ==== stop_music ====
 <code C> <code C>
development/csdk/2.0/headers/music.1731732079.txt.gz · Last modified: 2024/11/16 04:41 by clyde