Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move DSP settings to dolphin.ini
  • Loading branch information
RachelBryk committed Jan 17, 2013
1 parent 3cb4300 commit 196c286
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 158 deletions.
2 changes: 0 additions & 2 deletions Source/Core/AudioCommon/AudioCommon.vcxproj
Expand Up @@ -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" />
Expand All @@ -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" />
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/AudioCommon/AudioCommon.vcxproj.filters
Expand Up @@ -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">
Expand All @@ -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" />
Expand Down
1 change: 0 additions & 1 deletion Source/Core/AudioCommon/CMakeLists.txt
@@ -1,5 +1,4 @@
set(SRCS Src/AudioCommon.cpp
Src/AudioCommonConfig.cpp
Src/DPL2Decoder.cpp
Src/Mixer.cpp
Src/WaveFile.cpp
Expand Down
22 changes: 17 additions & 5 deletions Source/Core/AudioCommon/Src/AudioCommon.cpp
Expand Up @@ -27,14 +27,18 @@
#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
{
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
{
// 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())
Expand All @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -122,7 +126,7 @@ namespace AudioCommon
{
return true;
}
return ac_Config.m_EnableJIT;
return SConfig::GetInstance().m_EnableJIT;
}

void PauseAndLock(bool doLock, bool unpauseOnUnlock)
Expand All @@ -143,4 +147,12 @@ namespace AudioCommon
}
}
}
void UpdateSoundStream()
{
if (soundStream)
{
soundStream->GetMixer()->SetThrottle(SConfig::GetInstance().m_Framelimit == 2);
soundStream->SetVolume(SConfig::GetInstance().m_Volume);
}
}
}
3 changes: 1 addition & 2 deletions Source/Core/AudioCommon/Src/AudioCommon.h
Expand Up @@ -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
Expand Down Expand Up @@ -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_
68 changes: 0 additions & 68 deletions Source/Core/AudioCommon/Src/AudioCommonConfig.cpp

This file was deleted.

51 changes: 0 additions & 51 deletions Source/Core/AudioCommon/Src/AudioCommonConfig.h

This file was deleted.

1 change: 0 additions & 1 deletion Source/Core/Common/Src/CommonPaths.h
Expand Up @@ -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"

Expand Down
1 change: 0 additions & 1 deletion Source/Core/Common/Src/FileUtil.cpp
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion Source/Core/Common/Src/FileUtil.h
Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions Source/Core/Core/Src/ConfigManager.cpp
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand Down
16 changes: 16 additions & 0 deletions Source/Core/Core/Src/ConfigManager.h
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/Core/Src/DSPEmulator.cpp
Expand Up @@ -22,8 +22,6 @@

DSPEmulator *CreateDSPEmulator(bool HLE)
{
ac_Config.Load();

if (HLE)
{
return new DSPHLE();
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp
Expand Up @@ -26,6 +26,7 @@
#include "DSPHLE.h"
#include "UCodes/UCodes.h"
#include "../AudioInterface.h"
#include "ConfigManager.h"

DSPHLE::DSPHLE() {
m_InitMixer = false;
Expand Down

0 comments on commit 196c286

Please sign in to comment.