mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +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();
|
||||
mSamplesQueued = 0;
|
||||
|
||||
for(ALuint i = 0;i < sNumBuffers;i++)
|
||||
alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate);
|
||||
throwALerror();
|
||||
std::vector<char> data(mBufferSize);
|
||||
|
||||
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);
|
||||
throwALerror();
|
||||
|
||||
mIsFinished = false;
|
||||
mOutput.mStreamThread->add(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue