X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=snd_coreaudio.c;h=ce8fff5bcf7d02073d025d78cc6b9bb20c929f9d;hb=a15e0c4cddf4f60827a3be097197447c52b7989a;hp=48d7a5b9cade8ded9bee04ab4eed78433cfbc043;hpb=97d059b94500267744bedd01e4c11caace7acfbf;p=xonotic%2Fdarkplaces.git diff --git a/snd_coreaudio.c b/snd_coreaudio.c index 48d7a5b9..ce8fff5b 100644 --- a/snd_coreaudio.c +++ b/snd_coreaudio.c @@ -55,11 +55,13 @@ 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; frameCount = 0; + if (snd_blocked) + scale = 0; // Lock the snd_renderbuffer if (SndSys_LockRenderBuffer()) @@ -71,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 @@ -121,8 +124,8 @@ static OSStatus audioDeviceIOProc(AudioDeviceID inDevice, unsigned int missingFrames; missingFrames = submissionChunk - frameCount; - if (developer.integer >= 1000 && vid_activewindow) - Con_Printf("audioDeviceIOProc: %u sample frames missing\n", missingFrames); + if (developer_insane.integer && vid_activewindow) + Con_DPrintf("audioDeviceIOProc: %u sample frames missing\n", missingFrames); memset(&outBuffer[frameCount * snd_renderbuffer->format.channels], 0, missingFrames * sizeof(outBuffer[0])); } @@ -237,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); @@ -382,3 +385,15 @@ void SndSys_UnlockRenderBuffer (void) { pthread_mutex_unlock(&coreaudio_mutex); } + +/* +==================== +SndSys_SendKeyEvents + +Send keyboard events originating from the sound system (e.g. MIDI) +==================== +*/ +void SndSys_SendKeyEvents(void) +{ + // not supported +}