audiofox 1.0.3

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

use core::ops::Deref;

use crate::common::builder::CHUNK_SIZE_F32;

/// 8192 samples of F32LE PCM.
///
/// These samples are interleaved, stereo, and returned by [`link()`](crate::AudioManager::link) at
/// a rate of 48kHz.
#[derive(Clone, Copy, Debug)]
#[repr(transparent)]
pub struct Chunk<'a>(pub(crate) &'a [f32; CHUNK_SIZE_F32]);

impl Deref for Chunk<'_> {
    type Target = [f32];

    fn deref(&self) -> &Self::Target {
        self.0.as_slice()
    }
}

impl<'a> IntoIterator for &Chunk<'a> {
    type Item = &'a f32;
    type IntoIter = core::slice::Iter<'a, f32>;

    fn into_iter(self) -> Self::IntoIter {
        self.0.iter()
    }
}