diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index 4ee754b35..868b4bdbd 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -316,8 +316,23 @@ void OpenAL_SoundStream::play() throwALerror(); mSamplesQueued = 0; - for(ALuint i = 0;i < sNumBuffers;i++) - alBufferData(mBuffers[i], mFormat, this, 0, mSampleRate); + int srate; + 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 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(); alSourceQueueBuffers(mSource, sNumBuffers, mBuffers);