diff options
Diffstat (limited to 'src/audio.py')
-rw-r--r-- | src/audio.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/audio.py b/src/audio.py index ceb7cad..17ae5ef 100644 --- a/src/audio.py +++ b/src/audio.py @@ -6,6 +6,8 @@ pygame.mixer.init() pygame.mixer.set_num_channels(3) intro = pygame.mixer.Sound("./assets/sounds/intro.mp3") +menu = pygame.mixer.Sound("./assets/music/menu.mp3") + bgm = [ pygame.mixer.Sound("./assets/music/bgm1.mp3"), pygame.mixer.Sound("./assets/music/bgm2.mp3"), @@ -54,5 +56,13 @@ def play_music(): pygame.mixer.Channel(1).set_volume(0.5) pygame.mixer.Channel(1).play(random.choice(bgm)) +def play_menu(force=False): + if not pygame.mixer.Channel(1).get_busy() or force: + pygame.mixer.Channel(1).set_volume(0.5) + pygame.mixer.Channel(1).play(menu) + +def stop(channel=1): + pygame.mixer.Channel(channel).stop() + def play_sfx(id): pygame.mixer.Channel(2).play(random.choice(sfx[id]))
\ No newline at end of file |