audiofox 1.0.2

Cross platform audio capture made easy!
Documentation
// SPDX-License-Identifier: GPL-2.0-or-later WITH Classpath-exception-2.0
// Audiofox, the audio capturer!
// Copyright (c) 2026 foxberries

/// Macro to call a Core Audio function and check its return status. Does not wrap the unsafe block.
macro_rules! check_status {
    ($call:expr) => {{
        let status: i32 = $call;
        match status {
            objc2_core_audio::kAudioHardwareNoError => Ok(()),
            _ => Err(anyhow::anyhow!("OSStatus: 0x{:X}", status.cast_unsigned())),
        }
    }};
}

/// Macro to automatically calculate the qualifier information for
/// [`get_prop_data`](crate::platform::mac::wrapper::get_prop_data) and
/// [`get_prop_size`](crate::platform::mac::wrapper::get_prop_size).
macro_rules! qual {
    ($q:expr) => {
        Some((
            core::mem::size_of_val(&$q) as u32,
            core::ptr::addr_of!($q).cast::<core::ffi::c_void>(),
        ))
    };
}

/// Macro to automatically generate a valid query for an
/// [`AudioObjectPropertyAddress`](objc2_core_audio::AudioObjectPropertyAddress).
macro_rules! query {
    ($selector:expr) => {
        objc2_core_audio::AudioObjectPropertyAddress {
            mSelector: $selector,
            mScope: objc2_core_audio::kAudioObjectPropertyScopeGlobal,
            mElement: objc2_core_audio::kAudioObjectPropertyElementMain,
        }
    };
}