diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-18 00:15:15 +0200 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2016-07-18 19:50:48 +0200 |
commit | 2e4049036ec4d90a9daeff606d821d2ac2d023ce (patch) | |
tree | 214eb998546a0a7af02c6efbe3bd64c2f297cbd3 /helpers/mixer.py | |
parent | ccda4cb91686d4c2b70f0c26d21c26ac3d03c3b9 (diff) | |
download | MusicSampler-2e4049036ec4d90a9daeff606d821d2ac2d023ce.tar.gz MusicSampler-2e4049036ec4d90a9daeff606d821d2ac2d023ce.tar.zst MusicSampler-2e4049036ec4d90a9daeff606d821d2ac2d023ce.zip |
Coding styles
Diffstat (limited to 'helpers/mixer.py')
-rw-r--r-- | helpers/mixer.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/helpers/mixer.py b/helpers/mixer.py index d08520a..1d3f28f 100644 --- a/helpers/mixer.py +++ b/helpers/mixer.py | |||
@@ -5,6 +5,7 @@ import time | |||
5 | from . import Config | 5 | from . import Config |
6 | 6 | ||
7 | sample_width = Config.sample_width | 7 | sample_width = Config.sample_width |
8 | |||
8 | def sample_width_to_dtype(sample_width): | 9 | def sample_width_to_dtype(sample_width): |
9 | if sample_width == 1 or sample_width == 2 or sample_width == 4: | 10 | if sample_width == 1 or sample_width == 2 or sample_width == 4: |
10 | return 'int' + str(8*sample_width) | 11 | return 'int' + str(8*sample_width) |
@@ -19,13 +20,13 @@ def _latency(latency): | |||
19 | 20 | ||
20 | class Mixer: | 21 | class Mixer: |
21 | def __init__(self): | 22 | def __init__(self): |
22 | self.stream = sd.RawOutputStream(samplerate=Config.frame_rate, | 23 | self.stream = sd.RawOutputStream( |
23 | channels=Config.channels, | 24 | samplerate=Config.frame_rate, |
24 | dtype=sample_width_to_dtype(Config.sample_width), | 25 | channels=Config.channels, |
25 | latency=_latency(Config.latency), | 26 | dtype=sample_width_to_dtype(Config.sample_width), |
26 | blocksize=Config.blocksize, | 27 | latency=_latency(Config.latency), |
27 | callback=self.play_callback, | 28 | blocksize=Config.blocksize, |
28 | ) | 29 | callback=self.play_callback) |
29 | self.open_files = [] | 30 | self.open_files = [] |
30 | 31 | ||
31 | def add_file(self, music_file): | 32 | def add_file(self, music_file): |