mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-08 22:11:09 +00:00
Replace another std::vector with a TArray
This commit is contained in:
parent
48df515dd1
commit
90fa215da2
1 changed files with 11 additions and 11 deletions
|
@ -151,7 +151,7 @@ class OpenALSoundStream : public SoundStream
|
||||||
SoundStreamCallback Callback;
|
SoundStreamCallback Callback;
|
||||||
void *UserData;
|
void *UserData;
|
||||||
|
|
||||||
std::vector<ALubyte> Data;
|
TArray<ALubyte> Data;
|
||||||
|
|
||||||
ALsizei SampleRate;
|
ALsizei SampleRate;
|
||||||
ALenum Format;
|
ALenum Format;
|
||||||
|
@ -263,14 +263,14 @@ public:
|
||||||
alSourcei(Source, AL_BUFFER, 0);
|
alSourcei(Source, AL_BUFFER, 0);
|
||||||
for(int i = 0;i < BufferCount;i++)
|
for(int i = 0;i < BufferCount;i++)
|
||||||
{
|
{
|
||||||
if(!Callback(this, &Data[0], Data.size(), UserData))
|
if(!Callback(this, &Data[0], Data.Size(), UserData))
|
||||||
{
|
{
|
||||||
if(i == 0)
|
if(i == 0)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
alBufferData(Buffers[i], Format, &Data[0], Data.size(), SampleRate);
|
alBufferData(Buffers[i], Format, &Data[0], Data.Size(), SampleRate);
|
||||||
alSourceQueueBuffers(Source, 1, &Buffers[i]);
|
alSourceQueueBuffers(Source, 1, &Buffers[i]);
|
||||||
}
|
}
|
||||||
if(getALError() != AL_NO_ERROR)
|
if(getALError() != AL_NO_ERROR)
|
||||||
|
@ -342,7 +342,7 @@ public:
|
||||||
size_t pos = Decoder->getSampleOffset();
|
size_t pos = Decoder->getSampleOffset();
|
||||||
if(state != AL_STOPPED)
|
if(state != AL_STOPPED)
|
||||||
{
|
{
|
||||||
size_t rem = queued*(Data.size()/FrameSize) - offset;
|
size_t rem = queued*(Data.Size()/FrameSize) - offset;
|
||||||
if(pos > rem) pos -= rem;
|
if(pos > rem) pos -= rem;
|
||||||
else pos = 0;
|
else pos = 0;
|
||||||
}
|
}
|
||||||
|
@ -372,9 +372,9 @@ public:
|
||||||
alSourceUnqueueBuffers(Source, 1, &bufid);
|
alSourceUnqueueBuffers(Source, 1, &bufid);
|
||||||
processed--;
|
processed--;
|
||||||
|
|
||||||
if(Callback(this, &Data[0], Data.size(), UserData))
|
if(Callback(this, &Data[0], Data.Size(), UserData))
|
||||||
{
|
{
|
||||||
alBufferData(bufid, Format, &Data[0], Data.size(), SampleRate);
|
alBufferData(bufid, Format, &Data[0], Data.Size(), SampleRate);
|
||||||
alSourceQueueBuffers(Source, 1, &bufid);
|
alSourceQueueBuffers(Source, 1, &bufid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,17 +427,17 @@ public:
|
||||||
pos = Decoder->getSampleOffset();
|
pos = Decoder->getSampleOffset();
|
||||||
len = Decoder->getSampleLength();
|
len = Decoder->getSampleLength();
|
||||||
if(state == AL_STOPPED)
|
if(state == AL_STOPPED)
|
||||||
offset = BufferCount * (Data.size()/FrameSize);
|
offset = BufferCount * (Data.Size()/FrameSize);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t rem = queued*(Data.size()/FrameSize) - offset;
|
size_t rem = queued*(Data.Size()/FrameSize) - offset;
|
||||||
if(pos > rem) pos -= rem;
|
if(pos > rem) pos -= rem;
|
||||||
else if(len > 0) pos += len - rem;
|
else if(len > 0) pos += len - rem;
|
||||||
else pos = 0;
|
else pos = 0;
|
||||||
}
|
}
|
||||||
pos = (size_t)(pos * 1000.0 / SampleRate);
|
pos = (size_t)(pos * 1000.0 / SampleRate);
|
||||||
len = (size_t)(len * 1000.0 / SampleRate);
|
len = (size_t)(len * 1000.0 / SampleRate);
|
||||||
stats.AppendFormat(",%3lu%% buffered", 100 - 100*offset/(BufferCount*(Data.size()/FrameSize)));
|
stats.AppendFormat(",%3u%% buffered", 100 - 100*offset/(BufferCount*(Data.Size()/FrameSize)));
|
||||||
stats.AppendFormat(", %zu.%03zu", pos/1000, pos%1000);
|
stats.AppendFormat(", %zu.%03zu", pos/1000, pos%1000);
|
||||||
if(len > 0)
|
if(len > 0)
|
||||||
stats.AppendFormat(" / %zu.%03zu", len/1000, len%1000);
|
stats.AppendFormat(" / %zu.%03zu", len/1000, len%1000);
|
||||||
|
@ -504,7 +504,7 @@ public:
|
||||||
|
|
||||||
buffbytes += FrameSize-1;
|
buffbytes += FrameSize-1;
|
||||||
buffbytes -= buffbytes%FrameSize;
|
buffbytes -= buffbytes%FrameSize;
|
||||||
Data.resize(buffbytes);
|
Data.Resize(buffbytes);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ public:
|
||||||
SampleRate = srate;
|
SampleRate = srate;
|
||||||
Looping = loop;
|
Looping = loop;
|
||||||
|
|
||||||
Data.resize((size_t)(0.2 * SampleRate) * FrameSize);
|
Data.Resize((size_t)(0.2 * SampleRate) * FrameSize);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue