mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
OpenAL: continue work on it
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2799 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -15,25 +15,54 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
|
||||
#include "aldlist.h"
|
||||
#include "OpenALStream.h"
|
||||
|
||||
#define AUDIO_NUMBUFFERS (4)
|
||||
|
||||
|
||||
bool OpenALStream::Start()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenALStream::SoundLoop()
|
||||
{
|
||||
ALDeviceList *pDeviceList = NULL;
|
||||
ALCcontext *pContext = NULL;
|
||||
ALCdevice *pDevice = NULL;
|
||||
bool bReturn = false;
|
||||
|
||||
pDeviceList = new ALDeviceList();
|
||||
if ((pDeviceList) && (pDeviceList->GetNumDevices()))
|
||||
{
|
||||
pDevice = alcOpenDevice(pDeviceList->GetDeviceName(pDeviceList->GetDefaultDevice()));
|
||||
if (pDevice)
|
||||
{
|
||||
pContext = alcCreateContext(pDevice, NULL);
|
||||
if (pContext)
|
||||
{
|
||||
alcMakeContextCurrent(pContext);
|
||||
thread = new Common::Thread(OpenALStream::ThreadFunc, (void *)this);
|
||||
bReturn = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
alcCloseDevice(pDevice);
|
||||
}
|
||||
}
|
||||
delete pDeviceList;
|
||||
}
|
||||
return bReturn;
|
||||
}
|
||||
|
||||
void OpenALStream::Stop()
|
||||
{
|
||||
ALCcontext *pContext;
|
||||
ALCdevice *pDevice;
|
||||
|
||||
delete thread;
|
||||
|
||||
pContext = alcGetCurrentContext();
|
||||
pDevice = alcGetContextsDevice(pContext);
|
||||
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcDestroyContext(pContext);
|
||||
alcCloseDevice(pDevice);
|
||||
}
|
||||
|
||||
void OpenALStream::Update()
|
||||
@ -41,7 +70,18 @@ void OpenALStream::Update()
|
||||
|
||||
}
|
||||
|
||||
void OpenALStream::SoundThread()
|
||||
// The audio thread.
|
||||
#ifdef _WIN32
|
||||
DWORD WINAPI OpenALStream::ThreadFunc(void* args)
|
||||
#else
|
||||
void* OpenALStream::soundThread(void* args)
|
||||
#endif
|
||||
{
|
||||
(reinterpret_cast<OpenALStream *>(args))->SoundLoop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void OpenALStream::SoundLoop()
|
||||
{
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user