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.
This commit is contained in:
LAGonauta
2017-06-17 07:43:37 -03:00
committed by lfsafady
parent 94ba78d717
commit 8fd1af6783
5 changed files with 54 additions and 28 deletions

View File

@ -17,9 +17,9 @@
#include <OpenAL/include/alc.h>
#include <OpenAL/include/alext.h>
#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<short> realtimeBuffer;
std::vector<float> sampleBuffer;
std::array<ALuint, OAL_BUFFERS> uiBuffers;
ALuint uiSource;
ALfloat fVolume;
u8 numBuffers;
#endif // _WIN32
};