mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 10:36:42 +00:00
Merge remote-tracking branch 'corristo/osx-music-fix'
This commit is contained in:
commit
550e5eb686
1 changed files with 17 additions and 7 deletions
|
@ -316,15 +316,25 @@ void OpenAL_SoundStream::play()
|
||||||
throwALerror();
|
throwALerror();
|
||||||
mSamplesQueued = 0;
|
mSamplesQueued = 0;
|
||||||
|
|
||||||
for(ALuint i = 0;i < sNumBuffers;i++)
|
std::vector<char> data(mBufferSize);
|
||||||
alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate);
|
|
||||||
throwALerror();
|
|
||||||
|
|
||||||
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
|
bool finished = false;
|
||||||
|
for(ALuint i = 0;i < sNumBuffers && !finished;i++)
|
||||||
|
{
|
||||||
|
size_t got = mDecoder->read(&data[0], data.size());
|
||||||
|
finished = (got < data.size());
|
||||||
|
if(got > 0)
|
||||||
|
{
|
||||||
|
ALuint bufid = mBuffers[i];
|
||||||
|
alBufferData(bufid, mFormat, &data[0], got, mSampleRate);
|
||||||
|
alSourceQueueBuffers(mSource, 1, &bufid);
|
||||||
|
throwALerror();
|
||||||
|
mSamplesQueued += getBufferSampleCount(bufid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mIsFinished = finished;
|
||||||
alSourcePlay(mSource);
|
alSourcePlay(mSource);
|
||||||
throwALerror();
|
|
||||||
|
|
||||||
mIsFinished = false;
|
|
||||||
mOutput.mStreamThread->add(this);
|
mOutput.mStreamThread->add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue