Browse Source

Rimuovi chiamate non necessarie ai metodi di riproduzione e arresto audio

master
Matteo Benedetto 12 months ago
parent
commit
3e7056e23f
  1. 4
      rats.py

4
rats.py

@ -142,16 +142,12 @@ 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()

Loading…
Cancel
Save