X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=snd_coreaudio.c;h=91b776034380233dcac8ad82a50fa69ef534a374;hb=9c086b32f381d18eddf8f081504b026cf16fa412;hp=cb653f0447090953bc792784d52f8db44c9b748c;hpb=a334e97bd7b1e7b37fe40a96caf9ccb8504c3f96;p=xonotic%2Fdarkplaces.git diff --git a/snd_coreaudio.c b/snd_coreaudio.c index cb653f04..91b77603 100644 --- a/snd_coreaudio.c +++ b/snd_coreaudio.c @@ -55,7 +55,7 @@ static OSStatus audioDeviceIOProc(AudioDeviceID inDevice, { float *outBuffer; unsigned int frameCount, factor, sampleIndex; - const float scale = 1.0f / SHRT_MAX; + float scale = 1.0f / SHRT_MAX; outBuffer = (float*)outOutputData->mBuffers[0].mData; factor = snd_renderbuffer->format.channels * snd_renderbuffer->format.width; @@ -73,6 +73,7 @@ static OSStatus audioDeviceIOProc(AudioDeviceID inDevice, if (snd_usethreadedmixing) { S_MixToBuffer(mixbuffer, submissionChunk); + sampleCount = submissionChunk * snd_renderbuffer->format.channels; for (sampleIndex = 0; sampleIndex < sampleCount; sampleIndex++) outBuffer[sampleIndex] = mixbuffer[sampleIndex] * scale; // unlock the mutex now @@ -239,7 +240,7 @@ qboolean SndSys_Init (const snd_format_t* requested, snd_format_t* suggested) return false; } - if(streamDesc.mFormatID != kAudioFormatLinearPCM) + if(streamDesc.mFormatID == kAudioFormatLinearPCM) { // Add the callback function status = AudioDeviceAddIOProc(outputDeviceID, audioDeviceIOProc, NULL);