DSP plugin merge - the two DSP plugins are now gone and all the code has been merged into Dolphin.

This WILL temporarily break the Linux and MacOSX builds but should be easy to fix.

Things left to do:
  * The UI on the new Audio tab for the LLE/HLE choice is ugly
  * At times the code still look "plugin-y" and needs cleanup
  * The two plugins should be merged further. DSPHLE should use the emulated memory etc of DSPLLE as much as possible, so that simply saving the DSPLLE state is enough. This would also bring the possibility of savestate compatibility between the two plugins.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6947 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard
2011-01-28 18:39:30 +00:00
parent 976420b9d5
commit 419d6a244b
116 changed files with 1271 additions and 3914 deletions

View File

@ -28,7 +28,7 @@
namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer)
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd)
{
// This looks evil.
if (!mixer)
@ -38,9 +38,9 @@ namespace AudioCommon
if (backend == BACKEND_OPENAL && OpenALStream::isValid())
soundStream = new OpenALStream(mixer);
else if (backend == BACKEND_NULLSOUND && NullSound::isValid())
soundStream = new NullSound(mixer, g_dspInitialize.hWnd);
soundStream = new NullSound(mixer, hWnd);
else if (backend == BACKEND_DIRECTSOUND && DSound::isValid())
soundStream = new DSound(mixer, g_dspInitialize.hWnd);
soundStream = new DSound(mixer, hWnd);
else if (backend == BACKEND_XAUDIO2 && XAudio2::isValid())
soundStream = new XAudio2(mixer);
else if (backend == BACKEND_AOSOUND && AOSound::isValid())
@ -86,7 +86,7 @@ namespace AudioCommon
soundStream = NULL;
}
INFO_LOG(DSPHLE, "Done shutting down sound stream");
NOTICE_LOG(DSPHLE, "Done shutting down sound stream");
}
std::vector<std::string> GetSoundBackends()

View File

@ -20,13 +20,11 @@
#include "Common.h"
#include "AudioCommonConfig.h"
#include "../../../PluginSpecs/pluginspecs_dsp.h"
#include "SoundStream.h"
class CMixer;
extern DSPInitialize g_dspInitialize;
extern SoundStream *soundStream;
extern AudioCommonConfig ac_Config;
@ -57,7 +55,7 @@ union UDSPControl
namespace AudioCommon
{
SoundStream *InitSoundStream(CMixer *mixer = NULL);
SoundStream *InitSoundStream(CMixer *mixer, void *hWnd);
void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends();
bool UseJIT();

View File

@ -16,8 +16,12 @@
// http://code.google.com/p/dolphin-emu/
#include "AudioCommon.h"
AudioCommonConfig ac_Config;
// This shouldn't be a global, at least not here.
SoundStream *soundStream;
// Load from given file
void AudioCommonConfig::Load(IniFile &file) {
file.Get("Config", "EnableDTKMusic", &m_EnableDTKMusic, true);

View File

@ -125,9 +125,9 @@ bool DSound::Start()
if (FAILED(DirectSoundCreate8(0, &ds, 0)))
return false;
if (g_dspInitialize.hWnd)
if (hWnd)
{
HRESULT hr = ds->SetCooperativeLevel((HWND)g_dspInitialize.hWnd, DSSCL_PRIORITY);
HRESULT hr = ds->SetCooperativeLevel((HWND)hWnd, DSSCL_PRIORITY);
}
if (!CreateBuffer())
return false;

View File

@ -60,13 +60,14 @@ class DSound : public SoundStream
bool WriteDataToBuffer(DWORD dwOffset, char* soundData, DWORD dwSoundBytes);
public:
DSound(CMixer *mixer, void *hWnd = NULL)
DSound(CMixer *mixer, void *_hWnd = NULL)
: SoundStream(mixer)
, bufferSize(0)
, currentPos(0)
, lastPos(0)
, dsBuffer(0)
, ds(0)
, hWnd(_hWnd)
{}
virtual ~DSound() {}

View File

@ -21,6 +21,11 @@
#include "AudioCommon.h"
#include "CPUDetect.h"
#include "../../Core/Src/HW/AudioInterface.h"
// UGLINESS
#include "../../Core/Src/PowerPC/PowerPC.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h>
#endif
@ -33,14 +38,11 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
if (!samples)
return 0;
if (g_dspInitialize.pEmulatorState)
if (PowerPC::GetState() != 0)
{
if (*g_dspInitialize.pEmulatorState != 0)
{
// Silence
memset(samples, 0, numSamples * 4);
return numSamples;
}
// Silence
memset(samples, 0, numSamples * 4);
return numSamples;
}
unsigned int numLeft = Common::AtomicLoad(m_numSamples);
@ -127,7 +129,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
if (m_EnableDTKMusic)
{
// Re-sampling is done inside
g_dspInitialize.pGetAudioStreaming(samples, numSamples, m_sampleRate);
AudioInterface::Callback_GetStreaming(samples, numSamples, m_sampleRate);
}
Common::AtomicAdd(m_numSamples, -(s32)numLeft);
@ -136,18 +138,15 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples)
}
void CMixer::PushSamples(short *samples, unsigned int num_samples)
void CMixer::PushSamples(const short *samples, unsigned int num_samples)
{
if (m_throttle)
{
// The auto throttle function. This loop will put a ceiling on the CPU MHz.
while (num_samples + Common::AtomicLoad(m_numSamples) > MAX_SAMPLES)
{
if (g_dspInitialize.pEmulatorState)
{
if (*g_dspInitialize.pEmulatorState != 0)
break;
}
if (*PowerPC::GetStatePtr() != 0)
break;
// Shortcut key for Throttle Skipping
#ifdef _WIN32
if (GetAsyncKeyState(VK_TAB)) break;;

View File

@ -48,11 +48,11 @@ public:
// Called from audio threads
virtual unsigned int Mix(short* samples, unsigned int numSamples);
virtual void Premix(short *samples, unsigned int numSamples) {}
virtual void Premix(short * /*samples*/, unsigned int /*numSamples*/) {}
unsigned int GetNumSamples();
// Called from main thread
virtual void PushSamples(short* samples, unsigned int num_samples);
virtual void PushSamples(const short* samples, unsigned int num_samples);
unsigned int GetSampleRate() {return m_sampleRate;}
void SetThrottle(bool use) { m_throttle = use;}