Core Audio capture class for macOS audio input and system-wide audio tapping. Provides functionality for both microphone capture via AVFoundation and system-wide audio capture via Core Audio taps (requires macOS 14.0+).
More...
#include <src/platform/macos/av_audio.h>
|
| (nullable AVCaptureDevice *) | + findMicrophone: |
| | Find a specific microphone device by name.
|
| |
| (NSArray< NSString * > *) | + microphoneNames |
| | Get names of all available microphone devices.
|
| |
| (NSArray< AVCaptureDevice * > *) | + microphones |
| | Get all available microphone devices on the system.
|
| |
|
|
TPCircularBuffer | audioSampleBuffer |
| | Shared circular buffer for both audio capture paths.
|
| |
|
dispatch_semaphore_t | audioSemaphore |
| | Real-time safe semaphore for signaling audio sample availability.
|
| |
|
|
AVCaptureSession * | audioCaptureSession |
| | AVFoundation capture session for microphone input.
|
| |
|
AVCaptureConnection * | audioConnection |
| | Audio connection within the capture session.
|
| |
|
BOOL | hostAudioEnabled |
| | Whether host audio playback should be enabled (affects tap mute behavior)
|
| |
Core Audio capture class for macOS audio input and system-wide audio tapping. Provides functionality for both microphone capture via AVFoundation and system-wide audio capture via Core Audio taps (requires macOS 14.0+).
◆ cleanupSystemTapContext:
| - (void) cleanupSystemTapContext: |
|
(nullable id) | tapDescription |
|
Cleans up system tap resources in a safe, ordered manner.
- Parameters
-
| tapDescription | Optional tap description object to release (can be nil) |
◆ createAggregateDeviceWithTapDescription:sampleRate:frameSize:
| - (OSStatus) createAggregateDeviceWithTapDescription: |
|
(CATapDescription *) | tapDescription |
| sampleRate: |
|
(UInt32) | sampleRate |
| frameSize: |
|
(UInt32) | frameSize |
Creates an aggregate device with the specified tap description and audio parameters.
- Parameters
-
| tapDescription | Core Audio tap description for system audio capture |
| sampleRate | Target sample rate in Hz |
| frameSize | Number of frames per buffer |
- Returns
- OSStatus indicating success (noErr) or error code
◆ createSystemTapDescriptionForChannels:
| - (CATapDescription *) createSystemTapDescriptionForChannels: |
|
(UInt8) | channels |
|
Creates a Core Audio tap description for system audio capture.
- Parameters
-
| channels | Number of audio channels to configure the tap for |
- Returns
- CATapDescription object on success, nil on failure
◆ findMicrophone:
| + (nullable AVCaptureDevice *) findMicrophone: |
|
(nullable NSString *) | name |
|
Find a specific microphone device by name.
- Parameters
-
| name | The name of the microphone to find (nullable - will return nil if name is nil) |
- Returns
- AVCaptureDevice object if found, nil otherwise
◆ initializeAudioBuffer:
| - (void) initializeAudioBuffer: |
|
(UInt8) | channels |
|
Initializes the circular audio buffer for the specified number of channels.
- Parameters
-
| channels | Number of audio channels to configure the buffer for |
◆ initializeSystemTapContext:frameSize:channels:
| - (int) initializeSystemTapContext: |
|
(UInt32) | sampleRate |
| frameSize: |
|
(UInt32) | frameSize |
| channels: |
|
(UInt8) | channels |
Initializes the system tap context with specified audio parameters.
- Parameters
-
| sampleRate | Target sample rate in Hz |
| frameSize | Number of frames per buffer |
| channels | Number of audio channels |
- Returns
- 0 on success, -1 on failure
◆ microphoneNames
| + (NSArray< NSString * > *) microphoneNames |
|
|
|
Get names of all available microphone devices.
- Returns
- Array of NSString objects with microphone device names
◆ microphones
| + (NSArray< AVCaptureDevice * > *) microphones |
|
|
|
Get all available microphone devices on the system.
- Returns
- Array of AVCaptureDevice objects representing available microphones
◆ setupMicrophone:sampleRate:frameSize:channels:
| - (int) setupMicrophone: |
|
(nullable AVCaptureDevice *) | device |
| sampleRate: |
|
(UInt32) | sampleRate |
| frameSize: |
|
(UInt32) | frameSize |
| channels: |
|
(UInt8) | channels |
Sets up microphone capture using AVFoundation framework.
- Parameters
-
| device | The AVCaptureDevice to use for audio input (nullable - will return error if nil) |
| sampleRate | Target sample rate in Hz |
| frameSize | Number of frames per buffer |
| channels | Number of audio channels (1=mono, 2=stereo) |
- Returns
- 0 on success, -1 on failure
◆ setupSystemTap:frameSize:channels:
| - (int) setupSystemTap: |
|
(UInt32) | sampleRate |
| frameSize: |
|
(UInt32) | frameSize |
| channels: |
|
(UInt8) | channels |
Sets up system-wide audio tap for capturing all system audio. Requires macOS 14.0+ and appropriate permissions.
- Parameters
-
| sampleRate | Target sample rate in Hz |
| frameSize | Number of frames per buffer |
| channels | Number of audio channels |
- Returns
- 0 on success, -1 on failure
The documentation for this class was generated from the following files: