forked from mirror/openmw-tes3mp
Music playback on OS X >= 10.9 works again. Fixes bug #1041.
This commit is contained in:
parent
73c6aba4d0
commit
fc21dd1f3a
1 changed files with 17 additions and 2 deletions
|
@ -316,8 +316,23 @@ void OpenAL_SoundStream::play()
|
||||||
throwALerror();
|
throwALerror();
|
||||||
mSamplesQueued = 0;
|
mSamplesQueued = 0;
|
||||||
|
|
||||||
for(ALuint i = 0;i < sNumBuffers;i++)
|
int srate;
|
||||||
alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate);
|
ChannelConfig chans;
|
||||||
|
SampleType sampleType;
|
||||||
|
|
||||||
|
mDecoder->getInfo(&srate, &chans, &sampleType);
|
||||||
|
|
||||||
|
// Use exactly one sample of silence.
|
||||||
|
// This is required for OpenAL implementations that don't accept empty buffer data.
|
||||||
|
// (like one in OS X 10.9)
|
||||||
|
ALuint sampleSize = framesToBytes(1, chans, sampleType);
|
||||||
|
std::vector<char> silenceSample(sampleSize);
|
||||||
|
|
||||||
|
if (sampleType == SampleType_UInt8)
|
||||||
|
std::fill(silenceSample.begin(), silenceSample.end(), 0x80);
|
||||||
|
|
||||||
|
for(ALuint i = 0;i < sNumBuffers;i++)
|
||||||
|
alBufferData(mBuffers[i], mFormat, &silenceSample[0], sampleSize, mSampleRate);
|
||||||
throwALerror();
|
throwALerror();
|
||||||
|
|
||||||
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
|
alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);
|
||||||
|
|
Loading…
Reference in a new issue