set bgm volume; pre init mixer

This commit is contained in:
frank 2022-01-19 13:53:13 -05:00
commit a8e49ccc7e
8 changed files with 8 additions and 12 deletions

8
NS.py
View File

@ -11,6 +11,7 @@ from serial.tools import list_ports
from time import sleep
from PIL import Image
import pygame
from pygame import Surface, Color, mixer
from pygame.event import clear
from pygame.mixer import Sound
@ -47,6 +48,7 @@ class NS(Game, Animation):
NO_RESET_TIMEOUT = 3000
def __init__(self):
pygame.mixer.pre_init(44100, -16, 2, 1024)
Game.__init__(self)
self.get_configuration().type_declarations.add_chart(
{
@ -65,10 +67,11 @@ class NS(Game, Animation):
}
})
Animation.__init__(self, self)
mixer.init(44100, -16, self.CHANNEL_COUNT, 4096)
self.subscribe(self.respond, KEYDOWN)
self.subscribe(self.respond, KEYUP)
self.subscribe(self.respond)
for bgm in self.audio.bgm.values():
bgm.volume = 0.65
ds = self.get_display_surface()
self.background = Surface(ds.get_size())
self.background.fill((0, 0, 0))
@ -498,6 +501,7 @@ class Title(Animation):
platform.set_glowing(platform.get_buttons_from_edges([self.UNLOCK_MOVES[self.unlock_index]]))
self.get_game().chemtrails.activate()
self.get_game().tony.set_frameset("static")
self.get_audio().play_bgm("title")
def deactivate(self):
self.active = False
@ -1520,6 +1524,7 @@ class Boss(Animation):
dialogue.set_name("Spoopy")
self.spoopy.unhide()
self.spoopy.set_frameset("normal")
self.get_audio().play_bgm(f"level_{index}")
self.play(self.show_introduction_dialogue, delay=3000, play_once=True)
self.get_game().platform.activate()
self.get_game().chemtrails.activate()
@ -2089,6 +2094,7 @@ class Ending(Animation):
dialogue.set_name("???")
dialogue.show_text("")
self.play(self.start_wipe, delay=20000, play_once=True)
self.get_audio().play_bgm("end")
def start(self):
self.advance_prompt.cancel_first_press()

@ -1 +1 @@
Subproject commit 619a7dab3fe318d162bd747436b4bfd02c1b17bb
Subproject commit 88ccb8d68131a053975be4db10cde59440aaf6c1

BIN
resource/bgm/end.ogg Normal file

Binary file not shown.

BIN
resource/bgm/level_0.ogg Normal file

Binary file not shown.

BIN
resource/bgm/level_1.ogg Normal file

Binary file not shown.

BIN
resource/bgm/level_2.ogg Normal file

Binary file not shown.

BIN
resource/bgm/title.ogg Normal file

Binary file not shown.

View File

@ -8,13 +8,3 @@
5999999
5999999
5999999
242000
242000
242000
242000
242000
242000
242000
242000
242000
242000