about summary refs log tree commit diff homepage
path: root/brutalmaze/misc.py
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2020-04-12 17:51:12 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2020-04-12 17:51:12 +0700
commit2813a0856f1de3e0f9e0beed280e29e06a78c3ee (patch)
tree180e9abaf54506459ea47b9c32d5dcc516303c62 /brutalmaze/misc.py
parent600c72d0d4c4a64d452eb6bf4e96ac9436eb57e7 (diff)
downloadbrutalmaze-2813a0856f1de3e0f9e0beed280e29e06a78c3ee.tar.gz
Switch audio plane to Oxy
Also clean up sources properly
Diffstat (limited to 'brutalmaze/misc.py')
-rw-r--r--brutalmaze/misc.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/brutalmaze/misc.py b/brutalmaze/misc.py
index 92000a4..e5d1016 100644
--- a/brutalmaze/misc.py
+++ b/brutalmaze/misc.py
@@ -93,20 +93,22 @@ def json_rec(directory):
 def play(sound: str, x: float = MIDDLE, y: float = MIDDLE,
          gain: float = 1.0) -> None:
     """Play a sound at the given position."""
-    buffer = Buffer(sound)
-    source = buffer.play()
+    source = Buffer(sound).play()
     source.spatialize = True
-    source.position = x, 0, y
+    source.position = x, -y, 0
     source.gain = gain
     sources.append(source)
 
 
-def clean_sources() -> None:
-    """Destroyed stopped sources."""
+def clean_sources(stopped=True) -> None:
+    """Destroyed stopped sources.
+
+    If stopped is set to False, clean all sources.
+    """
     global sources
     sources, tmp = [], sources
     for source in tmp:
-        if source.playing:
+        if stopped and source.playing:
             sources.append(source)
         else:
             source.destroy()