SoundStream: Internally construct the mixer

Instead of creating the mixer externally and then passing it in, it can just be made within the class.
This commit is contained in:
Lioncash
2015-05-24 04:13:02 -04:00
parent a6e5fd1e27
commit 35ee8a1362
18 changed files with 40 additions and 123 deletions

View File

@ -32,38 +32,34 @@ namespace AudioCommon
SoundStream* InitSoundStream()
{
CMixer *mixer = new CMixer(48000);
// TODO: possible memleak with mixer
std::string backend = SConfig::GetInstance().sBackend;
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
g_sound_stream = new OpenALStream(mixer);
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
g_sound_stream = new NullSound(mixer);
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
g_sound_stream = new OpenALStream();
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
g_sound_stream = new NullSound();
else if (backend == BACKEND_XAUDIO2)
{
if (XAudio2::isValid())
g_sound_stream = new XAudio2(mixer);
g_sound_stream = new XAudio2();
else if (XAudio2_7::isValid())
g_sound_stream = new XAudio2_7(mixer);
g_sound_stream = new XAudio2_7();
}
else if (backend == BACKEND_AOSOUND && AOSound::isValid())
g_sound_stream = new AOSound(mixer);
else if (backend == BACKEND_ALSA && AlsaSound::isValid())
g_sound_stream = new AlsaSound(mixer);
else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
g_sound_stream = new CoreAudioSound(mixer);
else if (backend == BACKEND_PULSEAUDIO && PulseAudio::isValid())
g_sound_stream = new PulseAudio(mixer);
else if (backend == BACKEND_AOSOUND && AOSound::isValid())
g_sound_stream = new AOSound();
else if (backend == BACKEND_ALSA && AlsaSound::isValid())
g_sound_stream = new AlsaSound();
else if (backend == BACKEND_COREAUDIO && CoreAudioSound::isValid())
g_sound_stream = new CoreAudioSound();
else if (backend == BACKEND_PULSEAUDIO && PulseAudio::isValid())
g_sound_stream = new PulseAudio();
else if (backend == BACKEND_OPENSLES && OpenSLESStream::isValid())
g_sound_stream = new OpenSLESStream(mixer);
g_sound_stream = new OpenSLESStream();
if (!g_sound_stream && NullSound::isValid())
{
WARN_LOG(DSPHLE, "Could not initialize backend %s, using %s instead.",
backend.c_str(), BACKEND_NULLSOUND);
g_sound_stream = new NullSound(mixer);
g_sound_stream = new NullSound();
}
if (g_sound_stream)