Better report the amount buffered in an OpenAL stream

This commit is contained in:
Chris Robinson 2014-06-25 04:52:23 -07:00
parent 0017e1e6e8
commit 9c12abeb2d

View file

@ -359,15 +359,13 @@ public:
{
FString stats;
ALfloat volume;
ALint processed;
ALint queued;
ALint boffset;
ALint state;
ALenum err;
alGetSourcef(Source, AL_GAIN, &volume);
alGetSourcei(Source, AL_BYTE_OFFSET, &boffset);
alGetSourcei(Source, AL_SOURCE_STATE, &state);
alGetSourcei(Source, AL_BUFFERS_QUEUED, &queued);
alGetSourcei(Source, AL_BUFFERS_PROCESSED, &processed);
if((err=alGetError()) != AL_NO_ERROR)
{
stats = "Error getting stats: ";
@ -377,7 +375,7 @@ public:
stats = (state == AL_INITIAL) ? "Buffering" : (state == AL_STOPPED) ? "Underrun" :
(state == AL_PLAYING || state == AL_PAUSED) ? "Ready" : "Unknown state";
stats.AppendFormat(",%3d%% buffered", (queued ? 100-(processed*100/queued) : 0));
stats.AppendFormat(",%3lu%% buffered", 100 - 100*boffset/(BufferCount*Data.size()));
stats.AppendFormat(", %d%%", int(volume * 100));
if(state == AL_PAUSED)
stats += ", paused";