Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Re-plumb window handle to the dsound backend.
Reverts parts of commit 71c01d83ab614b9e0c421d03ca694713dbabff48.
Fixes issue 6800
  • Loading branch information
shuffle2 committed Nov 7, 2013
1 parent ea2d8bf commit 33d56f5
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/Src/AudioCommon.cpp
Expand Up @@ -23,7 +23,7 @@ SoundStream *soundStream = nullptr;

namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer)
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
{
// TODO: possible memleak with mixer

Expand All @@ -33,7 +33,7 @@ namespace AudioCommon
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
soundStream = new NullSound(mixer);
else if (backend == BACKEND_DIRECTSOUND && DSound::isValid())
soundStream = new DSound(mixer);
soundStream = new DSound(mixer, hWnd);
else if (backend == BACKEND_XAUDIO2)
{
if (XAudio2::isValid())
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/Src/AudioCommon.h
Expand Up @@ -40,7 +40,7 @@ union UDSPControl

namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer);
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd);
void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends();
bool UseJIT();
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/Src/DSoundStream.h
Expand Up @@ -48,7 +48,7 @@ class DSound : public SoundStream
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);

public:
DSound(CMixer *mixer, void *_hWnd = NULL)
DSound(CMixer *mixer, void *_hWnd)
: SoundStream(mixer)
, bufferSize(0)
, currentPos(0)
Expand All @@ -71,7 +71,7 @@ class DSound : public SoundStream

#else
public:
DSound(CMixer *mixer)
DSound(CMixer *mixer, void *_hWnd)
: SoundStream(mixer)
{}
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/Src/Core.cpp
Expand Up @@ -388,8 +388,8 @@ void EmuThread()

OSD::AddMessage("Dolphin " + g_video_backend->GetName() + " Video Backend.", 5000);

if (!DSP::GetDSPEmulator()->Initialize(_CoreParameter.bWii,
_CoreParameter.bDSPThread))
if (!DSP::GetDSPEmulator()->Initialize(g_pWindowHandle,
_CoreParameter.bWii, _CoreParameter.bDSPThread))
{
HW::Shutdown();
g_video_backend->Shutdown();
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/Core/Src/DSPEmulator.h
Expand Up @@ -15,7 +15,7 @@ class DSPEmulator

virtual bool IsLLE() = 0;

virtual bool Initialize(bool bWii, bool bDSPThread) = 0;
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread) = 0;
virtual void Shutdown() = 0;

virtual void DoState(PointerWrap &p) = 0;
Expand All @@ -35,6 +35,7 @@ class DSPEmulator

protected:
SoundStream *soundStream;
void *m_hWnd;
};

DSPEmulator *CreateDSPEmulator(bool HLE);
Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp
Expand Up @@ -42,8 +42,9 @@ struct DSPState
}
};

bool DSPHLE::Initialize(bool bWii, bool bDSPThread)
bool DSPHLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
m_hWnd = hWnd;
m_bWii = bWii;
m_pUCode = NULL;
m_lastUCode = NULL;
Expand Down Expand Up @@ -265,7 +266,7 @@ void DSPHLE::InitMixer()
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000));
soundStream = AudioCommon::InitSoundStream(new HLEMixer(this, AISampleRate, DACSampleRate, 48000), m_hWnd);
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
m_InitMixer = true;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/DSPHLE/DSPHLE.h
Expand Up @@ -16,7 +16,7 @@ class DSPHLE : public DSPEmulator {
public:
DSPHLE();

virtual bool Initialize(bool bWii, bool bDSPThread) override;
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread) override;
virtual void Shutdown() override;
virtual bool IsLLE() override { return false ; }

Expand Down
5 changes: 3 additions & 2 deletions Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
Expand Up @@ -130,8 +130,9 @@ void DSPLLE::dsp_thread(DSPLLE *dsp_lle)
}
}

bool DSPLLE::Initialize(bool bWii, bool bDSPThread)
bool DSPLLE::Initialize(void *hWnd, bool bWii, bool bDSPThread)
{
m_hWnd = hWnd;
m_bWii = bWii;
m_bDSPThread = bDSPThread;
m_InitMixer = false;
Expand Down Expand Up @@ -184,7 +185,7 @@ void DSPLLE::InitMixer()
unsigned int AISampleRate, DACSampleRate;
AudioInterface::Callback_GetSampleRate(AISampleRate, DACSampleRate);
delete soundStream;
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000));
soundStream = AudioCommon::InitSoundStream(new CMixer(AISampleRate, DACSampleRate, 48000), m_hWnd);
if(!soundStream) PanicAlert("Error starting up sound stream");
// Mixer is initialized
m_InitMixer = true;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/Src/HW/DSPLLE/DSPLLE.h
Expand Up @@ -14,7 +14,7 @@ class DSPLLE : public DSPEmulator {
public:
DSPLLE();

virtual bool Initialize(bool bWii, bool bDSPThread);
virtual bool Initialize(void *hWnd, bool bWii, bool bDSPThread);
virtual void Shutdown();
virtual bool IsLLE() { return true; }

Expand Down

0 comments on commit 33d56f5

Please sign in to comment.