Platform-Specific Audio Device Discovery in Meetily: Windows, macOS, and Linux Implementations

Meetily implements platform-specific audio device discovery using WASAPI on Windows, ScreenCaptureKit on macOS, and ALSA/PulseAudio on Linux, abstracted behind a unified audio::devices interface in the Tauri backend.

Meetily is an open-source meeting assistant built with Tauri that requires robust cross-platform audio capture. The application handles platform-specific audio device discovery through dedicated modules in frontend/src-tauri/src/audio/devices/platform/, ensuring native API integration on each operating system while presenting a single, consistent Rust API to the frontend.

Modular Architecture Overview

Meetily organizes audio device handling behind a modular audio::devices layer that isolates platform-specific code from the rest of the application. The architecture relies on two primary files to coordinate discovery:

This design allows the rest of the codebase—including the recording manager in frontend/src-tauri/src/audio/recording_manager.rs—to remain agnostic of the underlying native APIs.

Windows Audio Device Discovery (WASAPI)

On Windows, Meetily leverages the Windows Audio Session API (WASAPI) for device enumeration and exclusive-mode handling. The implementation resides in frontend/src-tauri/src/audio/devices/platform/windows.rs.

This module queries the WASAPI subsystem to list all active capture and playback devices, returning structured data that includes device IDs, friendly names, and capabilities. The WASAPI implementation supports both shared-mode and exclusive-mode audio streams, enabling low-latency capture when required by the transcription pipeline.

macOS Audio Device Discovery (ScreenCaptureKit and CoreAudio)

For macOS, the platform implementation in frontend/src-tauri/src/audio/devices/platform/macos.rs utilizes ScreenCaptureKit—Apple’s modern framework for capturing system audio—combined with CoreAudio for microphone enumeration.

ScreenCaptureKit provides access to system audio streams (application audio and system output), while CoreAudio handles the discovery of physical input devices. This dual approach allows Meetily to present both microphone and system audio sources in the device selection UI, enabling users to record meeting audio from multiple sources simultaneously.

Linux Audio Device Discovery (ALSA/PulseAudio)

The Linux implementation in frontend/src-tauri/src/audio/devices/platform/linux.rs probes both ALSA and PulseAudio backends to ensure compatibility across different Linux distributions and audio server configurations.

During discovery, the module attempts to enumerate devices through PulseAudio first, falling back to ALSA hardware device enumeration when PulseAudio is unavailable. This hybrid approach ensures that Meetily can identify capture and playback devices on systems running traditional ALSA setups, modern PipeWire environments, or standard PulseAudio configurations.

Implementation Flow and API Usage

When the Tauri frontend invokes the start_recording command, the backend executes a three-step discovery process:

  1. API Entry – The call routes to audio::devices::list_audio_devices() in discovery.rs.
  2. Platform Dispatch – Conditional compilation directives select the appropriate platform module (Windows, macOS, or Linux) based on the target OS.
  3. Native Enumeration – The platform-specific module queries the native API (WASAPI, ScreenCaptureKit, or ALSA/PulseAudio) and returns a Vec<AudioDevice> containing device names, unique IDs, and kinds (microphone versus system audio).

The AudioDevice struct serves as the universal data model across all platforms, containing fields for the device identifier, display name, and device type classification.

Practical Code Examples

Listing Available Devices (Rust)

use crate::audio::devices::list_audio_devices;

pub async fn show_device_picker() -> Result<(), anyhow::Error> {
    // Retrieve all devices for the current platform
    let devices = list_audio_devices()?;

    // Filter for microphone and system audio devices
    let microphones = devices.iter()
        .filter(|d| d.kind == AudioDeviceKind::Microphone)
        .collect::<Vec<_>>();

    let systems = devices.iter()
        .filter(|d| d.kind == AudioDeviceKind::System)
        .collect::<Vec<_>>();

    // Example: pick the first available device on each side
    let mic = microphones.first()
        .ok_or_else(|| anyhow!("No microphone found"))?
        .clone();
    let sys = systems.first()
        .ok_or_else(|| anyhow!("No system audio device found"))?
        .clone();

    // Pass the selections to the recording manager
    crate::audio::recording_manager::start(mic, sys).await?;
    Ok(())
}

Direct Platform Access (For Testing)

#[cfg(target_os = "windows")]
fn dump_windows_devices() -> Result<(), anyhow::Error> {
    use crate::audio::devices::platform::windows::discover_devices;
    let devs = discover_devices()?;
    println!("Windows audio devices: {:#?}", devs);
    Ok(())
}

Frontend Integration (TypeScript)

import { invoke } from '@tauri-apps/api/tauri';

// Ask the Rust backend for the list of devices
async function populateDeviceSelectors() {
  const devices: AudioDevice[] = await invoke('list_audio_devices');
  // `AudioDevice` contains `{ id: string, name: string, kind: 'microphone' | 'system' }`
  setMicOptions(devices.filter(d => d.kind === 'microphone'));
  setSystemOptions(devices.filter(d => d.kind === 'system'));
}

Summary

Frequently Asked Questions

Which native APIs does Meetily use for audio device discovery on each platform?

Meetily uses WASAPI on Windows, ScreenCaptureKit (supplemented by CoreAudio for input devices) on macOS, and ALSA/PulseAudio on Linux. These APIs provide direct access to the operating system's audio hardware enumeration capabilities without requiring external dependencies.

How does Meetily maintain cross-platform compatibility while using platform-specific audio APIs?

The codebase employs Rust's conditional compilation system through #[cfg(target_os = "...")] attributes in frontend/src-tauri/src/audio/devices/mod.rs. This approach selects the appropriate platform module at compile time, exposing a single list_audio_devices() function that works identically across Windows, macOS, and Linux.

What information does Meetily return when discovering audio devices?

The list_audio_devices() function returns a vector of AudioDevice structs, where each struct contains the device's unique identifier, human-readable name, and device kind classification (either Microphone for input devices or System for system audio capture). This consistent data structure allows the frontend to populate device selection dropdowns without platform-specific logic.

Where are the platform-specific audio implementations located in the Meetily repository?

Each platform implementation resides in frontend/src-tauri/src/audio/devices/platform/ with dedicated files for each operating system: windows.rs for WASAPI, macos.rs for ScreenCaptureKit/CoreAudio, and linux.rs for ALSA/PulseAudio. The common discovery logic lives in frontend/src-tauri/src/audio/devices/discovery.rs.

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:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →