mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 21:51:09 +00:00
- fixed: 'stat music' tried to access a non-existent stream decoder for any music played through Timidity++ on OpenAL.
This commit is contained in:
parent
2abd16f117
commit
6552e5a7a1
1 changed files with 24 additions and 18 deletions
|
@ -407,7 +407,7 @@ public:
|
||||||
virtual FString GetStats()
|
virtual FString GetStats()
|
||||||
{
|
{
|
||||||
FString stats;
|
FString stats;
|
||||||
size_t pos, len;
|
size_t pos = 0, len = 0;
|
||||||
ALfloat volume;
|
ALfloat volume;
|
||||||
ALint offset;
|
ALint offset;
|
||||||
ALint processed;
|
ALint processed;
|
||||||
|
@ -429,28 +429,34 @@ public:
|
||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = Decoder->getSampleOffset();
|
if (Decoder != nullptr)
|
||||||
len = Decoder->getSampleLength();
|
{
|
||||||
|
pos = Decoder->getSampleOffset();
|
||||||
|
len = Decoder->getSampleLength();
|
||||||
|
}
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
||||||
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";
|
||||||
|
|
||||||
if(state == AL_STOPPED)
|
if (Decoder != nullptr)
|
||||||
offset = BufferCount * (Data.Size()/FrameSize);
|
{
|
||||||
else
|
if (state == AL_STOPPED)
|
||||||
{
|
offset = BufferCount * (Data.Size() / FrameSize);
|
||||||
size_t rem = queued*(Data.Size()/FrameSize) - offset;
|
else
|
||||||
if(pos > rem) pos -= rem;
|
{
|
||||||
else if(len > 0) pos += len - rem;
|
size_t rem = queued*(Data.Size() / FrameSize) - offset;
|
||||||
else pos = 0;
|
if (pos > rem) pos -= rem;
|
||||||
}
|
else if (len > 0) pos += len - rem;
|
||||||
pos = (size_t)(pos * 1000.0 / SampleRate);
|
else pos = 0;
|
||||||
len = (size_t)(len * 1000.0 / SampleRate);
|
}
|
||||||
stats.AppendFormat(",%3u%% buffered", 100 - 100*offset/(BufferCount*(Data.Size()/FrameSize)));
|
pos = (size_t)(pos * 1000.0 / SampleRate);
|
||||||
stats.AppendFormat(", %zu.%03zu", pos/1000, pos%1000);
|
len = (size_t)(len * 1000.0 / SampleRate);
|
||||||
if(len > 0)
|
stats.AppendFormat(",%3u%% buffered", 100 - 100 * offset / (BufferCount*(Data.Size() / FrameSize)));
|
||||||
stats.AppendFormat(" / %zu.%03zu", len/1000, len%1000);
|
stats.AppendFormat(", %zu.%03zu", pos / 1000, pos % 1000);
|
||||||
|
if (len > 0)
|
||||||
|
stats.AppendFormat(" / %zu.%03zu", len / 1000, len % 1000);
|
||||||
|
}
|
||||||
if(state == AL_PAUSED)
|
if(state == AL_PAUSED)
|
||||||
stats += ", paused";
|
stats += ", paused";
|
||||||
if(state == AL_PLAYING)
|
if(state == AL_PLAYING)
|
||||||
|
|
Loading…
Reference in a new issue