audiofox 1.0.1

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

// Channels are not used on macOS
#![cfg(not(target_os = "macos"))]

/// Macro for sending commands to a [`mpsc::channel`](std::sync::mpsc::channel).
macro_rules! send {
    ($sender:expr, $command:expr) => {
        $sender
            .send($command)
            .map_err(|e| anyhow::anyhow!("Failed to send {e:?}"))
    };
}

/// Wrapper for `send!` which logs an error if the message failed to send. Used in contexts
/// where an [`Error`](crate::Error) cannot otherwise be propagated.
macro_rules! send_logged {
    ($sender:expr, $message:expr) => {
        if let Err(e) = send!($sender, $message) {
            log::error!("failed to send response: {e}");
        }
    };
}