summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/Src/AudioCommon.cpp
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2009-03-26 09:29:14 +0000
committernakeee <nakeee@gmail.com>2009-03-26 09:29:14 +0000
commitfff663e8c714b60a4325bf420a8b0d49c126bd13 (patch)
treeb98c248c4e70e4129861531cd60d55865804acbd /Source/Core/AudioCommon/Src/AudioCommon.cpp
parentd7038fea173f79b26e432a2fb7b82c6d23cf88ce (diff)
Attempt to move mixer to audio common, it's a bit more complicated than I expected
so please check I didn't break anything in hle git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2756 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon/Src/AudioCommon.cpp')
-rw-r--r--Source/Core/AudioCommon/Src/AudioCommon.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/Source/Core/AudioCommon/Src/AudioCommon.cpp b/Source/Core/AudioCommon/Src/AudioCommon.cpp
new file mode 100644
index 0000000000..e8f60bc175
--- /dev/null
+++ b/Source/Core/AudioCommon/Src/AudioCommon.cpp
@@ -0,0 +1,51 @@
+#include "AudioCommon.h"
+#include "Mixer.h"
+#include "AOSoundStream.h"
+#include "DSoundStream.h"
+#include "NullSoundStream.h"
+
+
+namespace AudioCommon {
+
+SoundStream *InitSoundStream(std::string backend, CMixer *mixer) {
+
+ if (!mixer) {
+ mixer = new CMixer();
+ }
+
+ if (backend == "DSound") {
+ if (DSound::isValid())
+ soundStream = new DSound(mixer, g_dspInitialize.hWnd);
+ }
+ else if (backend == "AOSound") {
+ if (AOSound::isValid())
+ soundStream = new AOSound(mixer);
+ }
+ else if (backend == "NullSound") {
+ soundStream = new NullSound(mixer);
+ }
+ else {
+ PanicAlert("Cannot recognize backend %s", backend.c_str());
+ return NULL;
+ }
+
+ if (soundStream) {
+ if (!soundStream->Start()) {
+ PanicAlert("Could not initialize backend %s, falling back to NULL",
+ backend.c_str());
+ delete soundStream;
+ soundStream = new NullSound(mixer);
+ soundStream->Start();
+ }
+ }
+ else {
+ PanicAlert("Sound backend %s is not valid, falling back to NULL",
+ backend.c_str());
+ delete soundStream;
+ soundStream = new NullSound(mixer);
+ soundStream->Start();
+ }
+ return soundStream;
+}
+
+} // Namespace