Move DSP settings to dolphin.ini

This commit is contained in:
Rachel Bryk
2013-01-16 20:16:56 -05:00
parent 3cb4300439
commit 196c2867ad
15 changed files with 71 additions and 158 deletions

View File

@ -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" />

View File

@ -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" />

View File

@ -1,5 +1,4 @@
set(SRCS Src/AudioCommon.cpp
Src/AudioCommonConfig.cpp
Src/DPL2Decoder.cpp
Src/Mixer.cpp
Src/WaveFile.cpp

View File

@ -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);
}
}
}

View File

@ -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_

View File

@ -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);
}
}

View File

@ -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