From 9c12abeb2d17ff4de8796d122c33c71cb061818c Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 25 Jun 2014 04:52:23 -0700 Subject: [PATCH] Better report the amount buffered in an OpenAL stream --- src/sound/oalsound.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/sound/oalsound.cpp b/src/sound/oalsound.cpp index 706c26ae74..127233057d 100644 --- a/src/sound/oalsound.cpp +++ b/src/sound/oalsound.cpp @@ -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";