Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto

This commit is contained in:
2024-12-25 02:15:25 +01:00
parent 1964ad87f9
commit cb25866754
11 changed files with 32242 additions and 10 deletions
+4
View File
@@ -134,12 +134,16 @@ class MiceMaze(controls.KeyBindings):
self.engine.scroll_view(self.pointer)
def play_sound(self, sound_file,tag="main"):
self.engine.play_sound(sound_file)
return
if self.audio:
if len(self.sounds) > 5:
self.sounds.pop(next(iter(self.sounds))).kill()
self.sounds[f"{tag}_{random.random()}"] = subprocess.Popen(["aplay", f"sound/{sound_file}"])
def stop_sound(self, tag=None):
self.engine.stop_sound()
return
for key, value in self.sounds.copy().items():
if tag is None or tag in key:
value.kill()