Skip to content
Snippets Groups Projects
Commit ae922638 authored by moon2's avatar moon2 :speech_balloon:
Browse files

audio config: add speaker eq on/off setting

parent 581949a5
No related branches found
No related tags found
No related merge requests found
......@@ -21,7 +21,7 @@ class App(Application):
self.angle = 0
self.focused_widget = 1
self.active = False
self.num_widgets = 11
self.num_widgets = 12
self.overhang = -70
self.line_height = 24
self.input.buttons.app.left.repeat_enable(800, 300)
......@@ -131,6 +131,19 @@ class App(Application):
ctx.text(str(no)[:4] + unit)
return ret
def draw_boolean(self, label, value, on_str="on", off_str="off"):
ctx = self.ctx
self.draw_widget(label)
if self.widget_no == self.focused_widget and self.active:
value = not value
self.active = False
if value:
ctx.text(on_str)
else:
ctx.text(off_str)
return value
def draw_bg(self):
ctx = self.ctx
ctx.gray(1.0)
......@@ -264,6 +277,11 @@ class App(Application):
audio.speaker_set_maximum_volume_dB(tmp)
settings.num_speaker_max_db.set_value(audio.speaker_get_maximum_volume_dB())
tmp = self.draw_boolean("speaker eq", settings.onoff_speaker_eq_on.value)
if settings.onoff_speaker_eq_on.value != tmp:
audio.speaker_set_eq_on(tmp)
settings.onoff_speaker_eq_on.set_value(tmp)
self.delta_ms = 0
self.select_pressed = False
self.left_pressed = False
......
......@@ -231,15 +231,17 @@ num_headphones_min_db = StringTunable(
"Min Headphone Volume dB", "system.audio.headphones_min_dB", -45
)
num_speaker_min_db = StringTunable(
"Min Speaker Volume dB", "system.audio.speakers_min_dB", -40
"Min Speaker Volume dB", "system.audio.speaker_min_dB", -40
)
num_headphones_max_db = StringTunable(
"Max Headphone Volume dB", "system.audio.headphones_max_dB", 3
)
num_speaker_max_db = StringTunable(
"Max Speaker Volume dB", "system.audio.speakers_max_dB", 14
"Max Speaker Volume dB", "system.audio.speaker_max_dB", 14
)
onoff_speaker_eq_on = StringTunable("Speaker EQ On", "system.audio.speaker_eq_on", True)
num_display_brightness = StringTunable(
"Display Brightness", "system.appearance.display_brightness", 100
)
......@@ -275,6 +277,7 @@ load_save_settings: List[UnaryTunable] = [
num_speaker_min_db,
num_headphones_max_db,
num_speaker_max_db,
onoff_speaker_eq_on,
num_display_brightness,
num_leds_brightness,
num_leds_speed,
......
......@@ -40,6 +40,10 @@ def speaker_set_maximum_volume_dB(v: float) -> None:
pass
def speaker_set_eq_on(enable: bool) -> None:
pass
def adjust_volume_dB(v) -> float:
global _volume
_volume += v
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment