Move DSP settings to dolphin.ini
This commit is contained in:
parent
3cb4300439
commit
196c2867ad
|
@ -191,7 +191,6 @@
|
|||
<ClCompile Include="Src\aldlist.cpp" />
|
||||
<ClCompile Include="Src\AOSoundStream.cpp" />
|
||||
<ClCompile Include="Src\AudioCommon.cpp" />
|
||||
<ClCompile Include="Src\AudioCommonConfig.cpp" />
|
||||
<ClCompile Include="Src\DPL2Decoder.cpp" />
|
||||
<ClCompile Include="Src\DSoundStream.cpp" />
|
||||
<ClCompile Include="Src\Mixer.cpp" />
|
||||
|
@ -204,7 +203,6 @@
|
|||
<ClInclude Include="Src\aldlist.h" />
|
||||
<ClInclude Include="Src\AOSoundStream.h" />
|
||||
<ClInclude Include="Src\AudioCommon.h" />
|
||||
<ClInclude Include="Src\AudioCommonConfig.h" />
|
||||
<ClInclude Include="Src\DPL2Decoder.h" />
|
||||
<ClInclude Include="Src\DSoundStream.h" />
|
||||
<ClInclude Include="Src\Mixer.h" />
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="Src\aldlist.cpp" />
|
||||
<ClCompile Include="Src\AudioCommon.cpp" />
|
||||
<ClCompile Include="Src\AudioCommonConfig.cpp" />
|
||||
<ClCompile Include="Src\Mixer.cpp" />
|
||||
<ClCompile Include="Src\WaveFile.cpp" />
|
||||
<ClCompile Include="Src\AOSoundStream.cpp">
|
||||
|
@ -26,7 +25,6 @@
|
|||
<ItemGroup>
|
||||
<ClInclude Include="Src\aldlist.h" />
|
||||
<ClInclude Include="Src\AudioCommon.h" />
|
||||
<ClInclude Include="Src\AudioCommonConfig.h" />
|
||||
<ClInclude Include="Src\Mixer.h" />
|
||||
<ClInclude Include="Src\SoundStream.h" />
|
||||
<ClInclude Include="Src\WaveFile.h" />
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
set(SRCS Src/AudioCommon.cpp
|
||||
Src/AudioCommonConfig.cpp
|
||||
Src/DPL2Decoder.cpp
|
||||
Src/Mixer.cpp
|
||||
Src/WaveFile.cpp
|
||||
|
|
|
@ -27,6 +27,10 @@
|
|||
#include "OpenALStream.h"
|
||||
#include "PulseAudioStream.h"
|
||||
#include "../../Core/Src/Movie.h"
|
||||
#include "../../Core/Src/ConfigManager.h"
|
||||
|
||||
// This shouldn't be a global, at least not here.
|
||||
SoundStream *soundStream;
|
||||
|
||||
namespace AudioCommon
|
||||
{
|
||||
|
@ -34,7 +38,7 @@ namespace AudioCommon
|
|||
{
|
||||
// TODO: possible memleak with mixer
|
||||
|
||||
std::string backend = ac_Config.sBackend;
|
||||
std::string backend = SConfig::GetInstance().sBackend;
|
||||
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
|
||||
soundStream = new OpenALStream(mixer);
|
||||
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
|
||||
|
@ -54,10 +58,10 @@ namespace AudioCommon
|
|||
|
||||
if (soundStream != NULL)
|
||||
{
|
||||
ac_Config.Update();
|
||||
UpdateSoundStream();
|
||||
if (soundStream->Start())
|
||||
{
|
||||
if (ac_Config.m_DumpAudio)
|
||||
if (SConfig::GetInstance().m_DumpAudio)
|
||||
{
|
||||
std::string audio_file_name = File::GetUserPath(D_DUMPAUDIO_IDX) + "audiodump.wav";
|
||||
File::CreateFullPath(audio_file_name);
|
||||
|
@ -82,7 +86,7 @@ namespace AudioCommon
|
|||
if (soundStream)
|
||||
{
|
||||
soundStream->Stop();
|
||||
if (ac_Config.m_DumpAudio)
|
||||
if (SConfig::GetInstance().m_DumpAudio)
|
||||
soundStream->GetMixer()->StopLogAudio();
|
||||
//soundStream->StopLogAudio();
|
||||
delete soundStream;
|
||||
|
@ -122,7 +126,7 @@ namespace AudioCommon
|
|||
{
|
||||
return true;
|
||||
}
|
||||
return ac_Config.m_EnableJIT;
|
||||
return SConfig::GetInstance().m_EnableJIT;
|
||||
}
|
||||
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock)
|
||||
|
@ -143,4 +147,12 @@ namespace AudioCommon
|
|||
}
|
||||
}
|
||||
}
|
||||
void UpdateSoundStream()
|
||||
{
|
||||
if (soundStream)
|
||||
{
|
||||
soundStream->GetMixer()->SetThrottle(SConfig::GetInstance().m_Framelimit == 2);
|
||||
soundStream->SetVolume(SConfig::GetInstance().m_Volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,14 +19,12 @@
|
|||
#define _AUDIO_COMMON_H_
|
||||
|
||||
#include "Common.h"
|
||||
#include "AudioCommonConfig.h"
|
||||
#include "SoundStream.h"
|
||||
|
||||
|
||||
class CMixer;
|
||||
|
||||
extern SoundStream *soundStream;
|
||||
extern AudioCommonConfig ac_Config;
|
||||
|
||||
// UDSPControl
|
||||
union UDSPControl
|
||||
|
@ -60,6 +58,7 @@ namespace AudioCommon
|
|||
std::vector<std::string> GetSoundBackends();
|
||||
bool UseJIT();
|
||||
void PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
|
||||
void UpdateSoundStream();
|
||||
}
|
||||
|
||||
#endif // _AUDIO_COMMON_H_
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "AudioCommon.h"
|
||||
#include "CommonPaths.h"
|
||||
#include "FileUtil.h"
|
||||
#include "../../Core/Src/ConfigManager.h"
|
||||
|
||||
AudioCommonConfig ac_Config;
|
||||
|
||||
// This shouldn't be a global, at least not here.
|
||||
SoundStream *soundStream;
|
||||
|
||||
// Load from given file
|
||||
void AudioCommonConfig::Load()
|
||||
{
|
||||
IniFile file;
|
||||
file.Load(File::GetUserPath(F_DSPCONFIG_IDX));
|
||||
|
||||
file.Get("Config", "EnableJIT", &m_EnableJIT, true);
|
||||
file.Get("Config", "DumpAudio", &m_DumpAudio, false);
|
||||
#if defined __linux__ && HAVE_ALSA
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_ALSA);
|
||||
#elif defined __APPLE__
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_COREAUDIO);
|
||||
#elif defined _WIN32
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND);
|
||||
#else
|
||||
file.Get("Config", "Backend", &sBackend, BACKEND_NULLSOUND);
|
||||
#endif
|
||||
file.Get("Config", "Volume", &m_Volume, 100);
|
||||
}
|
||||
|
||||
// Set the values for the file
|
||||
void AudioCommonConfig::SaveSettings()
|
||||
{
|
||||
IniFile file;
|
||||
file.Load(File::GetUserPath(F_DSPCONFIG_IDX));
|
||||
|
||||
file.Set("Config", "EnableJIT", m_EnableJIT);
|
||||
file.Set("Config", "DumpAudio", m_DumpAudio);
|
||||
file.Set("Config", "Backend", sBackend);
|
||||
file.Set("Config", "Volume", m_Volume);
|
||||
|
||||
file.Save(File::GetUserPath(F_DSPCONFIG_IDX));
|
||||
}
|
||||
|
||||
// Update according to the values (stream/mixer)
|
||||
void AudioCommonConfig::Update() {
|
||||
if (soundStream) {
|
||||
soundStream->GetMixer()->SetThrottle(SConfig::GetInstance().m_Framelimit == 2);
|
||||
soundStream->SetVolume(m_Volume);
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _AUDIO_COMMON_CONFIG_H_
|
||||
#define _AUDIO_COMMON_CONFIG_H_
|
||||
|
||||
#include <string>
|
||||
#include "IniFile.h"
|
||||
|
||||
// Backend Types
|
||||
#define BACKEND_NULLSOUND "No audio output"
|
||||
#define BACKEND_ALSA "ALSA"
|
||||
#define BACKEND_AOSOUND "AOSound"
|
||||
#define BACKEND_COREAUDIO "CoreAudio"
|
||||
#define BACKEND_DIRECTSOUND "DSound"
|
||||
#define BACKEND_OPENAL "OpenAL"
|
||||
#define BACKEND_PULSEAUDIO "Pulse"
|
||||
#define BACKEND_XAUDIO2 "XAudio2"
|
||||
|
||||
struct AudioCommonConfig
|
||||
{
|
||||
bool m_EnableJIT;
|
||||
bool m_DumpAudio;
|
||||
int m_Volume;
|
||||
std::string sBackend;
|
||||
|
||||
// Load from given file
|
||||
void Load();
|
||||
|
||||
// Self explanatory
|
||||
void SaveSettings();
|
||||
|
||||
// Update according to the values (stream/mixer)
|
||||
void Update();
|
||||
};
|
||||
|
||||
#endif //AUDIO_COMMON_CONFIG
|
|
@ -94,7 +94,6 @@
|
|||
// Filenames
|
||||
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
|
||||
#define DOLPHIN_CONFIG "Dolphin.ini"
|
||||
#define DSP_CONFIG "DSP.ini"
|
||||
#define DEBUGGER_CONFIG "Debugger.ini"
|
||||
#define LOGGER_CONFIG "Logger.ini"
|
||||
|
||||
|
|
|
@ -681,7 +681,6 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
|||
paths[D_THEMES_IDX] = paths[D_USER_IDX] + THEMES_DIR DIR_SEP;
|
||||
paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR DIR_SEP;
|
||||
paths[F_DOLPHINCONFIG_IDX] = paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
|
||||
paths[F_DSPCONFIG_IDX] = paths[D_CONFIG_IDX] + DSP_CONFIG;
|
||||
paths[F_DEBUGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + DEBUGGER_CONFIG;
|
||||
paths[F_LOGGERCONFIG_IDX] = paths[D_CONFIG_IDX] + LOGGER_CONFIG;
|
||||
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
||||
|
|
|
@ -52,7 +52,6 @@ enum {
|
|||
D_WIISYSCONF_IDX,
|
||||
D_THEMES_IDX,
|
||||
F_DOLPHINCONFIG_IDX,
|
||||
F_DSPCONFIG_IDX,
|
||||
F_DEBUGGERCONFIG_IDX,
|
||||
F_LOGGERCONFIG_IDX,
|
||||
F_MAINLOG_IDX,
|
||||
|
|
|
@ -256,6 +256,12 @@ void SConfig::SaveSettings()
|
|||
ini.Set("Movie", "PauseMovie", m_PauseMovie);
|
||||
ini.Set("Movie", "Author", m_strMovieAuthor);
|
||||
|
||||
// DSP
|
||||
ini.Set("DSP", "EnableJIT", m_EnableJIT);
|
||||
ini.Set("DSP", "DumpAudio", m_DumpAudio);
|
||||
ini.Set("DSP", "Backend", sBackend);
|
||||
ini.Set("DSP", "Volume", m_Volume);
|
||||
|
||||
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
|
||||
m_SYSCONF->Save();
|
||||
}
|
||||
|
@ -404,6 +410,20 @@ void SConfig::LoadSettings()
|
|||
// Movie
|
||||
ini.Get("General", "PauseMovie", &m_PauseMovie, false);
|
||||
ini.Get("Movie", "Author", &m_strMovieAuthor, "");
|
||||
|
||||
// DSP
|
||||
ini.Get("Config", "EnableJIT", &m_EnableJIT, true);
|
||||
ini.Get("Config", "DumpAudio", &m_DumpAudio, false);
|
||||
#if defined __linux__ && HAVE_ALSA
|
||||
ini.Get("Config", "Backend", &sBackend, BACKEND_ALSA);
|
||||
#elif defined __APPLE__
|
||||
ini.Get("Config", "Backend", &sBackend, BACKEND_COREAUDIO);
|
||||
#elif defined _WIN32
|
||||
ini.Get("Config", "Backend", &sBackend, BACKEND_DIRECTSOUND);
|
||||
#else
|
||||
ini.Get("Config", "Backend", &sBackend, BACKEND_NULLSOUND);
|
||||
#endif
|
||||
ini.Get("Config", "Volume", &m_Volume, 100);
|
||||
}
|
||||
|
||||
m_SYSCONF = new SysConf();
|
||||
|
|
|
@ -26,6 +26,16 @@
|
|||
#include "HW/SI_Device.h"
|
||||
#include "SysConf.h"
|
||||
|
||||
// DSP Backend Types
|
||||
#define BACKEND_NULLSOUND "No audio output"
|
||||
#define BACKEND_ALSA "ALSA"
|
||||
#define BACKEND_AOSOUND "AOSound"
|
||||
#define BACKEND_COREAUDIO "CoreAudio"
|
||||
#define BACKEND_DIRECTSOUND "DSound"
|
||||
#define BACKEND_OPENAL "OpenAL"
|
||||
#define BACKEND_PULSEAUDIO "Pulse"
|
||||
#define BACKEND_XAUDIO2 "XAudio2"
|
||||
|
||||
struct SConfig : NonCopyable
|
||||
{
|
||||
// Wii Devices
|
||||
|
@ -83,6 +93,12 @@ struct SConfig : NonCopyable
|
|||
bool m_ShowLag;
|
||||
std::string m_strMovieAuthor;
|
||||
|
||||
// DSP settings
|
||||
bool m_EnableJIT;
|
||||
bool m_DumpAudio;
|
||||
int m_Volume;
|
||||
std::string sBackend;
|
||||
|
||||
SysConf* m_SYSCONF;
|
||||
|
||||
// save settings
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
DSPEmulator *CreateDSPEmulator(bool HLE)
|
||||
{
|
||||
ac_Config.Load();
|
||||
|
||||
if (HLE)
|
||||
{
|
||||
return new DSPHLE();
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "DSPHLE.h"
|
||||
#include "UCodes/UCodes.h"
|
||||
#include "../AudioInterface.h"
|
||||
#include "ConfigManager.h"
|
||||
|
||||
DSPHLE::DSPHLE() {
|
||||
m_InitMixer = false;
|
||||
|
|
|
@ -321,9 +321,6 @@ void CConfigMain::InitializeGUIValues()
|
|||
{
|
||||
const SCoreStartupParameter& startup_params = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
// Load DSP Settings.
|
||||
ac_Config.Load();
|
||||
|
||||
// General - Basic
|
||||
CPUThread->SetValue(startup_params.bCPUThread);
|
||||
SkipIdle->SetValue(startup_params.bSkipIdle);
|
||||
|
@ -354,17 +351,17 @@ void CConfigMain::InitializeGUIValues()
|
|||
if (startup_params.bDSPHLE)
|
||||
DSPEngine->SetSelection(0);
|
||||
else
|
||||
DSPEngine->SetSelection(ac_Config.m_EnableJIT ? 1 : 2);
|
||||
DSPEngine->SetSelection(SConfig::GetInstance().m_EnableJIT ? 1 : 2);
|
||||
|
||||
// Audio
|
||||
VolumeSlider->Enable(SupportsVolumeChanges(ac_Config.sBackend));
|
||||
VolumeSlider->SetValue(ac_Config.m_Volume);
|
||||
VolumeText->SetLabel(wxString::Format(wxT("%d %%"), ac_Config.m_Volume));
|
||||
VolumeSlider->Enable(SupportsVolumeChanges(SConfig::GetInstance().sBackend));
|
||||
VolumeSlider->SetValue(SConfig::GetInstance().m_Volume);
|
||||
VolumeText->SetLabel(wxString::Format(wxT("%d %%"), SConfig::GetInstance().m_Volume));
|
||||
DSPThread->SetValue(startup_params.bDSPThread);
|
||||
DumpAudio->SetValue(ac_Config.m_DumpAudio ? true : false);
|
||||
DPL2Decoder->Enable(std::string(ac_Config.sBackend) == BACKEND_OPENAL);
|
||||
DumpAudio->SetValue(SConfig::GetInstance().m_DumpAudio ? true : false);
|
||||
DPL2Decoder->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL);
|
||||
DPL2Decoder->SetValue(startup_params.bDPL2Decoder);
|
||||
Latency->Enable(std::string(ac_Config.sBackend) == BACKEND_OPENAL);
|
||||
Latency->Enable(std::string(SConfig::GetInstance().sBackend) == BACKEND_OPENAL);
|
||||
Latency->SetValue(startup_params.iLatency);
|
||||
// add backends to the list
|
||||
AddAudioBackends();
|
||||
|
@ -858,9 +855,6 @@ void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event))
|
|||
|
||||
// Save the config. Dolphin crashes to often to save the settings on closing only
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
|
||||
// Save Audio settings
|
||||
ac_Config.SaveSettings();
|
||||
}
|
||||
|
||||
// Core settings
|
||||
|
@ -880,7 +874,7 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event)
|
|||
break;
|
||||
case ID_FRAMELIMIT:
|
||||
SConfig::GetInstance().m_Framelimit = Framelimit->GetSelection();
|
||||
ac_Config.Update();
|
||||
AudioCommon::UpdateSoundStream();
|
||||
break;
|
||||
case ID_FRAMELIMIT_USEFPSFORLIMITING:
|
||||
SConfig::GetInstance().b_UseFPS = UseFPSForLimiting->IsChecked();
|
||||
|
@ -938,13 +932,13 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
|
|||
case ID_DSPENGINE:
|
||||
SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = DSPEngine->GetSelection() == 0;
|
||||
if (!DSPEngine->GetSelection() == 0)
|
||||
ac_Config.m_EnableJIT = DSPEngine->GetSelection() == 1;
|
||||
ac_Config.Update();
|
||||
SConfig::GetInstance().m_EnableJIT = DSPEngine->GetSelection() == 1;
|
||||
AudioCommon::UpdateSoundStream();
|
||||
break;
|
||||
|
||||
case ID_VOLUME:
|
||||
ac_Config.m_Volume = VolumeSlider->GetValue();
|
||||
ac_Config.Update();
|
||||
SConfig::GetInstance().m_Volume = VolumeSlider->GetValue();
|
||||
AudioCommon::UpdateSoundStream();
|
||||
VolumeText->SetLabel(wxString::Format(wxT("%d %%"), VolumeSlider->GetValue()));
|
||||
break;
|
||||
|
||||
|
@ -960,8 +954,8 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
|
|||
VolumeSlider->Enable(SupportsVolumeChanges(std::string(BackendSelection->GetStringSelection().mb_str())));
|
||||
Latency->Enable(std::string(BackendSelection->GetStringSelection().mb_str()) == BACKEND_OPENAL);
|
||||
DPL2Decoder->Enable(std::string(BackendSelection->GetStringSelection().mb_str()) == BACKEND_OPENAL);
|
||||
ac_Config.sBackend = BackendSelection->GetStringSelection().mb_str();
|
||||
ac_Config.Update();
|
||||
SConfig::GetInstance().sBackend = BackendSelection->GetStringSelection().mb_str();
|
||||
AudioCommon::UpdateSoundStream();
|
||||
break;
|
||||
|
||||
case ID_LATENCY:
|
||||
|
@ -969,7 +963,7 @@ void CConfigMain::AudioSettingsChanged(wxCommandEvent& event)
|
|||
break;
|
||||
|
||||
default:
|
||||
ac_Config.m_DumpAudio = DumpAudio->GetValue();
|
||||
SConfig::GetInstance().m_DumpAudio = DumpAudio->GetValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -983,7 +977,7 @@ void CConfigMain::AddAudioBackends()
|
|||
{
|
||||
BackendSelection->Append(wxString::FromAscii((*iter).c_str()));
|
||||
int num = BackendSelection->\
|
||||
FindString(wxString::FromAscii(ac_Config.sBackend.c_str()));
|
||||
FindString(wxString::FromAscii(SConfig::GetInstance().sBackend.c_str()));
|
||||
BackendSelection->SetSelection(num);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue