1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00

Don't initially fill buffers in OpenAL_SoundStream::play

This commit is contained in:
Chris Robinson 2012-12-13 02:32:21 -08:00
parent 1ffaf6625a
commit ba9c5f5b4e

View File

@ -230,30 +230,19 @@ OpenAL_SoundStream::~OpenAL_SoundStream()
void OpenAL_SoundStream::play()
{
std::vector<char> data(mBufferSize);
ALuint count = 0;
alSourceStop(mSource);
alSourcei(mSource, AL_BUFFER, 0);
throwALerror();
mSamplesQueued = 0;
for(ALuint i = 0;i < sNumBuffers;i++)
{
size_t got;
got = mDecoder->read(&data[0], data.size());
alBufferData(mBuffers[i], mFormat, &data[0], got, mSampleRate);
count += getBufferSampleCount(mBuffers[i]);
}
alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate);
throwALerror();
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
alSourcePlay(mSource);
throwALerror();
mSamplesTotal += count;
mSamplesQueued = count;
mIsFinished = false;
mOutput.mStreamThread->add(this);
}