mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-18 10:21:42 +00:00
Better report the amount buffered in an OpenAL stream
This commit is contained in:
parent
0017e1e6e8
commit
9c12abeb2d
1 changed files with 3 additions and 5 deletions
|
@ -359,15 +359,13 @@ public:
|
||||||
{
|
{
|
||||||
FString stats;
|
FString stats;
|
||||||
ALfloat volume;
|
ALfloat volume;
|
||||||
ALint processed;
|
ALint boffset;
|
||||||
ALint queued;
|
|
||||||
ALint state;
|
ALint state;
|
||||||
ALenum err;
|
ALenum err;
|
||||||
|
|
||||||
alGetSourcef(Source, AL_GAIN, &volume);
|
alGetSourcef(Source, AL_GAIN, &volume);
|
||||||
|
alGetSourcei(Source, AL_BYTE_OFFSET, &boffset);
|
||||||
alGetSourcei(Source, AL_SOURCE_STATE, &state);
|
alGetSourcei(Source, AL_SOURCE_STATE, &state);
|
||||||
alGetSourcei(Source, AL_BUFFERS_QUEUED, &queued);
|
|
||||||
alGetSourcei(Source, AL_BUFFERS_PROCESSED, &processed);
|
|
||||||
if((err=alGetError()) != AL_NO_ERROR)
|
if((err=alGetError()) != AL_NO_ERROR)
|
||||||
{
|
{
|
||||||
stats = "Error getting stats: ";
|
stats = "Error getting stats: ";
|
||||||
|
@ -377,7 +375,7 @@ public:
|
||||||
|
|
||||||
stats = (state == AL_INITIAL) ? "Buffering" : (state == AL_STOPPED) ? "Underrun" :
|
stats = (state == AL_INITIAL) ? "Buffering" : (state == AL_STOPPED) ? "Underrun" :
|
||||||
(state == AL_PLAYING || state == AL_PAUSED) ? "Ready" : "Unknown state";
|
(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));
|
stats.AppendFormat(", %d%%", int(volume * 100));
|
||||||
if(state == AL_PAUSED)
|
if(state == AL_PAUSED)
|
||||||
stats += ", paused";
|
stats += ", paused";
|
||||||
|
|
Loading…
Reference in a new issue