]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - snd_coreaudio.c
Add an in_releaseall command for debugging/working around stuck keys.
[xonotic/darkplaces.git] / snd_coreaudio.c
index cb653f0447090953bc792784d52f8db44c9b748c..ce8fff5bcf7d02073d025d78cc6b9bb20c929f9d 100644 (file)
@@ -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
@@ -123,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]));
        }
 
@@ -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);
@@ -384,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
+}