mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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
This commit is contained in:
51
Source/Core/AudioCommon/Src/AudioCommon.cpp
Normal file
51
Source/Core/AudioCommon/Src/AudioCommon.cpp
Normal file
@ -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
|
Reference in New Issue
Block a user