new audio system?

This commit is contained in:
Anthony Samms
2025-09-15 10:58:44 -04:00
parent e34fce6012
commit 74c3414ccd
10 changed files with 2093 additions and 975 deletions

View File

@@ -111,7 +111,6 @@ class GameScreen:
tex.unload_textures()
if self.song_music is not None:
audio.unload_music_stream(self.song_music)
self.song_music = None
self.song_started = False
self.end_ms = 0
self.movie = None
@@ -156,9 +155,8 @@ class GameScreen:
if self.tja is not None:
if (self.current_ms >= self.tja.metadata.offset*1000 + self.start_delay - global_data.config["general"]["judge_offset"]) and not self.song_started:
if self.song_music is not None:
if not audio.is_music_stream_playing(self.song_music):
audio.play_music_stream(self.song_music)
print(f"Song started at {self.current_ms}")
audio.play_music_stream(self.song_music)
print(f"Song started at {self.current_ms}")
if self.movie is not None:
self.movie.start(current_time)
self.song_started = True
@@ -170,6 +168,9 @@ class GameScreen:
if self.background is not None:
self.background.update(current_time, self.bpm, self.player_1.gauge)
if self.song_music is not None:
audio.update_music_stream(self.song_music)
self.player_1.update(self, current_time)
self.song_info.update(current_time)
self.result_transition.update(current_time)

View File

@@ -26,6 +26,7 @@ class SettingsScreen:
def on_screen_start(self):
if not self.screen_init:
audio.list_host_apis()
self.screen_init = True
def on_screen_end(self):
@@ -33,7 +34,7 @@ class SettingsScreen:
save_config(self.config)
global_data.config = self.config
audio.close_audio_device()
audio.type = global_data.config["audio"]["device_type"]
audio.device_type = global_data.config["audio"]["device_type"]
audio.init_audio_device()
return "ENTRY"

View File

@@ -407,8 +407,9 @@ class SongSelectScreen:
if self.demo_song is None and get_current_ms() >= song.box.wait + (83.33*3):
song.box.get_scores()
if song.tja.metadata.wave.exists() and song.tja.metadata.wave.is_file():
self.demo_song = audio.load_music_stream(song.tja.metadata.wave, preview=song.tja.metadata.demostart)
self.demo_song = audio.load_music_stream(song.tja.metadata.wave)
audio.play_music_stream(self.demo_song)
audio.seek_music_stream(self.demo_song, song.tja.metadata.demostart)
audio.stop_sound(self.sound_bgm)
if song.box.is_open:
current_box = song.box