Added dtk sound mixing to audiocommon (should work with LLE now)

And also moved all common setting to audiocommonconfig


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2796 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee
2009-03-30 09:55:50 +00:00
parent 5987dbf7ba
commit 37d513c53b
19 changed files with 133 additions and 69 deletions

View File

@ -18,6 +18,8 @@
#include "Common.h"
#include "IniFile.h"
#include "Config.h"
#include "AudioCommon.h"
#define LLE_CONFIG_FILE "DSPLLE.ini"
CConfig g_Config;
@ -34,20 +36,14 @@ void CConfig::Load()
IniFile file;
file.Load(FULL_CONFIG_DIR LLE_CONFIG_FILE);
file.Get("Config", "EnableThrottle", &m_EnableThrottle, true);
#ifdef _WIN32
file.Get("Config", "Backend", &sBackend, "DSound");
#else
file.Get("Config", "Backend", &sBackend, "AOSound");
#endif
ac_Config.Load(file);
}
void CConfig::Save()
{
IniFile file;
file.Load(FULL_CONFIG_DIR LLE_CONFIG_FILE);
file.Set("Config", "EnableThrottle", m_EnableThrottle);
file.Set("Config", "Backend", sBackend.c_str());
ac_Config.Set(file);
file.Save(FULL_CONFIG_DIR LLE_CONFIG_FILE);
}

View File

@ -21,12 +21,7 @@
#include <string>
struct CConfig
{
bool m_EnableHLEAudio;
bool m_EnableDTKMusic;
bool m_EnableThrottle;
std::string sBackend;
{
CConfig();
void Load();

View File

@ -21,6 +21,7 @@
BEGIN_EVENT_TABLE(DSPConfigDialogLLE, wxDialog)
EVT_BUTTON(wxID_OK, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_DTK_MUSIC, DSPConfigDialogLLE::SettingsChanged)
EVT_CHECKBOX(ID_ENABLE_THROTTLE, DSPConfigDialogLLE::SettingsChanged)
END_EVENT_TABLE()
@ -36,14 +37,17 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
m_OK = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
// Create items
m_buttonEnableDTKMusic = new wxCheckBox(this, ID_ENABLE_DTK_MUSIC, wxT("Enable DTK Music"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
m_buttonEnableThrottle = new wxCheckBox(this, ID_ENABLE_THROTTLE, wxT("Enable Other Audio (Throttle)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxStaticText *BackendText = new wxStaticText(this, wxID_ANY, wxT("Audio Backend"), wxDefaultPosition, wxDefaultSize, 0);
m_BackendSelection = new wxComboBox(this, ID_BACKEND, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxArrayBackends, wxCB_READONLY, wxDefaultValidator);
// Update values
m_buttonEnableThrottle->SetValue(g_Config.m_EnableThrottle ? true : false);
m_buttonEnableDTKMusic->SetValue(ac_Config.m_EnableDTKMusic ? true : false);
m_buttonEnableThrottle->SetValue(ac_Config.m_EnableThrottle ? true : false);
// Add tooltips
m_buttonEnableDTKMusic->SetToolTip(wxT("This is sometimes used to play music tracks from the disc"));
m_buttonEnableThrottle->SetToolTip(wxT("This is sometimes used together with pre-rendered movies.\n"
"Disabling this also disables the speed throttle which this causes,\n"
"meaning that there will be no upper limit on your FPS."));
@ -52,6 +56,7 @@ DSPConfigDialogLLE::DSPConfigDialogLLE(wxWindow *parent, wxWindowID id, const wx
// Create sizer and add items to dialog
wxBoxSizer *sMain = new wxBoxSizer(wxVERTICAL);
wxStaticBoxSizer *sbSettings = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Sound Settings"));
sbSettings->Add(m_buttonEnableDTKMusic, 0, wxALL, 5);
sbSettings->Add(m_buttonEnableThrottle, 0, wxALL, 5);
wxBoxSizer *sBackend = new wxBoxSizer(wxHORIZONTAL);
sBackend->Add(BackendText, 0, wxALIGN_CENTRE_VERTICAL|wxALL, 5);
@ -71,7 +76,7 @@ void DSPConfigDialogLLE::AddBackend(const char* backend)
{
m_BackendSelection->Append(wxString::FromAscii(backend));
// Update value
m_BackendSelection->SetValue(wxString::FromAscii(g_Config.sBackend.c_str()));
m_BackendSelection->SetValue(wxString::FromAscii(ac_Config.sBackend.c_str()));
}
DSPConfigDialogLLE::~DSPConfigDialogLLE()
@ -80,9 +85,12 @@ DSPConfigDialogLLE::~DSPConfigDialogLLE()
void DSPConfigDialogLLE::SettingsChanged(wxCommandEvent& event)
{
g_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
g_Config.sBackend = m_BackendSelection->GetValue().mb_str();
ac_Config.m_EnableDTKMusic = m_buttonEnableDTKMusic->GetValue();
ac_Config.m_EnableThrottle = m_buttonEnableThrottle->GetValue();
ac_Config.sBackend = m_BackendSelection->GetValue().mb_str();
ac_Config.Update();
g_Config.Save();
if (event.GetId() == wxID_OK)
EndModal(wxID_OK);

View File

@ -22,6 +22,7 @@
#include <wx/dialog.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include "AudioCommon.h"
class DSPConfigDialogLLE : public wxDialog
{
@ -39,6 +40,7 @@ private:
DECLARE_EVENT_TABLE();
wxButton *m_OK;
wxCheckBox *m_buttonEnableDTKMusic;
wxCheckBox *m_buttonEnableThrottle;
wxArrayString wxArrayBackends;
wxComboBox *m_BackendSelection;
@ -46,6 +48,7 @@ private:
enum
{
wxID_OK,
ID_ENABLE_DTK_MUSIC,
ID_ENABLE_THROTTLE,
ID_BACKEND
};

View File

@ -201,6 +201,7 @@ void Initialize(void *init)
bCanWork = true;
g_dspInitialize = *(DSPInitialize*)init;
g_Config.Load();
gdsp_init();
g_dsp.step_counter = 0;
g_dsp.cpu_ram = g_dspInitialize.pGetMemoryPointer(0);
@ -224,9 +225,7 @@ void Initialize(void *init)
g_hDSPThread = new Common::Thread(dsp_thread, NULL);
soundStream = AudioCommon::InitSoundStream(g_Config.sBackend);
soundStream->GetMixer()->SetThrottle(g_Config.m_EnableThrottle);
soundStream = AudioCommon::InitSoundStream();
}
void DSP_StopSoundStream()