mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Deactivated the audio device settings and added a new setting for custom scripts.
Also changed some other setting names.
This commit is contained in:
parent
d1f8c3e385
commit
9ba4f01a29
|
@ -8,12 +8,24 @@
|
|||
|
||||
#include "math/Misc.h"
|
||||
#include "Log.h"
|
||||
|
||||
#ifdef _RPI_
|
||||
#include "Settings.h"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#include <mmdeviceapi.h>
|
||||
#endif
|
||||
|
||||
// The ALSA Audio Card and Audio Device selection code is disabled at the moment.
|
||||
// As PulseAudio controls the sound devices for the desktop environment, it doesn't
|
||||
// make much sense to be able to select ALSA devices directly. Normally (always?)
|
||||
// the selection doesn't make any difference at all. But maybe some PulseAudio
|
||||
// settings could be added later on, if needed.
|
||||
// The code is still active for Raspberry Pi though as I'm not sure if this is
|
||||
// useful for that device.
|
||||
// Keeping mixerName and mixerCard at their default values should make sure that
|
||||
// the rest of the volume control code in here compiles and works fine.
|
||||
#if defined(__linux__)
|
||||
#if defined(_RPI_) || defined(_VERO4K_)
|
||||
const char * VolumeControl::mixerName = "PCM";
|
||||
|
@ -102,8 +114,10 @@ void VolumeControl::init()
|
|||
// Try to open mixer device.
|
||||
if (mixerHandle == nullptr) {
|
||||
// Allow user to override the AudioCard and AudioDevice in es_settings.cfg.
|
||||
#ifdef _RPI_
|
||||
mixerCard = Settings::getInstance()->getString("AudioCard").c_str();
|
||||
mixerName = Settings::getInstance()->getString("AudioDevice").c_str();
|
||||
#endif
|
||||
|
||||
snd_mixer_selem_id_alloca(&mixerSelemId);
|
||||
// Sets simple-mixer index and name.
|
||||
|
@ -312,8 +326,7 @@ int VolumeControl::getVolume() const
|
|||
float floatVolume = 0.0f; // 0-1
|
||||
if (endpointVolume->GetMasterVolumeLevelScalar(&floatVolume) == S_OK) {
|
||||
volume = (int)Math::round(floatVolume * 100.0f);
|
||||
LOG(LogInfo) << "System audio volume is " << volume <<
|
||||
" (floating point value " << floatVolume << ")";
|
||||
LOG(LogInfo) << "System audio volume is " << volume;
|
||||
}
|
||||
else {
|
||||
LOG(LogError) << "VolumeControl::getVolume() - Failed to get master volume!";
|
||||
|
|
|
@ -87,7 +87,15 @@ void GuiMenu::openSoundSettings()
|
|||
setVolume((int)Math::round(volume->getValue())); });
|
||||
|
||||
if (UIModeController::getInstance()->isUIModeFull()) {
|
||||
#if defined(__linux__)
|
||||
// The ALSA Audio Card and Audio Device selection code is disabled at the moment.
|
||||
// As PulseAudio controls the sound devices for the desktop environment, it doesn't
|
||||
// make much sense to be able to select ALSA devices directly. Normally (always?)
|
||||
// the selection doesn't make any difference at all. But maybe some PulseAudio
|
||||
// settings could be added later on, if needed.
|
||||
// The code is still active for Raspberry Pi though as I'm not sure if this is
|
||||
// useful for that device.
|
||||
// #if defined(__linux__)
|
||||
#ifdef _RPI_
|
||||
// audio card
|
||||
auto audio_card = std::make_shared<OptionListComponent<std::string>>
|
||||
(mWindow, getHelpStyle(), "AUDIO CARD", false);
|
||||
|
@ -173,24 +181,24 @@ void GuiMenu::openSoundSettings()
|
|||
// Video audio.
|
||||
auto video_audio = std::make_shared<SwitchComponent>(mWindow);
|
||||
video_audio->setState(Settings::getInstance()->getBool("VideoAudio"));
|
||||
s->addWithLabel("ENABLE AUDIO FOR VIDEO FILES", video_audio);
|
||||
s->addWithLabel("AUDIO FOR VIDEO FILES", video_audio);
|
||||
s->addSaveFunc([video_audio] { Settings::getInstance()->setBool("VideoAudio",
|
||||
video_audio->getState()); });
|
||||
|
||||
// Navigation sounds.
|
||||
auto navigationsounds_enabled = std::make_shared<SwitchComponent>(mWindow);
|
||||
navigationsounds_enabled->setState(Settings::getInstance()->
|
||||
getBool("EnableNavigationSounds"));
|
||||
s->addWithLabel("ENABLE NAVIGATION SOUNDS", navigationsounds_enabled);
|
||||
s->addSaveFunc([navigationsounds_enabled] {
|
||||
if (navigationsounds_enabled->getState() &&
|
||||
!Settings::getInstance()->getBool("EnableNavigationSounds") &&
|
||||
auto navigation_sounds = std::make_shared<SwitchComponent>(mWindow);
|
||||
navigation_sounds->setState(Settings::getInstance()->
|
||||
getBool("NavigationSounds"));
|
||||
s->addWithLabel("NAVIGATION SOUNDS", navigation_sounds);
|
||||
s->addSaveFunc([navigation_sounds] {
|
||||
if (navigation_sounds->getState() &&
|
||||
!Settings::getInstance()->getBool("NavigationSounds") &&
|
||||
PowerSaver::getMode() == PowerSaver::INSTANT) {
|
||||
Settings::getInstance()->setString("PowerSaverMode", "default");
|
||||
PowerSaver::init();
|
||||
}
|
||||
Settings::getInstance()->setBool("EnableNavigationSounds",
|
||||
navigationsounds_enabled->getState());
|
||||
Settings::getInstance()->setBool("NavigationSounds",
|
||||
navigation_sounds->getState());
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -353,7 +361,7 @@ void GuiMenu::openUISettings()
|
|||
// Enable filters (ForceDisableFilters).
|
||||
auto enable_filter = std::make_shared<SwitchComponent>(mWindow);
|
||||
enable_filter->setState(!Settings::getInstance()->getBool("ForceDisableFilters"));
|
||||
s->addWithLabel("ENABLE GAMELIST FILTERS", enable_filter);
|
||||
s->addWithLabel("GAMELIST FILTERS", enable_filter);
|
||||
s->addSaveFunc([enable_filter] {
|
||||
bool filter_is_enabled = !Settings::getInstance()->getBool("ForceDisableFilters");
|
||||
Settings::getInstance()->setBool("ForceDisableFilters", !enable_filter->getState());
|
||||
|
@ -382,13 +390,6 @@ void GuiMenu::openUISettings()
|
|||
Settings::getInstance()->setBool("MoveCarousel", move_carousel->getState());
|
||||
});
|
||||
|
||||
// Hide start menu in Kid Mode.
|
||||
auto disable_start = std::make_shared<SwitchComponent>(mWindow);
|
||||
disable_start->setState(Settings::getInstance()->getBool("DisableKidStartMenu"));
|
||||
s->addWithLabel("DISABLE START MENU IN KID MODE", disable_start);
|
||||
s->addSaveFunc([disable_start] { Settings::getInstance()->setBool("DisableKidStartMenu",
|
||||
disable_start->getState()); });
|
||||
|
||||
// Show help.
|
||||
auto show_help = std::make_shared<SwitchComponent>(mWindow);
|
||||
show_help->setState(Settings::getInstance()->getBool("ShowHelpPrompts"));
|
||||
|
@ -396,6 +397,13 @@ void GuiMenu::openUISettings()
|
|||
s->addSaveFunc([show_help] { Settings::getInstance()->setBool("ShowHelpPrompts",
|
||||
show_help->getState()); });
|
||||
|
||||
// Whether to show start menu in Kid Mode.
|
||||
auto show_kidstartmenu = std::make_shared<SwitchComponent>(mWindow);
|
||||
show_kidstartmenu->setState(Settings::getInstance()->getBool("ShowKidStartMenu"));
|
||||
s->addWithLabel("SHOW START MENU IN KID MODE", show_kidstartmenu);
|
||||
s->addSaveFunc([show_kidstartmenu] { Settings::getInstance()->setBool("ShowKidStartMenu",
|
||||
show_kidstartmenu->getState()); });
|
||||
|
||||
// Screensaver.
|
||||
ComponentListRow screensaver_row;
|
||||
screensaver_row.elements.clear();
|
||||
|
@ -453,7 +461,7 @@ void GuiMenu::openOtherSettings()
|
|||
"instant" && power_saver->getSelected() == "instant") {
|
||||
Settings::getInstance()->setString("TransitionStyle", "instant");
|
||||
Settings::getInstance()->setBool("MoveCarousel", false);
|
||||
Settings::getInstance()->setBool("EnableNavigationSounds", false);
|
||||
Settings::getInstance()->setBool("NavigationSounds", false);
|
||||
}
|
||||
Settings::getInstance()->setString("PowerSaverMode", power_saver->getSelected());
|
||||
PowerSaver::init();
|
||||
|
@ -499,10 +507,17 @@ void GuiMenu::openOtherSettings()
|
|||
// to disable this is intended primarily for testing purposes).
|
||||
auto launchcommand_override = std::make_shared<SwitchComponent>(mWindow);
|
||||
launchcommand_override->setState(Settings::getInstance()->getBool("LaunchCommandOverride"));
|
||||
s->addWithLabel("ENABLE PER GAME LAUNCH COMMAND OVERRIDE", launchcommand_override);
|
||||
s->addWithLabel("PER GAME LAUNCH COMMAND OVERRIDE", launchcommand_override);
|
||||
s->addSaveFunc([launchcommand_override] { Settings::getInstance()->
|
||||
setBool("LaunchCommandOverride", launchcommand_override->getState()); });
|
||||
|
||||
// Custom event scripts, fired using Scripting::fireEvent().
|
||||
auto custom_eventscripts = std::make_shared<SwitchComponent>(mWindow);
|
||||
custom_eventscripts->setState(Settings::getInstance()->getBool("CustomEventScripts"));
|
||||
s->addWithLabel("CUSTOM EVENT SCRIPTS", custom_eventscripts);
|
||||
s->addSaveFunc([custom_eventscripts] { Settings::getInstance()->
|
||||
setBool("CustomEventScripts", custom_eventscripts->getState()); });
|
||||
|
||||
auto parse_gamelists = std::make_shared<SwitchComponent>(mWindow);
|
||||
parse_gamelists->setState(Settings::getInstance()->getBool("ParseGamelistOnly"));
|
||||
s->addWithLabel("ONLY SHOW ROMS FROM GAMELIST.XML FILES", parse_gamelists);
|
||||
|
|
|
@ -246,8 +246,8 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
|||
}
|
||||
|
||||
// Resize it.
|
||||
if (!resizeImage(filePath, Settings::getInstance()->getInt("ScraperResizeWidth"),
|
||||
Settings::getInstance()->getInt("ScraperResizeHeight"))) {
|
||||
if (!resizeImage(filePath, Settings::getInstance()->getInt("ScraperResizeMaxWidth"),
|
||||
Settings::getInstance()->getInt("ScraperResizeMaxHeight"))) {
|
||||
setError("Error saving resized image. Out of memory? Disk full?");
|
||||
return;
|
||||
}
|
||||
|
@ -292,8 +292,8 @@ std::unique_ptr<ImageDownloadHandle> downloadImageAsync(const std::string& url,
|
|||
url,
|
||||
saveAs,
|
||||
existingMediaFile,
|
||||
Settings::getInstance()->getInt("ScraperResizeWidth"),
|
||||
Settings::getInstance()->getInt("ScraperResizeHeight")));
|
||||
Settings::getInstance()->getInt("ScraperResizeMaxWidth"),
|
||||
Settings::getInstance()->getInt("ScraperResizeMaxHeight")));
|
||||
}
|
||||
|
||||
ImageDownloadHandle::ImageDownloadHandle(
|
||||
|
|
|
@ -203,8 +203,8 @@ private:
|
|||
std::string getSaveAsPath(const ScraperSearchParams& params,
|
||||
const std::string& filetypeSubdirectory, const std::string& url);
|
||||
|
||||
// Will resize according to Settings::getInt("ScraperResizeWidth") and
|
||||
// Settings::getInt("ScraperResizeHeight").
|
||||
// Will resize according to Settings::getInt("ScraperResizeMaxWidth") and
|
||||
// Settings::getInt("ScraperResizeMaxHeight").
|
||||
std::unique_ptr<ImageDownloadHandle> downloadImageAsync(const std::string& url,
|
||||
const std::string& saveAs, const std::string& existingMediaPath);
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "resources/Font.h"
|
||||
#include "GuiComponent.h"
|
||||
#include "Sound.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class AnimatedImageComponent;
|
||||
|
|
|
@ -388,7 +388,7 @@ bool ViewController::input(InputConfig* config, Input input)
|
|||
|
||||
// Open menu.
|
||||
if (!(UIModeController::getInstance()->isUIModeKid() &&
|
||||
Settings::getInstance()->getBool("DisableKidStartMenu")) &&
|
||||
!Settings::getInstance()->getBool("ShowKidStartMenu")) &&
|
||||
config->isMappedTo("start", input) && input.value != 0) {
|
||||
// If we don't stop the scrolling here, it will continue to
|
||||
// run after closing the menu.
|
||||
|
@ -564,7 +564,7 @@ std::vector<HelpPrompt> ViewController::getHelpPrompts()
|
|||
|
||||
prompts = mCurrentView->getHelpPrompts();
|
||||
if (!(UIModeController::getInstance()->isUIModeKid() &&
|
||||
Settings::getInstance()->getBool("DisableKidStartMenu")))
|
||||
!Settings::getInstance()->getBool("ShowKidStartMenu")))
|
||||
prompts.push_back(HelpPrompt("start", "menu"));
|
||||
return prompts;
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ AudioManager::~AudioManager()
|
|||
std::shared_ptr<AudioManager> & AudioManager::getInstance()
|
||||
{
|
||||
// Check if an AudioManager instance is already created, if not create one.
|
||||
if (sInstance == nullptr && Settings::getInstance()->getBool("EnableNavigationSounds")) {
|
||||
if (sInstance == nullptr && Settings::getInstance()->getBool("NavigationSounds")) {
|
||||
sInstance = std::shared_ptr<AudioManager>(new AudioManager);
|
||||
}
|
||||
return sInstance;
|
||||
|
|
|
@ -11,14 +11,19 @@
|
|||
//
|
||||
|
||||
#include "Scripting.h"
|
||||
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "Log.h"
|
||||
#include "Platform.h"
|
||||
#include "utils/FileSystemUtil.h"
|
||||
#include "Settings.h"
|
||||
|
||||
namespace Scripting
|
||||
{
|
||||
void fireEvent(const std::string& eventName, const std::string& arg1, const std::string& arg2)
|
||||
{
|
||||
if (!Settings::getInstance()->getBool("CustomEventScripts"))
|
||||
return;
|
||||
|
||||
LOG(LogDebug) << "fireEvent: " << eventName << " " << arg1 << " " << arg2;
|
||||
|
||||
std::list<std::string> scriptDirList;
|
||||
|
|
|
@ -76,7 +76,7 @@ void Settings::setDefaults()
|
|||
|
||||
// UI settings.
|
||||
mStringMap["StartupSystem"] = "";
|
||||
mStringMap["GamelistViewStyle"] = "automatic";
|
||||
mStringMap["GamelistViewStyle"] = "detailed";
|
||||
mStringMap["TransitionStyle"] = "instant";
|
||||
mStringMap["ThemeSet"] = "";
|
||||
mStringMap["UIMode"] = "Full";
|
||||
|
@ -84,8 +84,8 @@ void Settings::setDefaults()
|
|||
mBoolMap["ForceDisableFilters"] = false;
|
||||
mBoolMap["QuickSystemSelect"] = true;
|
||||
mBoolMap["MoveCarousel"] = true;
|
||||
mBoolMap["DisableKidStartMenu"] = true;
|
||||
mBoolMap["ShowHelpPrompts"] = true;
|
||||
mBoolMap["ShowKidStartMenu"] = false;
|
||||
|
||||
// UI settings -> scrensaver settings.
|
||||
mIntMap["ScreenSaverTime"] = 5*60*1000; // 5 minutes
|
||||
|
@ -111,17 +111,26 @@ void Settings::setDefaults()
|
|||
mStringMap["SlideshowScreenSaverImageFilter"] = ".png,.jpg";
|
||||
|
||||
// Sound settings.
|
||||
// The ALSA Audio Card and Audio Device selection code is disabled at the moment.
|
||||
// As PulseAudio controls the sound devices for the desktop environment, it doesn't
|
||||
// make much sense to be able to select ALSA devices directly. Normally (always?)
|
||||
// the selection doesn't make any difference at all. But maybe some PulseAudio
|
||||
// settings could be added later on, if needed.
|
||||
// The code is still active for Raspberry Pi though as I'm not sure if this is
|
||||
// useful for that device.
|
||||
#ifdef _RPI_
|
||||
mStringMap["AudioCard"] = "default";
|
||||
// Audio out device for volume control.
|
||||
#ifdef _RPI_
|
||||
mStringMap["AudioDevice"] = "PCM";
|
||||
#else
|
||||
mStringMap["AudioDevice"] = "Master";
|
||||
#endif
|
||||
mBoolMap["VideoAudio"] = true;
|
||||
mBoolMap["EnableNavigationSounds"] = true;
|
||||
//#endif
|
||||
//#ifdef _RPI_
|
||||
mStringMap["AudioDevice"] = "PCM";
|
||||
// Audio out device for Video playback using OMX player.
|
||||
mStringMap["OMXAudioDev"] = "both";
|
||||
//#else
|
||||
// mStringMap["AudioDevice"] = "Master";
|
||||
#endif
|
||||
mBoolMap["VideoAudio"] = true;
|
||||
mBoolMap["NavigationSounds"] = true;
|
||||
|
||||
// Game collection settings.
|
||||
mStringMap["CollectionSystemsAuto"] = "";
|
||||
|
@ -138,7 +147,7 @@ void Settings::setDefaults()
|
|||
// mBoolMap["ScraperGenerateThumbnails"] = false;
|
||||
mBoolMap["ScraperInteractive"] = true;
|
||||
mBoolMap["ScraperSemiautomatic"] = true;
|
||||
mBoolMap["ScraperOverwriteData"] = false;
|
||||
mBoolMap["ScraperOverwriteData"] = true;
|
||||
mBoolMap["ScrapeMetadata"] = true;
|
||||
mBoolMap["ScrapeGameNames"] = true;
|
||||
mBoolMap["ScrapeRatings"] = true;
|
||||
|
@ -171,6 +180,7 @@ void Settings::setDefaults()
|
|||
#endif
|
||||
mStringMap["SaveGamelistsMode"] = "always";
|
||||
mBoolMap["LaunchCommandOverride"] = true;
|
||||
mBoolMap["CustomEventScripts"] = false;
|
||||
mBoolMap["ParseGamelistOnly"] = false;
|
||||
mBoolMap["LocalArt"] = false;
|
||||
mBoolMap["ShowHiddenFiles"] = false;
|
||||
|
@ -209,8 +219,8 @@ void Settings::setDefaults()
|
|||
mStringMap["DefaultSortOrder"] = "filename, ascending";
|
||||
mStringMap["MediaDirectory"] = "";
|
||||
mStringMap["ROMDirectory"] = "";
|
||||
mIntMap["ScraperResizeWidth"] = 600;
|
||||
mIntMap["ScraperResizeHeight"] = 0;
|
||||
mIntMap["ScraperResizeMaxWidth"] = 600;
|
||||
mIntMap["ScraperResizeMaxHeight"] = 0;
|
||||
|
||||
//
|
||||
// Hardcoded or program-internal settings.
|
||||
|
@ -275,7 +285,7 @@ void Settings::loadFile()
|
|||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_file(path.c_str());
|
||||
if (!result) {
|
||||
LOG(LogError) << "Could not parse Settings file!\n " << result.description();
|
||||
LOG(LogError) << "Error - Could not parse Settings file!\n " << result.description();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -295,7 +305,7 @@ void Settings::loadFile()
|
|||
type Settings::getMethodName(const std::string& name) \
|
||||
{ \
|
||||
if (mapName.find(name) == mapName.cend()) { \
|
||||
LOG(LogError) << "Tried to use unset setting " << name << "!"; \
|
||||
LOG(LogError) << "Error - Tried to use unset setting " << name << "!"; \
|
||||
} \
|
||||
return mapName[name]; \
|
||||
} \
|
||||
|
|
|
@ -164,7 +164,7 @@ void Sound::play()
|
|||
if(mSampleData == nullptr)
|
||||
return;
|
||||
|
||||
if(!Settings::getInstance()->getBool("EnableNavigationSounds"))
|
||||
if(!Settings::getInstance()->getBool("NavigationSounds"))
|
||||
return;
|
||||
|
||||
AudioManager::getInstance();
|
||||
|
|
Loading…
Reference in a new issue