summaryrefslogtreecommitdiff
path: root/src/audio.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio.py')
-rw-r--r--src/audio.py28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/audio.py b/src/audio.py
index baba6da..1d8f725 100644
--- a/src/audio.py
+++ b/src/audio.py
@@ -1,6 +1,8 @@
import pygame
import random
+enable_audio = False
+
pygame.mixer.pre_init(48000, -16, 2, 2048)
pygame.mixer.init()
pygame.mixer.set_num_channels(3)
@@ -55,38 +57,46 @@ sfx = {
}
def play_intro():
- return
+ if not enable_audio:
+ return
pygame.mixer.Channel(0).play(intro)
def play_music():
- return
+ if not enable_audio:
+ return
if not pygame.mixer.Channel(1).get_busy():
pygame.mixer.Channel(1).set_volume(0.5)
pygame.mixer.Channel(1).play(random.choice(bgm))
def play_menu(force=False):
- return
+ if not enable_audio:
+ return
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):
- return
+ if not enable_audio:
+ return
pygame.mixer.Channel(channel).stop()
def pause_music():
- return
+ if not enable_audio:
+ return
pygame.mixer.Channel(1).pause()
def unpause_music():
- return
+ if not enable_audio:
+ return
pygame.mixer.Channel(1).unpause()
def play_sfx(id):
- return
+ if not enable_audio:
+ return
pygame.mixer.Channel(2).play(random.choice(sfx[id]))
def wait_for_sfx():
- return
+ if not enable_audio:
+ return
while pygame.mixer.Channel(2).get_busy():
- pass \ No newline at end of file
+ pass