diff options
| author | nakeee <nakeee@gmail.com> | 2009-03-30 09:55:50 +0000 |
|---|---|---|
| committer | nakeee <nakeee@gmail.com> | 2009-03-30 09:55:50 +0000 |
| commit | 37d513c53bad6fe80b0120773da8be50248da3df (patch) | |
| tree | a649d8c6519fe9d4f8d88aa0f39dec5d985de0e8 /Source/Core/AudioCommon | |
| parent | 5987dbf7baaf19d8eed828b6a5555559a20766fe (diff) | |
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
Diffstat (limited to 'Source/Core/AudioCommon')
| -rw-r--r-- | Source/Core/AudioCommon/AudioCommon.vcproj | 8 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/AudioCommon.cpp | 17 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/AudioCommon.h | 11 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/AudioCommonConfig.cpp | 29 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/AudioCommonConfig.h | 29 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/Mixer.cpp | 5 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/Mixer.h | 2 | ||||
| -rw-r--r-- | Source/Core/AudioCommon/Src/SConscript | 7 |
8 files changed, 94 insertions, 14 deletions
diff --git a/Source/Core/AudioCommon/AudioCommon.vcproj b/Source/Core/AudioCommon/AudioCommon.vcproj index ee39204101..05d33b9aee 100644 --- a/Source/Core/AudioCommon/AudioCommon.vcproj +++ b/Source/Core/AudioCommon/AudioCommon.vcproj @@ -454,6 +454,14 @@ >
</File>
<File
+ RelativePath=".\Src\AudioCommonConfig.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Src\AudioCommonConfig.h"
+ >
+ </File>
+ <File
RelativePath=".\Src\Mixer.cpp"
>
</File>
diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp index 713d617e0f..8e25561a5d 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.cpp +++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp @@ -24,19 +24,28 @@ namespace AudioCommon
{
- SoundStream *InitSoundStream(std::string backend, CMixer *mixer)
+ SoundStream *InitSoundStream(CMixer *mixer)
{
if (!mixer)
mixer = new CMixer();
-
+ std::string backend = ac_Config.sBackend;
if (backend == BACKEND_DIRECTSOUND && DSound::isValid()) soundStream = new DSound(mixer, g_dspInitialize.hWnd);
if (backend == BACKEND_AOSOUND && AOSound::isValid()) soundStream = new AOSound(mixer);
if (backend == BACKEND_OPENAL && OpenALStream::isValid()) soundStream = new OpenALStream(mixer);
if (backend == BACKEND_NULL && NullSound::isValid()) soundStream = new NullSound(mixer);
if (soundStream != NULL) {
- if (soundStream->Start())
+ ac_Config.Update();
+ if (soundStream->Start()) {
+ // Start the sound recording
+ /*
+ if (ac_Config.record) {
+ soundStream->StartLogAudio(FULL_DUMP_DIR g_Config.recordFile);
+ }
+ */
+
return soundStream;
+ }
PanicAlert("Could not initialize backend %s, falling back to NULL", backend.c_str());
}
@@ -45,7 +54,7 @@ namespace AudioCommon delete soundStream;
soundStream = new NullSound(mixer);
soundStream->Start();
-
+
return NULL;
}
diff --git a/Source/Core/AudioCommon/Src/AudioCommon.h b/Source/Core/AudioCommon/Src/AudioCommon.h index 10451a8743..ba0a1a7e87 100644 --- a/Source/Core/AudioCommon/Src/AudioCommon.h +++ b/Source/Core/AudioCommon/Src/AudioCommon.h @@ -19,25 +19,22 @@ #define _AUDIO_COMMON_H_
#include "Common.h"
+#include "AudioCommonConfig.h"
#include "../../../PluginSpecs/pluginspecs_dsp.h"
#include "SoundStream.h"
+
class CMixer;
extern DSPInitialize g_dspInitialize;
extern SoundStream *soundStream;
+extern AudioCommonConfig ac_Config;
namespace AudioCommon
{
- SoundStream *InitSoundStream(std::string backend, CMixer *mixer = NULL);
+ SoundStream *InitSoundStream(CMixer *mixer = NULL);
void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends();
-
- // Backend Types
- #define BACKEND_DIRECTSOUND "DSound"
- #define BACKEND_AOSOUND "AOSound"
- #define BACKEND_OPENAL "OpenAL"
- #define BACKEND_NULL "NullSound"
}
#endif // _AUDIO_COMMON_H_
diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp new file mode 100644 index 0000000000..476918771e --- /dev/null +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.cpp @@ -0,0 +1,29 @@ +#include "AudioCommon.h" + +AudioCommonConfig ac_Config; + +// Load from given file +void AudioCommonConfig::Load(IniFile &file) { + file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true); + file.Get("Config", "EnableThrottle", &m_EnableThrottle, true); +#ifdef _WIN32 + file.Get("Config", "Backend", &sBackend, "DSound"); +#else + file.Get("Config", "Backend", &sBackend, "AOSound"); +#endif +} + +// Set the values for the file +void AudioCommonConfig::Set(IniFile &file) { + file.Set("Config", "EnableDTKMusic", m_EnableDTKMusic); + file.Set("Config", "EnableThrottle", m_EnableThrottle); + file.Set("Config", "Backend", sBackend.c_str()); +} + +// Update according to the values (stream/mixer) +void AudioCommonConfig::Update() { + if (soundStream) { + soundStream->GetMixer()->SetThrottle(m_EnableThrottle); + soundStream->GetMixer()->SetDTKMusic(m_EnableDTKMusic); + } +} diff --git a/Source/Core/AudioCommon/Src/AudioCommonConfig.h b/Source/Core/AudioCommon/Src/AudioCommonConfig.h new file mode 100644 index 0000000000..aeceed2486 --- /dev/null +++ b/Source/Core/AudioCommon/Src/AudioCommonConfig.h @@ -0,0 +1,29 @@ +#ifndef _AUDIO_COMMON_CONFIG_H_ +#define _AUDIO_COMMON_CONFIG_H_ + +#include <string> +#include "IniFile.h" + +// Backend Types +#define BACKEND_DIRECTSOUND "DSound" +#define BACKEND_AOSOUND "AOSound" +#define BACKEND_OPENAL "OpenAL" +#define BACKEND_NULL "NullSound" + +struct AudioCommonConfig +{ + bool m_EnableDTKMusic; + bool m_EnableThrottle; + std::string sBackend; + + // Load from given file + void Load(IniFile &file); + + // Set the values for the file + void Set(IniFile &file); + + // Update according to the values (stream/mixer) + void Update(); +}; + +#endif //AUDIO_COMMON_CONFIG diff --git a/Source/Core/AudioCommon/Src/Mixer.cpp b/Source/Core/AudioCommon/Src/Mixer.cpp index 3247e610a0..69bc4699fb 100644 --- a/Source/Core/AudioCommon/Src/Mixer.cpp +++ b/Source/Core/AudioCommon/Src/Mixer.cpp @@ -39,6 +39,11 @@ void CMixer::Mix(short *samples, int numSamples) return; } + // first get the DTK Music + if (m_EnableDTKMusic) { + g_dspInitialize.pGetAudioStreaming(samples, numSamples); + } + Premix(samples, numSamples); push_sync.Enter(); diff --git a/Source/Core/AudioCommon/Src/Mixer.h b/Source/Core/AudioCommon/Src/Mixer.h index 3d9c2cc31a..e2394da893 100644 --- a/Source/Core/AudioCommon/Src/Mixer.h +++ b/Source/Core/AudioCommon/Src/Mixer.h @@ -41,6 +41,7 @@ public: int GetSampleRate() {return m_sampleRate;} void SetThrottle(bool use) { m_throttle = use;} + void SetDTKMusic(bool use) { m_EnableDTKMusic = use;} // TODO: do we need this bool IsHLEReady() { return m_HLEready;} @@ -56,6 +57,7 @@ protected: bool m_HLEready; int m_queueSize; + bool m_EnableDTKMusic; bool m_throttle; private: Common::CriticalSection push_sync; diff --git a/Source/Core/AudioCommon/Src/SConscript b/Source/Core/AudioCommon/Src/SConscript index cfd1cbe6b7..2f64311a41 100644 --- a/Source/Core/AudioCommon/Src/SConscript +++ b/Source/Core/AudioCommon/Src/SConscript @@ -3,9 +3,10 @@ Import('env') files = [ - 'AOSoundStream.cpp', - 'OpenALStream.cpp', - 'WaveFile.cpp', + 'AOSoundStream.cpp', + 'AudioCommonConfig.cpp', + 'OpenALStream.cpp', + 'WaveFile.cpp', 'Mixer.cpp', 'AudioCommon.cpp', ] |
