@@ -85,26 +85,9 @@ static OSStatus coreaudio_macos_input_callback(void *inRefCon,
8585 UInt32 inNumberFrames,
8686 AudioBufferList *ioData)
8787{
88- static int callback_count = 0 ;
89- callback_count++;
90-
91- /* Reduce logging to avoid timing issues */
92- if (callback_count <= 3 || callback_count % 1000 == 0 ) /* Log first 3 calls, then every 1000th */
93- {
94- RARCH_LOG (" [CoreAudio macOS Mic Callback]: *** CALLBACK INVOKED #%d *** Bus: %u , Frames: %u \n " ,
95- callback_count, (unsigned )inBusNumber, (unsigned )inNumberFrames);
96- }
97-
9888 coreaudio_macos_microphone_t *mic = (coreaudio_macos_microphone_t *)inRefCon;
9989 if (!mic || !mic->buffer_list || !atomic_load (&mic->is_running ))
100- {
101- if (callback_count <= 3 ) /* Only log the first few times */
102- {
103- RARCH_LOG (" [CoreAudio macOS Mic Callback]: Early return - mic: %p , buffer_list: %p , is_running: %d \n " ,
104- mic, mic ? mic->buffer_list : NULL , mic ? atomic_load (&mic->is_running ) : 0 );
105- }
10690 return noErr;
107- }
10891
10992 /* Make sure our buffer is large enough */
11093 UInt32 needed_size = inNumberFrames * mic->format .mBytesPerFrame ;
@@ -117,11 +100,11 @@ static OSStatus coreaudio_macos_input_callback(void *inRefCon,
117100 mic->buffer_list ->mBuffers [0 ].mDataByteSize = needed_size;
118101 }
119102
120- /* CRITICAL FIX: Render from INPUT BUS (bus 1) for microphone input */
103+ /* Render from INPUT BUS (bus 1) for microphone input */
121104 OSStatus status = AudioUnitRender (mic->audio_unit ,
122105 ioActionFlags,
123106 inTimeStamp,
124- 1 , /* INPUT BUS - this was the bug! */
107+ 1 , /* INPUT BUS */
125108 inNumberFrames,
126109 mic->buffer_list );
127110
@@ -145,19 +128,18 @@ static OSStatus coreaudio_macos_input_callback(void *inRefCon,
145128 /* FIFO is getting full - write what we can and drop the rest */
146129 fifo_write (mic->fifo , mic->buffer_list ->mBuffers [0 ].mData , fifo_write_space);
147130 static int overflow_count = 0 ;
148- if (overflow_count++ % 100 == 0 ) /* Log overflow occasionally */
131+ if (overflow_count++ % 1000 == 0 ) /* Log overflow very occasionally */
149132 {
150- RARCH_WARN (" [CoreAudio macOS Mic Callback]: FIFO overflow - dropping %zu bytes (wrote %zu of %zu )\n " ,
151- bytes_to_write - fifo_write_space, fifo_write_space, bytes_to_write);
133+ RARCH_WARN (" [CoreAudio Mic]: FIFO overflow - dropping audio data\n " );
152134 }
153135 }
154136 else
155137 {
156138 /* FIFO is completely full - drop this data */
157139 static int full_count = 0 ;
158- if (full_count++ % 500 == 0 ) /* Log full FIFO occasionally */
140+ if (full_count++ % 2000 == 0 ) /* Log full FIFO very occasionally */
159141 {
160- RARCH_WARN (" [CoreAudio macOS Mic Callback ]: FIFO completely full - dropping %zu bytes \n " , bytes_to_write );
142+ RARCH_WARN (" [CoreAudio Mic]: FIFO completely full - dropping audio data \n " );
161143 }
162144 }
163145
@@ -166,18 +148,17 @@ static OSStatus coreaudio_macos_input_callback(void *inRefCon,
166148 }
167149 else if (status == kAudioUnitErr_NoConnection )
168150 {
169- /* This error should be rare now with proper format setup - limit logging */
151+ /* This error should be rare now with proper format setup */
170152 static int error_count = 0 ;
171- if (error_count++ % 1000 == 0 )
172- RARCH_WARN (" [CoreAudio macOS Mic Callback ]: NoConnection error during AudioUnitRender\n " );
153+ if (error_count++ % 5000 == 0 )
154+ RARCH_WARN (" [CoreAudio Mic]: NoConnection error during AudioUnitRender\n " );
173155 }
174156 else
175157 {
176158 static int other_error_count = 0 ;
177- if (other_error_count++ % 100 == 0 ) /* Log other errors occasionally */
159+ if (other_error_count++ % 1000 == 0 )
178160 {
179- RARCH_ERR (" [CoreAudio macOS Mic Callback]: AudioUnitRender failed with status: %d (0x%x )\n " ,
180- (int )status, (unsigned int )status);
161+ RARCH_ERR (" [CoreAudio Mic]: AudioUnitRender failed with status: %d \n " , (int )status);
181162 }
182163 }
183164
0 commit comments