Move mixer construction to AudioCommon.cpp.

This commit is contained in:
magumagu 2014-03-27 16:00:14 -07:00
parent aac4206664
commit 102ea55f20
4 changed files with 9 additions and 10 deletions

View File

@ -26,8 +26,13 @@ SoundStream *soundStream = nullptr;
namespace AudioCommon namespace AudioCommon
{ {
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd) SoundStream *InitSoundStream(void *hWnd)
{ {
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
CMixer *mixer = new CMixer(AISampleRate, DACSampleRate, 48000);
// TODO: possible memleak with mixer // TODO: possible memleak with mixer
std::string backend = SConfig::GetInstance().sBackend; std::string backend = SConfig::GetInstance().sBackend;

View File

@ -14,7 +14,7 @@ extern SoundStream *soundStream;
namespace AudioCommon namespace AudioCommon
{ {
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd); SoundStream *InitSoundStream(void *hWnd);
void ShutdownSoundStream(); void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends(); std::vector<std::string> GetSoundBackends();
bool UseJIT(); bool UseJIT();

View File

@ -262,10 +262,7 @@ void DSPHLE::DSP_WriteMailBoxLow(bool _CPUMailbox, unsigned short _Value)
void DSPHLE::InitMixer() void DSPHLE::InitMixer()
{ {
unsigned int AISampleRate, DACSampleRate; soundStream = AudioCommon::InitSoundStream(m_hWnd);
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
if (!soundStream) PanicAlert("Error starting up sound stream"); if (!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized // Mixer is initialized
m_InitMixer = true; m_InitMixer = true;

View File

@ -181,10 +181,7 @@ void DSPLLE::Shutdown()
void DSPLLE::InitMixer() void DSPLLE::InitMixer()
{ {
unsigned int AISampleRate, DACSampleRate; soundStream = AudioCommon::InitSoundStream(m_hWnd);
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
if (!soundStream) PanicAlert("Error starting up sound stream"); if (!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized // Mixer is initialized
m_InitMixer = true; m_InitMixer = true;