Persistent audio mute support (#1161)

* Persistent speaker mute support #1100
* Moving persistent mute support from WM8731/AK4951 codec files to audio.cpp module for simplification
This commit is contained in:
Mark Thompson
2023-06-17 16:15:21 -05:00
committed by GitHub
parent 5743d3a3b9
commit ba2407d691
12 changed files with 159 additions and 80 deletions

View File

@@ -102,7 +102,6 @@ POCSAGAppView::POCSAGAppView(NavigationView& nav) {
logger->append(LOG_ROOT_DIR "/POCSAG.TXT");
audio::output::start();
audio::output::unmute();
baseband::set_pocsag();
}

View File

@@ -235,7 +235,6 @@ SetFrequencyCorrectionModel SetRadioView::form_collect() {
SetUIView::SetUIView(NavigationView& nav) {
add_children({&checkbox_disable_touchscreen,
&checkbox_speaker,
&checkbox_bloff,
&options_bloff,
&checkbox_showsplash,
@@ -246,7 +245,6 @@ SetUIView::SetUIView(NavigationView& nav) {
&button_cancel});
checkbox_disable_touchscreen.set_value(persistent_memory::disable_touchscreen());
checkbox_speaker.set_value(persistent_memory::config_speaker());
checkbox_showsplash.set_value(persistent_memory::config_splash());
checkbox_showclock.set_value(!persistent_memory::hide_clock());
checkbox_guireturnflag.set_value(persistent_memory::show_gui_return_icon());
@@ -272,11 +270,6 @@ SetUIView::SetUIView(NavigationView& nav) {
persistent_memory::set_clock_with_date(false);
}
if (checkbox_speaker.value()) audio::output::speaker_mute(); // Just mute audio if speaker is disabled
persistent_memory::set_config_speaker(checkbox_speaker.value()); // Store Speaker status
StatusRefreshMessage message{}; // Refresh status bar with/out speaker
EventDispatcher::send_message(message);
persistent_memory::set_config_splash(checkbox_showsplash.value());
persistent_memory::set_clock_hidden(!checkbox_showclock.value());
persistent_memory::set_gui_return_icon(checkbox_guireturnflag.value());
@@ -524,13 +517,16 @@ void SetPersistentMemoryView::focus() {
SetAudioView::SetAudioView(NavigationView& nav) {
add_children({&labels,
&field_tone_mix,
&checkbox_speaker_disable,
&button_save,
&button_cancel});
field_tone_mix.set_value(persistent_memory::tone_mix());
checkbox_speaker_disable.set_value(persistent_memory::config_speaker_disable());
button_save.on_select = [&nav, this](Button&) {
persistent_memory::set_tone_mix(field_tone_mix.value());
persistent_memory::set_config_speaker_disable(checkbox_speaker_disable.value());
nav.pop();
};

View File

@@ -212,17 +212,12 @@ class SetUIView : public View {
20,
"Disable touchscreen"};
Checkbox checkbox_speaker{
{3 * 8, 4 * 16},
20,
"Hide H1 Speaker option"};
Checkbox checkbox_bloff{
{3 * 8, 6 * 16},
{3 * 8, 4 * 16},
20,
"Backlight off after:"};
OptionsField options_bloff{
{52, 7 * 16 + 8},
{60, 5 * 16 + 8},
20,
{
{"5 seconds", backlight_timeout_t::Timeout5Sec},
@@ -236,25 +231,25 @@ class SetUIView : public View {
}};
Checkbox checkbox_showsplash{
{3 * 8, 9 * 16},
{3 * 8, 7 * 16},
20,
"Show splash"};
Checkbox checkbox_showclock{
{3 * 8, 11 * 16},
{3 * 8, 9 * 16},
20,
"Show clock with:"};
OptionsField options_clockformat{
{52, 12 * 16 + 8},
{60, 10 * 16 + 8},
20,
{{"time only", 0},
{"time and date", 1}}};
Checkbox checkbox_guireturnflag{
{3 * 8, 14 * 16},
{3 * 8, 12 * 16},
25,
"add return icon in GUI"};
"Show return icon in GUI"};
Button button_save{
{2 * 8, 16 * 16, 12 * 8, 32},
@@ -393,6 +388,11 @@ class SetAudioView : public View {
1,
'0'};
Checkbox checkbox_speaker_disable{
{2 * 8, 6 * 16},
25,
"Disable AK speaker amp"};
Button button_save{
{2 * 8, 16 * 16, 12 * 8, 32},
"Save"};

View File

@@ -117,7 +117,6 @@ SondeView::SondeView(NavigationView& nav) {
logger->append(LOG_ROOT_DIR "/SONDE.TXT");
audio::output::start();
audio::output::speaker_unmute();
// inject a PitchRSSIConfigureMessage in order to arm
// the pitch rssi events that will be used by the