extract delay to define, 10ms

This commit is contained in:
Joseph Mattiello 2025-06-10 12:21:13 -04:00
parent 663f318d5f
commit 3344af01d7
No known key found for this signature in database
1 changed files with 58 additions and 56 deletions

View File

@ -33,6 +33,8 @@
#include <math.h>
#include <pthread.h> /* For mutexes */
#define COREAUDIO_MIC_BUFFER_DURATION_S 0.01f /* Buffer duration in seconds (e.g., 0.01f for 10ms) */
typedef struct coreaudio_macos_microphone
{
AudioUnit audio_unit;
@ -685,8 +687,8 @@ static void *coreaudio_macos_microphone_open_mic(void *data, const char *device,
atomic_store(&mic->is_initialized, true);
RARCH_LOG("[CoreAudio macOS Mic]: AudioUnit successfully initialized.\n");
/* Initialize FIFO buffer - 50ms buffer size */
size_t fifo_size = mic->format.mSampleRate * mic->format.mBytesPerFrame * 0.05f;
/* Initialize FIFO buffer */
size_t fifo_size = mic->format.mSampleRate * mic->format.mBytesPerFrame * COREAUDIO_MIC_BUFFER_DURATION_S;
RARCH_LOG("[CoreAudio macOS Mic]: Creating FIFO buffer of size %u bytes (%.1f ms at %.0f Hz)\n",
(unsigned)fifo_size,
(float)fifo_size * 1000.0f / (mic->format.mSampleRate * mic->format.mBytesPerFrame),