Aggiungi supporto per audio e migliora la gestione delle dipendenze nel progetto
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user