diff options
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r-- | helpers/__init__.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py index da447d8..9d66638 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py | |||
@@ -17,12 +17,12 @@ def path(): | |||
17 | return path + "/../" | 17 | return path + "/../" |
18 | 18 | ||
19 | def parse_args(): | 19 | def parse_args(): |
20 | argv = sys.argv[1:] | 20 | argv = sys.argv[1 :] |
21 | sys.argv = sys.argv[:1] | 21 | sys.argv = sys.argv[: 1] |
22 | if "--" in argv: | 22 | if "--" in argv: |
23 | index = argv.index("--") | 23 | index = argv.index("--") |
24 | kivy_args = argv[index+1:] | 24 | kivy_args = argv[index+1 :] |
25 | argv = argv[:index] | 25 | argv = argv[: index] |
26 | 26 | ||
27 | sys.argv.extend(kivy_args) | 27 | sys.argv.extend(kivy_args) |
28 | 28 | ||
@@ -39,7 +39,8 @@ def parse_args(): | |||
39 | help="Print messages in console") | 39 | help="Print messages in console") |
40 | parser.add_argument("-m", "--builtin-mixing", | 40 | parser.add_argument("-m", "--builtin-mixing", |
41 | action="store_true", | 41 | action="store_true", |
42 | help="Make the mixing of sounds manually (do it if the system cannot handle it correctly)") | 42 | help="Make the mixing of sounds manually\ |
43 | (do it if the system cannot handle it correctly)") | ||
43 | parser.add_argument("-l", "--latency", | 44 | parser.add_argument("-l", "--latency", |
44 | default="high", | 45 | default="high", |
45 | required=False, | 46 | required=False, |
@@ -48,7 +49,8 @@ def parse_args(): | |||
48 | default=0, | 49 | default=0, |
49 | type=int, | 50 | type=int, |
50 | required=False, | 51 | required=False, |
51 | help="Blocksize: If not 0, the numbe of frames to take at each step for the mixer") | 52 | help="Blocksize: If not 0, the number of frames to take\ |
53 | at each step for the mixer") | ||
52 | parser.add_argument("-f", "--frame-rate", | 54 | parser.add_argument("-f", "--frame-rate", |
53 | default=44100, | 55 | default=44100, |
54 | type=int, | 56 | type=int, |
@@ -66,7 +68,8 @@ def parse_args(): | |||
66 | help="Sample width (number of bytes for each frame)") | 68 | help="Sample width (number of bytes for each frame)") |
67 | parser.add_argument("-V", "--version", | 69 | parser.add_argument("-V", "--version", |
68 | action="version", | 70 | action="version", |
69 | help="Displays the current version and exits. Only use in bundled package", | 71 | help="Displays the current version and exits. Only use\ |
72 | in bundled package", | ||
70 | version=show_version()) | 73 | version=show_version()) |
71 | parser.add_argument("--device", | 74 | parser.add_argument("--device", |
72 | action=SelectDeviceAction, | 75 | action=SelectDeviceAction, |
@@ -79,7 +82,8 @@ def parse_args(): | |||
79 | ) | 82 | ) |
80 | parser.add_argument('--', | 83 | parser.add_argument('--', |
81 | dest="args", | 84 | dest="args", |
82 | help="Kivy arguments. All arguments after this are interpreted by Kivy. Pass \"-- --help\" to get Kivy's usage.") | 85 | help="Kivy arguments. All arguments after this are interpreted\ |
86 | by Kivy. Pass \"-- --help\" to get Kivy's usage.") | ||
83 | 87 | ||
84 | from kivy.logger import Logger | 88 | from kivy.logger import Logger |
85 | Logger.setLevel(logging.ERROR) | 89 | Logger.setLevel(logging.ERROR) |
@@ -125,11 +129,13 @@ def duration_to_min_sec(duration): | |||
125 | else: | 129 | else: |
126 | return "{}:{:0>2}".format(minutes, seconds) | 130 | return "{}:{:0>2}".format(minutes, seconds) |
127 | 131 | ||
128 | def gain(volume, old_volume = None): | 132 | def gain(volume, old_volume=None): |
129 | if old_volume is None: | 133 | if old_volume is None: |
130 | return 20 * math.log10(volume / 100) | 134 | return 20 * math.log10(volume / 100) |
131 | else: | 135 | else: |
132 | return [20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)), max(volume, 0)] | 136 | return [ |
137 | 20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)), | ||
138 | max(volume, 0)] | ||
133 | 139 | ||
134 | def debug_print(message): | 140 | def debug_print(message): |
135 | from kivy.logger import Logger | 141 | from kivy.logger import Logger |