summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2013-01-15 22:29:26 +1100
committerskidau <skidau@gmail.com>2013-01-15 22:29:26 +1100
commit6d4a566bc49ba29f52d58ec1bdbc020c67537bef (patch)
tree2106548208f4ef6fdaa52107ce227f9f22c71b68 /Source/Core
parent1c462a1ecaa514912338735537284456f7cd835b (diff)
Changed SoundTouch to use float samples, allowing SSE to be used.
Made the DPL2 decoder disabled by default. Re-added the audio hack used by the Accurate VBeam emulation option.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Src/OpenALStream.cpp35
-rw-r--r--Source/Core/Core/Src/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/Src/CoreParameter.cpp4
-rw-r--r--Source/Core/Core/Src/HW/SystemTimers.cpp3
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp1
5 files changed, 30 insertions, 15 deletions
diff --git a/Source/Core/AudioCommon/Src/OpenALStream.cpp b/Source/Core/AudioCommon/Src/OpenALStream.cpp
index 94112c130d..489954e351 100644
--- a/Source/Core/AudioCommon/Src/OpenALStream.cpp
+++ b/Source/Core/AudioCommon/Src/OpenALStream.cpp
@@ -176,6 +176,7 @@ void OpenALStream::SoundLoop()
soundTouch.setChannels(2);
soundTouch.setSampleRate(ulFrequency);
+ soundTouch.setTempo(1.0);
soundTouch.setSetting(SETTING_USE_QUICKSEEK, 0);
soundTouch.setSetting(SETTING_USE_AA_FILTER, 0);
soundTouch.setSetting(SETTING_SEQUENCE_MS, 1);
@@ -197,7 +198,16 @@ void OpenALStream::SoundLoop()
numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples;
numSamples = m_mixer->Mix(realtimeBuffer, numSamples);
- soundTouch.putSamples(realtimeBuffer, numSamples);
+
+ // Convert the samples from short to float
+ float dest[OAL_MAX_SAMPLES * 2 * 2 * OAL_MAX_BUFFERS];
+ for (u32 i = 0; i < numSamples; ++i)
+ {
+ dest[i * 2 + 0] = (float)realtimeBuffer[i * 2 + 0] / (1 << 16);
+ dest[i * 2 + 1] = (float)realtimeBuffer[i * 2 + 1] / (1 << 16);
+ }
+
+ soundTouch.putSamples(dest, numSamples);
if (iBuffersProcessed == iBuffersFilled)
{
@@ -241,16 +251,8 @@ void OpenALStream::SoundLoop()
#else
if (surround_capable)
{
- // Convert the samples from short to float for the dpl2 decoder
- float dest[OAL_MAX_SAMPLES * 2 * 2 * OAL_MAX_BUFFERS];
- for (u32 i = 0; i < nSamples; ++i)
- {
- dest[i * 2 + 0] = (float)sampleBuffer[i * 2 + 0] / (1<<16);
- dest[i * 2 + 1] = (float)sampleBuffer[i * 2 + 1] / (1<<16);
- }
-
float dpl2[OAL_MAX_SAMPLES * SIZE_FLOAT * SURROUND_CHANNELS * OAL_MAX_BUFFERS];
- dpl2decode(dest, nSamples, dpl2);
+ dpl2decode(sampleBuffer, nSamples, dpl2);
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2, nSamples * SIZE_FLOAT * SURROUND_CHANNELS, ulFrequency);
ALenum err = alGetError();
@@ -268,7 +270,18 @@ void OpenALStream::SoundLoop()
#endif
if (!surround_capable)
{
- alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, sampleBuffer, nSamples * 2 * 2, ulFrequency);
+#if defined(__APPLE__)
+ // Convert the samples from float to short
+ short stereo[OAL_MAX_SAMPLES * 2 * 2 * OAL_MAX_BUFFERS];
+ for (u32 i = 0; i < nSamples; ++i)
+ {
+ stereo[i * 2 + 0] = (short)((float)sampleBuffer[i * 2 + 0] * (1 << 16));
+ stereo[i * 2 + 1] = (short)((float)sampleBuffer[i * 2 + 1] * (1 << 16));
+ }
+ alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo, nSamples * 2 * 2, ulFrequency);
+#else
+ alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO_FLOAT32, sampleBuffer, nSamples * 4 * 2, ulFrequency);
+#endif
}
alSourceQueueBuffers(uiSource, 1, &uiBufferTemp[iBuffersFilled]);
diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp
index 210769c8a5..3bec0a8df3 100644
--- a/Source/Core/Core/Src/ConfigManager.cpp
+++ b/Source/Core/Core/Src/ConfigManager.cpp
@@ -369,7 +369,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader);
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
- ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, true);
+ ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, false);
ini.Get("Core", "Latency", &m_LocalCoreStartupParameter.iLatency, 14);
ini.Get("Core", "MemcardA", &m_strMemoryCardA);
ini.Get("Core", "MemcardB", &m_strMemoryCardB);
diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp
index b8294ce815..d44bd136f7 100644
--- a/Source/Core/Core/Src/CoreParameter.cpp
+++ b/Source/Core/Core/Src/CoreParameter.cpp
@@ -49,7 +49,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bEnableCheats(false),
bMergeBlocks(false),
bRunCompareServer(false), bRunCompareClient(false),
- bDPL2Decoder(true), iLatency(14),
+ bDPL2Decoder(false), iLatency(14),
bMMU(false), bMMUBAT(false), iTLBHack(0), bVBeam(false),
bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false), bDisableWiimoteSpeaker(false),
@@ -85,7 +85,7 @@ void SCoreStartupParameter::LoadDefaults()
bMergeBlocks = false;
SelectedLanguage = 0;
bWii = false;
- bDPL2Decoder = true;
+ bDPL2Decoder = false;
iLatency = 14;
iPosX = 100;
diff --git a/Source/Core/Core/Src/HW/SystemTimers.cpp b/Source/Core/Core/Src/HW/SystemTimers.cpp
index b520c51b39..b9f9fe0107 100644
--- a/Source/Core/Core/Src/HW/SystemTimers.cpp
+++ b/Source/Core/Core/Src/HW/SystemTimers.cpp
@@ -160,7 +160,8 @@ void DSPCallback(u64 userdata, int cyclesLate)
void AudioDMACallback(u64 userdata, int cyclesLate)
{
- int period = CPU_CORE_CLOCK / (AudioInterface::GetAIDSampleRate() * 4 / 32);
+ int fields = SConfig::GetInstance().m_LocalCoreStartupParameter.bVBeam?2:1;
+ int period = CPU_CORE_CLOCK / (AudioInterface::GetAIDSampleRate() * 4 / 32 * fields);
DSP::UpdateAudioDMA(); // Push audio to speakers.
CoreTiming::ScheduleEvent(period - cyclesLate, et_AudioDMA);
}
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index ddc8025d88..687176ce0d 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -366,6 +366,7 @@ void CConfigMain::InitializeGUIValues()
VolumeText->SetLabel(wxString::Format(wxT("%d %%"), ac_Config.m_Volume));
DSPThread->SetValue(startup_params.bDSPThread);
DumpAudio->SetValue(ac_Config.m_DumpAudio ? true : false);
+ DPL2Decoder->Enable(std::string(ac_Config.sBackend) == BACKEND_OPENAL);
DPL2Decoder->SetValue(startup_params.bDPL2Decoder);
LatencySlider->Enable(std::string(ac_Config.sBackend) == BACKEND_OPENAL);
LatencySlider->SetValue(startup_params.iLatency);