zapit/audio_setup: add gui option for handling volume adjustment defaults

This commit is contained in:
martii
2013-06-21 10:39:46 +02:00
committed by Jacek Jendrzej
parent d7b496062c
commit 421da2c0cf
10 changed files with 106 additions and 9 deletions

View File

@@ -45,6 +45,7 @@
#include <driver/screen_max.h>
#include <audio.h>
#include <zapit/zapit.h>
#include <system/debug.h>
@@ -64,8 +65,14 @@ CAudioSetup::~CAudioSetup()
}
int CAudioSetup::exec(CMenuTarget* parent, const std::string &/*actionKey*/)
int CAudioSetup::exec(CMenuTarget* parent, const std::string &actionKey)
{
if (actionKey == "clear_vol_map") {
CZapit::getInstance()->ClearVolumeMap();
CZapit::getInstance()->SetVolumePercent(g_settings.audio_volume_percent_ac3, g_settings.audio_volume_percent_pcm);
return menu_return::RETURN_NONE;
}
dprintf(DEBUG_DEBUG, "init audio setup\n");
int res = menu_return::RETURN_REPAINT;
@@ -184,6 +191,23 @@ int CAudioSetup::showAudioSetup()
CMenuOptionChooser * as_oj_srsonoff = new CMenuOptionChooser(LOCALE_AUDIO_SRS_IQ, &g_settings.srs_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, &truevolSetupNotifier);
as_oj_srsonoff->setHint("", LOCALE_MENU_HINT_AUDIO_SRS);
// ac3,pcm and clear volume adjustment
CMenuOptionNumberChooser *adj_ac3 = NULL, *adj_pcm = NULL;
CMenuForwarder *adj_clear = NULL;
if (!g_settings.easymenu) {
adj_ac3 = new CMenuOptionNumberChooser(LOCALE_AUDIOMENU_VOLUME_ADJUSTMENT_AC3,
(int *)&g_settings.audio_volume_percent_ac3, true, 0, 100, audioSetupNotifier);
adj_ac3->setNumberFormat("%d%%");
adj_ac3->setHint("", LOCALE_MENU_HINT_AUDIO_ADJUST_VOL_AC3);
adj_pcm = new CMenuOptionNumberChooser(LOCALE_AUDIOMENU_VOLUME_ADJUSTMENT_PCM,
(int *)&g_settings.audio_volume_percent_pcm, true, 0, 100, audioSetupNotifier);
adj_pcm->setNumberFormat("%d%%");
adj_pcm->setHint("", LOCALE_MENU_HINT_AUDIO_ADJUST_VOL_PCM);
adj_clear = new CMenuForwarder(LOCALE_AUDIOMENU_VOLUME_ADJUSTMENT_CLEAR, true, NULL, this, "clear_vol_map");
adj_clear->setHint("", LOCALE_MENU_HINT_AUDIO_ADJUST_VOL_CLEAR);
}
//paint items
audioSettings->addIntroItems(LOCALE_MAINSETTINGS_AUDIO);
//---------------------------------------------------------
@@ -212,6 +236,12 @@ int CAudioSetup::showAudioSetup()
#if 0
audioSettings->addItem(mf);
#endif
if (!g_settings.easymenu) {
audioSettings->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_AUDIOMENU_VOLUME_ADJUSTMENT));
audioSettings->addItem(adj_ac3);
audioSettings->addItem(adj_pcm);
audioSettings->addItem(adj_clear);
}
int res = audioSettings->exec(NULL, "");
selected = audioSettings->getSelected();
@@ -219,6 +249,9 @@ int CAudioSetup::showAudioSetup()
#ifdef BOXMODEL_APOLLO
delete as_oj_noise;
#endif
if (!g_settings.easymenu)
CZapit::getInstance()->SetVolumePercent(g_settings.audio_volume_percent_ac3, g_settings.audio_volume_percent_pcm);
return res;
}