How Meetily Enumerates and Selects Audio Devices on Windows, macOS, and Linux
Meetily uses the cross-platform CPAL library in its Tauri Rust core to enumerate audio devices via OS-specific backends (WASAPI, CoreAudio, ALSA/PulseAudio), then passes user selections from the frontend to dedicated capture pipelines for microphone and system audio.
Meetily handles audio device management through a Rust-based Tauri backend that abstracts platform differences. The application enumerates available input and output devices using the CPAL (Cross-Platform Audio Library) crate, with platform-specific implementations for Windows, macOS, and Linux. This architecture ensures consistent audio device enumeration and selection across all supported operating systems.
Cross-Platform Device Enumeration Architecture
The entry point for device discovery is the async function list_audio_devices in frontend/src-tauri/src/audio/devices/discovery.rs. This function retrieves the default host for the current operating system and delegates to platform-specific helpers to build a comprehensive device list.
After platform-specific enumeration completes, the function walks the remainder of the host's device iterator and adds any missing devices as generic output devices (lines 30-38 of devices/discovery.rs). The final vector of AudioDevice structs—defined in frontend/src-tauri/src/audio/devices/configuration.rs—is returned to the frontend for presentation.
Platform-Specific Implementation Details
Meetily implements separate modules for each operating system to handle native audio APIs.
Windows (WASAPI)
On Windows, the system calls platform::configure_windows_audio(&host) from frontend/src-tauri/src/audio/devices/platform/windows.rs. This module leverages the WASAPI backend via CPAL to enumerate both input (microphone) and output (system) devices. The implementation handles loopback capture for system audio and maintains a list of fallback devices when the default host enumeration misses hardware.
macOS (CoreAudio and ScreenCaptureKit)
macOS device enumeration is implemented in frontend/src-tauri/src/audio/devices/platform/macos.rs. The helper uses CoreAudio for microphone devices and ScreenCaptureKit for system audio capture. The module specifically adds virtual audio devices such as BlackHole to the enumerated list, which are required for capturing system audio on macOS.
Linux (ALSA and PulseAudio)
Linux support is handled in frontend/src-tauri/src/audio/devices/platform/linux.rs. The implementation enumerates devices through ALSA or PulseAudio, depending on what CPAL exposes on the target system. The helper normalizes device names across distributions to ensure consistent presentation in the UI.
Device Selection and Recording Pipeline
When a user initiates recording from the frontend, the selection flows through Tauri commands to the Rust backend.
The frontend calls the start_recording command (registered in src/lib.rs) via the recording service:
await invoke('start_recording', {
mic_device_name: selectedMic,
system_device_name: selectedSystem,
meeting_name: meetingTitle
});
In frontend/src-tauri/src/audio/recording_commands.rs, the Rust command matches the provided device names against the AudioDevice list. The corresponding CPAL device handles are stored in the shared RecordingState.
The selected microphone routes to the mic capture pipeline (capture/microphone.rs), while the system device routes to the system capture pipeline (capture/system.rs). These pipelines feed into the mixing and VAD logic in frontend/src-tauri/src/audio/pipeline.rs for professional audio processing and transcription.
Summary
- Meetily uses the CPAL library in
devices/discovery.rsto provide cross-platform audio enumeration through thelist_audio_devicesasync function. - Platform-specific implementations reside in
devices/platform/windows.rs(WASAPI),devices/platform/macos.rs(CoreAudio/ScreenCaptureKit), anddevices/platform/linux.rs(ALSA/PulseAudio). - Device names are normalized and returned as
AudioDevicestructs to the TypeScript frontend. - User selections are passed via the
start_recordingTauri command torecording_commands.rs, where they are matched to CPAL device handles. - Selected devices are routed to separate capture pipelines for microphone and system audio before entering the mixing pipeline.
Frequently Asked Questions
How does Meetily handle audio device enumeration on Windows without requiring specific hardware drivers?
Meetily uses the WASAPI backend provided by CPAL in frontend/src-tauri/src/audio/devices/platform/windows.rs. This Windows-native API allows direct enumeration of audio endpoints without requiring proprietary drivers, and includes fallback mechanisms for devices that might not appear in the default host enumeration.
Why does Meetily require virtual audio devices like BlackHole on macOS?
According to the implementation in frontend/src-tauri/src/audio/devices/platform/macos.rs, macOS uses CoreAudio for microphones but requires ScreenCaptureKit and virtual audio devices (such as BlackHole) for system audio capture. The enumeration code explicitly adds these virtual devices to the list so users can select them for recording system output.
What audio backends does Meetily support on Linux distributions?
The Linux implementation in frontend/src-tauri/src/audio/devices/platform/linux.rs supports both ALSA and PulseAudio depending on which subsystem CPAL detects on the target system. The code normalizes device names across these backends to ensure consistent UI presentation across different Linux distributions.
How does the frontend communicate the selected audio devices to the Rust backend?
The frontend invokes the start_recording command via Tauri's API, passing the selected mic_device_name and system_device_name as parameters. The Rust handler in recording_commands.rs matches these string names against the enumerated AudioDevice list to retrieve the corresponding CPAL device handles for recording.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →