-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmodule_music.c
39 lines (30 loc) · 920 Bytes
/
module_music.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma bank 255
#include <gbdk/platform.h>
#include <stdint.h>
#include "systemdetect.h"
#include "musicmanager.h"
#include "module_music.h"
// audio assets
#include "music.h"
BANKREF(module_music)
uint8_t music_paused = FALSE;
// // music is not used by now, examples for start/stop/pause are commented out and left for the reference
// if (joy & J_SELECT) music_stop(), music_pause(music_paused = FALSE);
// if (joy & J_START) music_pause(music_paused = (!music_paused));
// initialize the music/SFX driver
uint8_t INIT_module_music(void) BANKED {
music_init();
CRITICAL {
music_setup_timer_ex(_is_CPU_FAST);
#if defined(NINTENDO)
add_low_priority_TIM(music_play_isr);
#else
add_VBL(music_play_isr);
#endif
}
#if defined(NINTENDO)
set_interrupts(IE_REG | TIM_IFLAG);
#endif
music_load(BANK(song), &song), music_pause(music_paused = TRUE);
return 0;
}