aboutsummaryrefslogtreecommitdiff
path: root/helpers/music_file.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/music_file.py')
-rw-r--r--helpers/music_file.py6
1 files changed, 4 insertions, 2 deletions
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):