From 8fd1af6783e8a6976c787c74553d1b71e81a75cb Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Sat, 17 Jun 2017 07:43:37 -0300 Subject: Changed OpenAL latency setting to really reflect how much time it is. Before these changes each value of latency were actually 5ms, with a minimum latency of ~10 ms. If it was set to 4 ms on the UI, the actual latency was 10 + 5 * 4 = 30 ms. Now 30 ms on the UI means 30 ms on the backend. --- Source/Core/AudioCommon/OpenALStream.h | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Source/Core/AudioCommon/OpenALStream.h') diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index 78c0a616a1..ee7ae47813 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -17,9 +17,9 @@ #include #include -#define SFX_MAX_SOURCE 1 -#define OAL_MAX_BUFFERS 32 -#define OAL_MAX_SAMPLES 256 +// OpenAL requires a minimum of two buffers, three or more recommended +#define OAL_BUFFERS 3 +#define OAL_MAX_FRAMES 4096 #define STEREO_CHANNELS 2 #define SURROUND_CHANNELS 6 // number of channels in surround mode #define SIZE_SHORT 2 @@ -72,12 +72,11 @@ private: Common::Event soundSyncEvent; - short realtimeBuffer[OAL_MAX_SAMPLES * STEREO_CHANNELS]; - float sampleBuffer[OAL_MAX_SAMPLES * SURROUND_CHANNELS * OAL_MAX_BUFFERS]; - ALuint uiBuffers[OAL_MAX_BUFFERS]; + std::vector realtimeBuffer; + std::vector sampleBuffer; + std::array uiBuffers; ALuint uiSource; ALfloat fVolume; - u8 numBuffers; #endif // _WIN32 }; -- cgit v1.2.3 From d9d51fe0c479702b7f0dfbdc788e7f2821162a6b Mon Sep 17 00:00:00 2001 From: lfsafady Date: Sat, 17 Jun 2017 17:16:32 -0300 Subject: Renamed some variables to the current coding standard and some to better fit what they really are. --- Source/Core/AudioCommon/OpenALStream.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Source/Core/AudioCommon/OpenALStream.h') diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index ee7ae47813..f16fa2c8a2 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -56,7 +56,7 @@ class OpenALStream final : public SoundStream { #ifdef _WIN32 public: - OpenALStream() : uiSource(0) {} + OpenALStream() : m_source(0) {} bool Start() override; void SoundLoop() override; void SetVolume(int volume) override; @@ -67,16 +67,16 @@ public: static bool isValid(); private: - std::thread thread; + std::thread m_thread; Common::Flag m_run_thread; - Common::Event soundSyncEvent; + Common::Event m_sound_sync_event; - std::vector realtimeBuffer; - std::vector sampleBuffer; - std::array uiBuffers; - ALuint uiSource; - ALfloat fVolume; + std::vector m_realtime_buffer; + std::vector m_sample_buffer; + std::array m_buffers; + ALuint m_source; + ALfloat m_volume; #endif // _WIN32 }; -- cgit v1.2.3 From 9eb209c214a3999547fc572a094e5cd300ed7ace Mon Sep 17 00:00:00 2001 From: LAGonauta Date: Fri, 16 Jun 2017 18:54:19 -0300 Subject: Removed redundant conversion to float when playing back stereo. --- Source/Core/AudioCommon/OpenALStream.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'Source/Core/AudioCommon/OpenALStream.h') diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h index f16fa2c8a2..3b9364c571 100644 --- a/Source/Core/AudioCommon/OpenALStream.h +++ b/Source/Core/AudioCommon/OpenALStream.h @@ -26,8 +26,6 @@ #define SIZE_INT32 4 #define SIZE_FLOAT 4 // size of a float in bytes #define FRAME_STEREO_SHORT STEREO_CHANNELS* SIZE_SHORT -#define FRAME_STEREO_FLOAT STEREO_CHANNELS* SIZE_FLOAT -#define FRAME_STEREO_INT32 STEREO_CHANNELS* SIZE_INT32 #define FRAME_SURROUND_FLOAT SURROUND_CHANNELS* SIZE_FLOAT #define FRAME_SURROUND_SHORT SURROUND_CHANNELS* SIZE_SHORT #define FRAME_SURROUND_INT32 SURROUND_CHANNELS* SIZE_INT32 @@ -73,7 +71,6 @@ private: Common::Event m_sound_sync_event; std::vector m_realtime_buffer; - std::vector m_sample_buffer; std::array m_buffers; ALuint m_source; ALfloat m_volume; -- cgit v1.2.3