forked from teamnwah/openmw-tes3coop
Don't initially fill buffers in OpenAL_SoundStream::play
This commit is contained in:
parent
1ffaf6625a
commit
ba9c5f5b4e
1 changed files with 2 additions and 13 deletions
|
@ -230,30 +230,19 @@ OpenAL_SoundStream::~OpenAL_SoundStream()
|
||||||
|
|
||||||
void OpenAL_SoundStream::play()
|
void OpenAL_SoundStream::play()
|
||||||
{
|
{
|
||||||
std::vector<char> data(mBufferSize);
|
|
||||||
ALuint count = 0;
|
|
||||||
|
|
||||||
alSourceStop(mSource);
|
alSourceStop(mSource);
|
||||||
alSourcei(mSource, AL_BUFFER, 0);
|
alSourcei(mSource, AL_BUFFER, 0);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
mSamplesQueued = 0;
|
mSamplesQueued = 0;
|
||||||
|
|
||||||
for(ALuint i = 0;i < sNumBuffers;i++)
|
for(ALuint i = 0;i < sNumBuffers;i++)
|
||||||
{
|
alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate);
|
||||||
size_t got;
|
|
||||||
got = mDecoder->read(&data[0], data.size());
|
|
||||||
alBufferData(mBuffers[i], mFormat, &data[0], got, mSampleRate);
|
|
||||||
count += getBufferSampleCount(mBuffers[i]);
|
|
||||||
}
|
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
|
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
|
||||||
alSourcePlay(mSource);
|
alSourcePlay(mSource);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
mSamplesTotal += count;
|
|
||||||
mSamplesQueued = count;
|
|
||||||
|
|
||||||
mIsFinished = false;
|
mIsFinished = false;
|
||||||
mOutput.mStreamThread->add(this);
|
mOutput.mStreamThread->add(this);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue