Eliminate some trampoline functions.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7015 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Jordan Woyak
2011-01-31 08:19:27 +00:00
parent 67a4ac0bf6
commit 1de40588ac
20 changed files with 38 additions and 73 deletions

View File

@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <functional>
#include <string.h>
#include "AOSoundStream.h"
@ -54,18 +55,13 @@ void AOSound::SoundLoop()
}
}
void soundThread(AOSound *aosound)
{
aosound->SoundLoop();
}
bool AOSound::Start()
{
memset(realtimeBuffer, 0, sizeof(realtimeBuffer));
soundSyncEvent.Init();
thread = std::thread(soundThread, this);
thread = std::thread(std::mem_fun(&AOSound::SoundLoop), this);
return true;
}

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <functional>
#include "Common.h"
#include "Thread.h"
#include "AlsaSoundStream.h"
@ -33,14 +35,9 @@ AlsaSound::~AlsaSound()
delete [] mix_buffer;
}
static void ThreadTrampoline(AlsaSound* args)
{
args->SoundLoop();
}
bool AlsaSound::Start()
{
thread = std::thread(ThreadTrampoline, this);
thread = std::thread(std::mem_fun(&AlsaSound::SoundLoop), this);
thread_data = 0;
return true;
}

View File

@ -15,9 +15,12 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <windows.h>
#include <cmath>
#include <functional>
#include <windows.h>
#include <dxerr.h>
#include "AudioCommon.h"
#include "DSoundStream.h"
@ -91,11 +94,6 @@ bool DSound::WriteDataToBuffer(DWORD dwOffset, // Our own write
}
// The audio thread.
void soundThread(DSound* dsound)
{
dsound->SoundLoop();
}
void DSound::SoundLoop()
{
currentPos = 0;
@ -137,7 +135,7 @@ bool DSound::Start()
dsBuffer->Lock(0, bufferSize, (void* *)&p1, &num1, 0, 0, 0);
memset(p1, 0, num1);
dsBuffer->Unlock(p1, num1, 0, 0);
thread = std::thread(soundThread, this);
thread = std::thread(std::mem_fun(&DSound::SoundLoop), this);
return true;
}

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <functional>
#include "aldlist.h"
#include "OpenALStream.h"
@ -44,7 +46,7 @@ bool OpenALStream::Start()
if (pContext)
{
alcMakeContextCurrent(pContext);
thread = std::thread(OpenALStream::ThreadFunc, this);
thread = std::thread(std::mem_fun(&OpenALStream::SoundLoop), this);
bReturn = true;
}
else
@ -121,11 +123,6 @@ void OpenALStream::Clear(bool mute)
}
}
void OpenALStream::ThreadFunc(OpenALStream* alstream)
{
alstream->SoundLoop();
}
void OpenALStream::SoundLoop()
{
ALenum err;

View File

@ -58,8 +58,6 @@ public:
virtual bool usesMixer() const { return true; }
virtual void Update();
static void ThreadFunc(OpenALStream* args);
private:
std::thread thread;
Common::EventEx soundSyncEvent;

View File

@ -15,6 +15,8 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include <functional>
#include "Common.h"
#include "Thread.h"
@ -35,15 +37,10 @@ PulseAudio::~PulseAudio()
delete [] mix_buffer;
}
void PulseAudio::ThreadTrampoline(PulseAudio* args)
{
args->SoundLoop();
}
bool PulseAudio::Start()
{
thread_running = true;
thread = std::thread(ThreadTrampoline, this);
thread = std::thread(std::mem_fun(&PulseAudio::SoundLoop), this);
return true;
}

View File

@ -46,7 +46,6 @@ public:
private:
virtual void SoundLoop();
static void ThreadTrampoline(PulseAudio* args);
bool PulseInit();
void PulseShutdown();
bool Write(const void *data, size_t bytes);