aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helpers/__init__.py4
-rw-r--r--helpers/mapping.py5
-rw-r--r--helpers/music_file.py6
3 files changed, 12 insertions, 3 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py
index 807aa44..863a23b 100644
--- a/helpers/__init__.py
+++ b/helpers/__init__.py
@@ -32,6 +32,9 @@ def parse_args():
32 default="config.yml", 32 default="config.yml",
33 required=False, 33 required=False,
34 help="Config file to load") 34 help="Config file to load")
35 parser.add_argument("-m", "--no-mixing",
36 action="store_true",
37 help="Don't make the mixing of sounds manually and let the sound system do it")
35 parser.add_argument("-l", "--latency", 38 parser.add_argument("-l", "--latency",
36 default="high", 39 default="high",
37 required=False, 40 required=False,
@@ -80,6 +83,7 @@ def parse_args():
80 Config.frame_rate = args.frame_rate 83 Config.frame_rate = args.frame_rate
81 Config.channels = args.channels 84 Config.channels = args.channels
82 Config.sample_width = args.sample_width 85 Config.sample_width = args.sample_width
86 Config.no_mixing = args.no_mixing
83 87
84class SelectDeviceAction(argparse.Action): 88class SelectDeviceAction(argparse.Action):
85 def __call__(self, parser, namespace, values, option_string=None): 89 def __call__(self, parser, namespace, values, option_string=None):
diff --git a/helpers/mapping.py b/helpers/mapping.py
index 8e0265c..cfc2c3f 100644
--- a/helpers/mapping.py
+++ b/helpers/mapping.py
@@ -17,7 +17,10 @@ class Mapping(RelativeLayout):
17 ready_color = ListProperty([1, 165/255, 0, 1]) 17 ready_color = ListProperty([1, 165/255, 0, 1])
18 18
19 def __init__(self, **kwargs): 19 def __init__(self, **kwargs):
20 self.mixer = Mixer() 20 if Config.no_mixing:
21 self.mixer = None
22 else:
23 self.mixer = Mixer()
21 self.key_config, self.open_files = self.parse_config() 24 self.key_config, self.open_files = self.parse_config()
22 super(Mapping, self).__init__(**kwargs) 25 super(Mapping, self).__init__(**kwargs)
23 self._keyboard = Window.request_keyboard(self._keyboard_closed, self) 26 self._keyboard = Window.request_keyboard(self._keyboard_closed, self)
diff --git a/helpers/music_file.py b/helpers/music_file.py
index f1aa341..f391ff4 100644
--- a/helpers/music_file.py
+++ b/helpers/music_file.py
@@ -7,6 +7,7 @@ import os.path
7 7
8from .lock import Lock 8from .lock import Lock
9from . import Config, gain 9from . import Config, gain
10from .mixer import Mixer
10 11
11file_lock = Lock("file") 12file_lock = Lock("file")
12 13
@@ -31,6 +32,7 @@ class MusicFile(Machine):
31 32
32 Machine.__init__(self, states=states, transitions=transitions, initial='initial') 33 Machine.__init__(self, states=states, transitions=transitions, initial='initial')
33 34
35 self.mixer = mapping.mixer or Mixer()
34 self.volume = 100 36 self.volume = 100
35 self.mapping = mapping 37 self.mapping = mapping
36 self.filename = filename 38 self.filename = filename
@@ -95,7 +97,7 @@ class MusicFile(Machine):
95 self.start_playing() 97 self.start_playing()
96 98
97 def on_enter_loaded_playing(self): 99 def on_enter_loaded_playing(self):
98 self.mapping.mixer.add_file(self) 100 self.mixer.add_file(self)
99 101
100 def finished_callback(self): 102 def finished_callback(self):
101 if self.is_loaded_playing(): 103 if self.is_loaded_playing():
@@ -104,7 +106,7 @@ class MusicFile(Machine):
104 self.stopped() 106 self.stopped()
105 107
106 def trigger_stopped_events(self): 108 def trigger_stopped_events(self):
107 self.mapping.mixer.remove_file(self) 109 self.mixer.remove_file(self)
108 self.wait_event.set() 110 self.wait_event.set()
109 111
110 def play_callback(self, out_data_length, frame_count): 112 def play_callback(self, out_data_length, frame_count):