summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon
diff options
context:
space:
mode:
authorLinktothepast <kostamarino@gmail.com>2015-09-28 16:50:35 +0300
committerLinktothepast <kostamarino@gmail.com>2015-09-28 16:50:35 +0300
commit748be565b8df535ef558e74b38cd0f4d615f8a21 (patch)
treeb151efee0a87e99125f2401325a9bddecf84fc73 /Source/Core/AudioCommon
parentcf17fccdd3093a1b8476b10183b1c4bde36da74d (diff)
parentce493b897d6d3735c930a8465cc0c26bbe5feb86 (diff)
Merge remote-tracking branch 'dolphin-emu/master' into gameinis
Diffstat (limited to 'Source/Core/AudioCommon')
-rw-r--r--Source/Core/AudioCommon/AOSoundStream.cpp2
-rw-r--r--Source/Core/AudioCommon/AlsaSoundStream.cpp40
-rw-r--r--Source/Core/AudioCommon/AlsaSoundStream.h5
-rw-r--r--Source/Core/AudioCommon/AudioCommon.cpp27
-rw-r--r--Source/Core/AudioCommon/AudioCommon.vcxproj6
-rw-r--r--Source/Core/AudioCommon/CoreAudioSoundStream.cpp1
-rw-r--r--Source/Core/AudioCommon/DPL2Decoder.cpp3
-rw-r--r--Source/Core/AudioCommon/Mixer.cpp43
-rw-r--r--Source/Core/AudioCommon/Mixer.h17
-rw-r--r--Source/Core/AudioCommon/OpenALStream.cpp38
-rw-r--r--Source/Core/AudioCommon/OpenALStream.h1
-rw-r--r--Source/Core/AudioCommon/OpenSLESStream.cpp2
-rw-r--r--Source/Core/AudioCommon/PulseAudioStream.cpp4
-rw-r--r--Source/Core/AudioCommon/PulseAudioStream.h2
-rw-r--r--Source/Core/AudioCommon/SoundStream.h9
-rw-r--r--Source/Core/AudioCommon/WaveFile.cpp1
-rw-r--r--Source/Core/AudioCommon/WaveFile.h1
-rw-r--r--Source/Core/AudioCommon/XAudio2Stream.cpp17
-rw-r--r--Source/Core/AudioCommon/XAudio2Stream.h1
-rw-r--r--Source/Core/AudioCommon/XAudio2_7Stream.cpp17
-rw-r--r--Source/Core/AudioCommon/XAudio2_7Stream.h1
-rw-r--r--Source/Core/AudioCommon/aldlist.cpp5
22 files changed, 149 insertions, 94 deletions
diff --git a/Source/Core/AudioCommon/AOSoundStream.cpp b/Source/Core/AudioCommon/AOSoundStream.cpp
index ee10133ae4..c9bacac206 100644
--- a/Source/Core/AudioCommon/AOSoundStream.cpp
+++ b/Source/Core/AudioCommon/AOSoundStream.cpp
@@ -6,6 +6,8 @@
#include "AudioCommon/AOSoundStream.h"
#include "AudioCommon/Mixer.h"
+#include "Common/MsgHandler.h"
+#include "Common/Logging/Log.h"
#if defined(HAVE_AO) && HAVE_AO
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.cpp b/Source/Core/AudioCommon/AlsaSoundStream.cpp
index 5902edba94..a132cb5de3 100644
--- a/Source/Core/AudioCommon/AlsaSoundStream.cpp
+++ b/Source/Core/AudioCommon/AlsaSoundStream.cpp
@@ -2,9 +2,12 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
+#include <mutex>
+
#include "AudioCommon/AlsaSoundStream.h"
#include "Common/CommonTypes.h"
#include "Common/Thread.h"
+#include "Common/Logging/Log.h"
#define FRAME_COUNT_MIN 256
#define BUFFER_SIZE_MAX 8192
@@ -26,6 +29,12 @@ AlsaSound::~AlsaSound()
bool AlsaSound::Start()
{
m_thread_status.store(ALSAThreadStatus::RUNNING);
+ if (!AlsaInit())
+ {
+ m_thread_status.store(ALSAThreadStatus::STOPPED);
+ return false;
+ }
+
thread = std::thread(&AlsaSound::SoundLoop, this);
return true;
}
@@ -33,6 +42,10 @@ bool AlsaSound::Start()
void AlsaSound::Stop()
{
m_thread_status.store(ALSAThreadStatus::STOPPING);
+
+ //Give the opportunity to the audio thread
+ //to realize we are stopping the emulation
+ cv.notify_one();
thread.join();
}
@@ -44,15 +57,14 @@ void AlsaSound::Update()
// Called on audio thread.
void AlsaSound::SoundLoop()
{
- if (!AlsaInit()) {
- m_thread_status.store(ALSAThreadStatus::STOPPED);
- return;
- }
Common::SetCurrentThreadName("Audio thread - alsa");
while (m_thread_status.load() == ALSAThreadStatus::RUNNING)
{
+ std::unique_lock<std::mutex> lock(cv_m);
+ cv.wait(lock, [this]{return !m_muted || m_thread_status.load() != ALSAThreadStatus::RUNNING;});
+
m_mixer->Mix(reinterpret_cast<short *>(mix_buffer), frames_to_deliver);
- int rc = m_muted ? 1337 : snd_pcm_writei(handle, mix_buffer, frames_to_deliver);
+ int rc = snd_pcm_writei(handle, mix_buffer, frames_to_deliver);
if (rc == -EPIPE)
{
// Underrun
@@ -67,6 +79,24 @@ void AlsaSound::SoundLoop()
m_thread_status.store(ALSAThreadStatus::STOPPED);
}
+
+void AlsaSound::Clear(bool muted)
+{
+ m_muted = muted;
+ if (m_muted)
+ {
+ std::lock_guard<std::mutex> lock(cv_m);
+ snd_pcm_drop(handle);
+ }
+ else
+ {
+ std::unique_lock<std::mutex> lock(cv_m);
+ snd_pcm_prepare(handle);
+ lock.unlock();
+ cv.notify_one();
+ }
+}
+
bool AlsaSound::AlsaInit()
{
unsigned int sample_rate = m_mixer->GetSampleRate();
diff --git a/Source/Core/AudioCommon/AlsaSoundStream.h b/Source/Core/AudioCommon/AlsaSoundStream.h
index 186e4871bb..3654f4b8a5 100644
--- a/Source/Core/AudioCommon/AlsaSoundStream.h
+++ b/Source/Core/AudioCommon/AlsaSoundStream.h
@@ -5,6 +5,8 @@
#pragma once
#include <atomic>
+#include <condition_variable>
+#include <mutex>
#include <thread>
#if defined(HAVE_ALSA) && HAVE_ALSA
@@ -25,6 +27,7 @@ public:
void SoundLoop() override;
void Stop() override;
void Update() override;
+ void Clear(bool) override;
static bool isValid()
{
@@ -45,6 +48,8 @@ private:
u8 *mix_buffer;
std::thread thread;
std::atomic<ALSAThreadStatus> m_thread_status;
+ std::condition_variable cv;
+ std::mutex cv_m;
snd_pcm_t *handle;
int frames_to_deliver;
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp
index f5438faca9..b4f2dae2f0 100644
--- a/Source/Core/AudioCommon/AudioCommon.cpp
+++ b/Source/Core/AudioCommon/AudioCommon.cpp
@@ -14,9 +14,9 @@
#include "AudioCommon/PulseAudioStream.h"
#include "AudioCommon/XAudio2_7Stream.h"
#include "AudioCommon/XAudio2Stream.h"
-
#include "Common/FileUtil.h"
-
+#include "Common/MsgHandler.h"
+#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#include "Core/Movie.h"
@@ -57,7 +57,7 @@ namespace AudioCommon
if (!g_sound_stream && NullSound::isValid())
{
- WARN_LOG(DSPHLE, "Could not initialize backend %s, using %s instead.",
+ WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.",
backend.c_str(), BACKEND_NULLSOUND);
g_sound_stream = new NullSound();
}
@@ -65,14 +65,19 @@ namespace AudioCommon
if (g_sound_stream)
{
UpdateSoundStream();
- if (g_sound_stream->Start())
+ if (!g_sound_stream->Start())
{
- if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start)
- StartAudioDump();
-
- return g_sound_stream;
+ ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead",
+ backend.c_str(), BACKEND_NULLSOUND);
+ delete g_sound_stream;
+ g_sound_stream = new NullSound();
+ g_sound_stream->Start();
}
- PanicAlertT("Could not initialize backend %s.", backend.c_str());
+
+ if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start)
+ StartAudioDump();
+
+ return g_sound_stream;
}
PanicAlertT("Sound backend %s is not valid.", backend.c_str());
@@ -84,7 +89,7 @@ namespace AudioCommon
void ShutdownSoundStream()
{
- INFO_LOG(DSPHLE, "Shutting down sound stream");
+ INFO_LOG(AUDIO, "Shutting down sound stream");
if (g_sound_stream)
{
@@ -95,7 +100,7 @@ namespace AudioCommon
g_sound_stream = nullptr;
}
- INFO_LOG(DSPHLE, "Done shutting down sound stream");
+ INFO_LOG(AUDIO, "Done shutting down sound stream");
}
std::vector<std::string> GetSoundBackends()
diff --git a/Source/Core/AudioCommon/AudioCommon.vcxproj b/Source/Core/AudioCommon/AudioCommon.vcxproj
index 13aa887e32..bba0c496c9 100644
--- a/Source/Core/AudioCommon/AudioCommon.vcxproj
+++ b/Source/Core/AudioCommon/AudioCommon.vcxproj
@@ -1,5 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
@@ -16,7 +16,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
- <PlatformToolset>v120</PlatformToolset>
+ <PlatformToolset>v140</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
diff --git a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
index 3c1d6039af..f6a26b442f 100644
--- a/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
+++ b/Source/Core/AudioCommon/CoreAudioSoundStream.cpp
@@ -5,6 +5,7 @@
#include <CoreServices/CoreServices.h>
#include "AudioCommon/CoreAudioSoundStream.h"
+#include "Common/Logging/Log.h"
OSStatus CoreAudioSound::callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
diff --git a/Source/Core/AudioCommon/DPL2Decoder.cpp b/Source/Core/AudioCommon/DPL2Decoder.cpp
index b1b63250e4..036f0e96c8 100644
--- a/Source/Core/AudioCommon/DPL2Decoder.cpp
+++ b/Source/Core/AudioCommon/DPL2Decoder.cpp
@@ -134,7 +134,8 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
// Sanity check
if (*n == 0)
return nullptr;
- MathUtil::Clamp(&fc[0], float(0.001), float(1));
+
+ fc[0] = MathUtil::Clamp(fc[0], 0.001f, 1.0f);
float *w = (float*)calloc(sizeof(float), *n);
diff --git a/Source/Core/AudioCommon/Mixer.cpp b/Source/Core/AudioCommon/Mixer.cpp
index dbf7167bb4..56370ed350 100644
--- a/Source/Core/AudioCommon/Mixer.cpp
+++ b/Source/Core/AudioCommon/Mixer.cpp
@@ -18,6 +18,18 @@
#include <tmmintrin.h>
#endif
+CMixer::CMixer(unsigned int BackendSampleRate)
+ : m_dma_mixer(this, 32000)
+ , m_streaming_mixer(this, 48000)
+ , m_wiimote_speaker_mixer(this, 3000)
+ , m_sampleRate(BackendSampleRate)
+ , m_log_dtk_audio(false)
+ , m_log_dsp_audio(false)
+ , m_speed(0)
+{
+ INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
+}
+
// Executed from sound stream thread
unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, bool consider_framelimit)
{
@@ -65,16 +77,14 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
sampleL = (sampleL * lvolume) >> 8;
sampleL += samples[currentSample + 1];
- MathUtil::Clamp(&sampleL, -32767, 32767);
- samples[currentSample + 1] = sampleL;
+ samples[currentSample + 1] = MathUtil::Clamp(sampleL, -32767, 32767);
s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current
s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
sampleR = (sampleR * rvolume) >> 8;
sampleR += samples[currentSample];
- MathUtil::Clamp(&sampleR, -32767, 32767);
- samples[currentSample] = sampleR;
+ samples[currentSample] = MathUtil::Clamp(sampleR, -32767, 32767);
m_frac += ratio;
indexR += 2 * (u16)(m_frac >> 16);
@@ -89,11 +99,10 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
s[1] = (s[1] * lvolume) >> 8;
for (; currentSample < numSamples * 2; currentSample += 2)
{
- int sampleR = s[0] + samples[currentSample];
- MathUtil::Clamp(&sampleR, -32767, 32767);
- samples[currentSample] = sampleR;
- int sampleL = s[1] + samples[currentSample + 1];
- MathUtil::Clamp(&sampleL, -32767, 32767);
+ int sampleR = MathUtil::Clamp(s[0] + samples[currentSample + 0], -32767, 32767);
+ int sampleL = MathUtil::Clamp(s[1] + samples[currentSample + 1], -32767, 32767);
+
+ samples[currentSample + 0] = sampleR;
samples[currentSample + 1] = sampleL;
}
@@ -210,11 +219,11 @@ void CMixer::StartLogDTKAudio(const std::string& filename)
m_log_dtk_audio = true;
m_wave_writer_dtk.Start(filename, 48000);
m_wave_writer_dtk.SetSkipSilence(false);
- NOTICE_LOG(DSPHLE, "Starting DTK Audio logging");
+ NOTICE_LOG(AUDIO, "Starting DTK Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "DTK Audio logging has already been started");
+ WARN_LOG(AUDIO, "DTK Audio logging has already been started");
}
}
@@ -224,11 +233,11 @@ void CMixer::StopLogDTKAudio()
{
m_log_dtk_audio = false;
m_wave_writer_dtk.Stop();
- NOTICE_LOG(DSPHLE, "Stopping DTK Audio logging");
+ NOTICE_LOG(AUDIO, "Stopping DTK Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "DTK Audio logging has already been stopped");
+ WARN_LOG(AUDIO, "DTK Audio logging has already been stopped");
}
}
@@ -239,11 +248,11 @@ void CMixer::StartLogDSPAudio(const std::string& filename)
m_log_dsp_audio = true;
m_wave_writer_dsp.Start(filename, 32000);
m_wave_writer_dsp.SetSkipSilence(false);
- NOTICE_LOG(DSPHLE, "Starting DSP Audio logging");
+ NOTICE_LOG(AUDIO, "Starting DSP Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "DSP Audio logging has already been started");
+ WARN_LOG(AUDIO, "DSP Audio logging has already been started");
}
}
@@ -253,11 +262,11 @@ void CMixer::StopLogDSPAudio()
{
m_log_dsp_audio = false;
m_wave_writer_dsp.Stop();
- NOTICE_LOG(DSPHLE, "Stopping DSP Audio logging");
+ NOTICE_LOG(AUDIO, "Stopping DSP Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "DSP Audio logging has already been stopped");
+ WARN_LOG(AUDIO, "DSP Audio logging has already been stopped");
}
}
diff --git a/Source/Core/AudioCommon/Mixer.h b/Source/Core/AudioCommon/Mixer.h
index dd3b4ab018..a14acc90cb 100644
--- a/Source/Core/AudioCommon/Mixer.h
+++ b/Source/Core/AudioCommon/Mixer.h
@@ -19,21 +19,10 @@
#define CONTROL_FACTOR 0.2f // in freq_shift per fifo size offset
#define CONTROL_AVG 32
-class CMixer {
-
+class CMixer
+{
public:
- CMixer(unsigned int BackendSampleRate)
- : m_dma_mixer(this, 32000)
- , m_streaming_mixer(this, 48000)
- , m_wiimote_speaker_mixer(this, 3000)
- , m_sampleRate(BackendSampleRate)
- , m_log_dtk_audio(0)
- , m_log_dsp_audio(0)
- , m_speed(0)
- {
- INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
- }
-
+ CMixer(unsigned int BackendSampleRate);
virtual ~CMixer() {}
// Called from audio threads
diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp
index 66c7caf49a..ce75149f02 100644
--- a/Source/Core/AudioCommon/OpenALStream.cpp
+++ b/Source/Core/AudioCommon/OpenALStream.cpp
@@ -8,6 +8,7 @@
#include "AudioCommon/DPL2Decoder.h"
#include "AudioCommon/OpenALStream.h"
#include "Common/Thread.h"
+#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
#if defined HAVE_OPENAL && HAVE_OPENAL
@@ -136,6 +137,7 @@ void OpenALStream::SoundLoop()
// OS X does not have the alext AL_FORMAT_51CHN32 yet.
surround_capable = false;
const ALenum AL_FORMAT_51CHN32 = 0;
+ const ALenum AL_FORMAT_51CHN16 = 0;
#else
bool float32_capable = true;
#endif
@@ -146,20 +148,36 @@ void OpenALStream::SoundLoop()
memset(uiBuffers, 0, numBuffers * sizeof(ALuint));
uiSource = 0;
+ // Checks if a X-Fi is being used. If it is, disable FLOAT32 support as this sound card has no support for it even though it reports it does.
+ if (strstr(alGetString(AL_RENDERER), "X-Fi"))
+ float32_capable = false;
+
// Generate some AL Buffers for streaming
alGenBuffers(numBuffers, (ALuint *)uiBuffers);
// Generate a Source to playback the Buffers
alGenSources(1, &uiSource);
// Short Silence
- memset(sampleBuffer, 0, OAL_MAX_SAMPLES * numBuffers * FRAME_SURROUND_FLOAT);
+ if (float32_capable)
+ memset(sampleBuffer, 0, OAL_MAX_SAMPLES * numBuffers * FRAME_SURROUND_FLOAT);
+ else
+ memset(sampleBuffer, 0, OAL_MAX_SAMPLES * numBuffers * FRAME_SURROUND_SHORT);
+
memset(realtimeBuffer, 0, OAL_MAX_SAMPLES * FRAME_STEREO_SHORT);
+
for (int i = 0; i < numBuffers; i++)
{
if (surround_capable)
- alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT, ulFrequency);
+ {
+ if (float32_capable)
+ alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT, ulFrequency);
+ else
+ alBufferData(uiBuffers[i], AL_FORMAT_51CHN16, sampleBuffer, 4 * FRAME_SURROUND_SHORT, ulFrequency);
+ }
else
+ {
alBufferData(uiBuffers[i], AL_FORMAT_STEREO16, realtimeBuffer, 4 * FRAME_STEREO_SHORT, ulFrequency);
+ }
}
alSourceQueueBuffers(uiSource, numBuffers, uiBuffers);
alSourcePlay(uiSource);
@@ -252,6 +270,7 @@ void OpenALStream::SoundLoop()
{
float dpl2[OAL_MAX_SAMPLES * OAL_MAX_BUFFERS * SURROUND_CHANNELS];
DPL2Decode(sampleBuffer, nSamples, dpl2);
+
// zero-out the subwoofer channel - DPL2Decode generates a pretty
// good 5.0 but not a good 5.1 output. Sadly there is not a 5.0
// AL_FORMAT_50CHN32 to make this super-explicit.
@@ -260,7 +279,20 @@ void OpenALStream::SoundLoop()
{
dpl2[i*SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f;
}
- alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2, nSamples * FRAME_SURROUND_FLOAT, ulFrequency);
+
+ if (float32_capable)
+ {
+ alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2, nSamples * FRAME_SURROUND_FLOAT, ulFrequency);
+ }
+ else
+ {
+ short surround_short[OAL_MAX_SAMPLES * SURROUND_CHANNELS * OAL_MAX_BUFFERS];
+ for (u32 i = 0; i < nSamples * SURROUND_CHANNELS; ++i)
+ surround_short[i] = (short)((float)dpl2[i] * (1 << 15));
+
+ alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN16, surround_short, nSamples * FRAME_SURROUND_SHORT, ulFrequency);
+ }
+
ALenum err = alGetError();
if (err == AL_INVALID_ENUM)
{
diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h
index e961900e41..4e0389eb30 100644
--- a/Source/Core/AudioCommon/OpenALStream.h
+++ b/Source/Core/AudioCommon/OpenALStream.h
@@ -50,6 +50,7 @@
#define FRAME_STEREO_SHORT STEREO_CHANNELS * SIZE_SHORT
#define FRAME_STEREO_FLOAT STEREO_CHANNELS * SIZE_FLOAT
#define FRAME_SURROUND_FLOAT SURROUND_CHANNELS * SIZE_FLOAT
+#define FRAME_SURROUND_SHORT SURROUND_CHANNELS * SIZE_SHORT
#endif
class OpenALStream final : public SoundStream
diff --git a/Source/Core/AudioCommon/OpenSLESStream.cpp b/Source/Core/AudioCommon/OpenSLESStream.cpp
index 2f44ef25f0..e8b5ff0335 100644
--- a/Source/Core/AudioCommon/OpenSLESStream.cpp
+++ b/Source/Core/AudioCommon/OpenSLESStream.cpp
@@ -9,7 +9,9 @@
#include <SLES/OpenSLES_Android.h>
#include "AudioCommon/OpenSLESStream.h"
+#include "Common/Assert.h"
#include "Common/CommonTypes.h"
+#include "Common/Logging/Log.h"
// engine interfaces
static SLObjectItf engineObject;
diff --git a/Source/Core/AudioCommon/PulseAudioStream.cpp b/Source/Core/AudioCommon/PulseAudioStream.cpp
index 199d426474..4dc4275e2c 100644
--- a/Source/Core/AudioCommon/PulseAudioStream.cpp
+++ b/Source/Core/AudioCommon/PulseAudioStream.cpp
@@ -6,6 +6,7 @@
#include "AudioCommon/PulseAudioStream.h"
#include "Common/CommonTypes.h"
#include "Common/Thread.h"
+#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
namespace
@@ -163,7 +164,8 @@ void PulseAudio::StateCallback(pa_context* c)
void PulseAudio::UnderflowCallback(pa_stream* s)
{
m_pa_ba.tlength += BUFFER_SAMPLES * m_channels * m_bytespersample;
- pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr);
+ pa_operation* op = pa_stream_set_buffer_attr(s, &m_pa_ba, nullptr, nullptr);
+ pa_operation_unref(op);
WARN_LOG(AUDIO, "pulseaudio underflow, new latency: %d bytes", m_pa_ba.tlength);
}
diff --git a/Source/Core/AudioCommon/PulseAudioStream.h b/Source/Core/AudioCommon/PulseAudioStream.h
index e3c74463b6..b47c580caa 100644
--- a/Source/Core/AudioCommon/PulseAudioStream.h
+++ b/Source/Core/AudioCommon/PulseAudioStream.h
@@ -31,7 +31,7 @@ public:
void UnderflowCallback(pa_stream *s);
private:
- virtual void SoundLoop() override;
+ void SoundLoop() override;
bool PulseInit();
void PulseShutdown();
diff --git a/Source/Core/AudioCommon/SoundStream.h b/Source/Core/AudioCommon/SoundStream.h
index 18b1f6ba2e..db7070890f 100644
--- a/Source/Core/AudioCommon/SoundStream.h
+++ b/Source/Core/AudioCommon/SoundStream.h
@@ -9,6 +9,7 @@
#include "AudioCommon/Mixer.h"
#include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h"
+#include "Common/Logging/Log.h"
class SoundStream
{
@@ -39,11 +40,11 @@ public:
m_logAudio = true;
g_wave_writer.Start(filename, m_mixer->GetSampleRate());
g_wave_writer.SetSkipSilence(false);
- NOTICE_LOG(DSPHLE, "Starting Audio logging");
+ NOTICE_LOG(AUDIO, "Starting Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "Audio logging already started");
+ WARN_LOG(AUDIO, "Audio logging already started");
}
}
@@ -53,11 +54,11 @@ public:
{
m_logAudio = false;
g_wave_writer.Stop();
- NOTICE_LOG(DSPHLE, "Stopping Audio logging");
+ NOTICE_LOG(AUDIO, "Stopping Audio logging");
}
else
{
- WARN_LOG(DSPHLE, "Audio logging already stopped");
+ WARN_LOG(AUDIO, "Audio logging already stopped");
}
}
};
diff --git a/Source/Core/AudioCommon/WaveFile.cpp b/Source/Core/AudioCommon/WaveFile.cpp
index cdc109058c..692700a434 100644
--- a/Source/Core/AudioCommon/WaveFile.cpp
+++ b/Source/Core/AudioCommon/WaveFile.cpp
@@ -6,6 +6,7 @@
#include "AudioCommon/WaveFile.h"
#include "Common/CommonTypes.h"
+#include "Common/Logging/Log.h"
#include "Core/ConfigManager.h"
enum { BUF_SIZE = 32*1024 };
diff --git a/Source/Core/AudioCommon/WaveFile.h b/Source/Core/AudioCommon/WaveFile.h
index 02ed48ced7..90ab26c9ea 100644
--- a/Source/Core/AudioCommon/WaveFile.h
+++ b/Source/Core/AudioCommon/WaveFile.h
@@ -17,6 +17,7 @@
#include <string>
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
+#include "Common/NonCopyable.h"
class WaveFileWriter : NonCopyable
{
diff --git a/Source/Core/AudioCommon/XAudio2Stream.cpp b/Source/Core/AudioCommon/XAudio2Stream.cpp
index 6e8762b4e9..01acb2fc26 100644
--- a/Source/Core/AudioCommon/XAudio2Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2Stream.cpp
@@ -6,6 +6,8 @@
#include "AudioCommon/AudioCommon.h"
#include "AudioCommon/XAudio2Stream.h"
#include "Common/Event.h"
+#include "Common/MsgHandler.h"
+#include "Common/Logging/Log.h"
#ifndef XAUDIO2_DLL
#error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path.
@@ -210,21 +212,6 @@ void XAudio2::SetVolume(int volume)
m_mastering_voice->SetVolume(m_volume);
}
-void XAudio2::Update()
-{
- //m_sound_sync_event.Set();
-
- //static int xi = 0;
- //if (100000 == ++xi)
- //{
- // xi = 0;
- // XAUDIO2_PERFORMANCE_DATA perfData;
- // pXAudio2->GetPerformanceData(&perfData);
- // NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
- // NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
- //}
-}
-
void XAudio2::Clear(bool mute)
{
m_muted = mute;
diff --git a/Source/Core/AudioCommon/XAudio2Stream.h b/Source/Core/AudioCommon/XAudio2Stream.h
index 5db92ef907..5561c4af91 100644
--- a/Source/Core/AudioCommon/XAudio2Stream.h
+++ b/Source/Core/AudioCommon/XAudio2Stream.h
@@ -57,7 +57,6 @@ public:
bool Start() override;
void Stop() override;
- void Update() override;
void Clear(bool mute) override;
void SetVolume(int volume) override;
diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.cpp b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
index 853bc2289e..f4a14370d9 100644
--- a/Source/Core/AudioCommon/XAudio2_7Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
@@ -10,6 +10,8 @@
#include "AudioCommon/AudioCommon.h"
#include "AudioCommon/XAudio2_7Stream.h"
#include "Common/Event.h"
+#include "Common/MsgHandler.h"
+#include "Common/Logging/Log.h"
struct StreamingVoiceContext2_7 : public IXAudio2VoiceCallback
{
@@ -198,21 +200,6 @@ void XAudio2_7::SetVolume(int volume)
m_mastering_voice->SetVolume(m_volume);
}
-void XAudio2_7::Update()
-{
- //m_sound_sync_event.Set();
-
- //static int xi = 0;
- //if (100000 == ++xi)
- //{
- // xi = 0;
- // XAUDIO2_PERFORMANCE_DATA perfData;
- // pXAudio2->GetPerformanceData(&perfData);
- // NOTICE_LOG(DSPHLE, "XAudio2_7 latency (samples): %i", perfData.CurrentLatencyInSamples);
- // NOTICE_LOG(DSPHLE, "XAudio2_7 total glitches: %i", perfData.GlitchesSinceEngineStarted);
- //}
-}
-
void XAudio2_7::Clear(bool mute)
{
m_muted = mute;
diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.h b/Source/Core/AudioCommon/XAudio2_7Stream.h
index e1eccbdbdf..e47ebbd39c 100644
--- a/Source/Core/AudioCommon/XAudio2_7Stream.h
+++ b/Source/Core/AudioCommon/XAudio2_7Stream.h
@@ -64,7 +64,6 @@ public:
bool Start() override;
void Stop() override;
- void Update() override;
void Clear(bool mute) override;
void SetVolume(int volume) override;
diff --git a/Source/Core/AudioCommon/aldlist.cpp b/Source/Core/AudioCommon/aldlist.cpp
index e5fe5f2cb4..b0ddc35fbb 100644
--- a/Source/Core/AudioCommon/aldlist.cpp
+++ b/Source/Core/AudioCommon/aldlist.cpp
@@ -27,7 +27,8 @@
*/
#include "AudioCommon/aldlist.h"
-#include "Common/Common.h"
+#include "Common/CommonFuncs.h"
+#include "Common/CommonTypes.h"
#ifdef _WIN32
#include "../../../Externals/OpenAL/include/al.h"
#include "../../../Externals/OpenAL/include/alc.h"
@@ -335,7 +336,7 @@ s32 ALDeviceList::GetNextFilteredDevice()
}
/*
- * Internal function to detemine max number of Sources that can be generated
+ * Internal function to determine max number of Sources that can be generated
*/
u32 ALDeviceList::GetMaxNumSources()
{