device-envoy-core 0.1.0

Shared traits and data types for device-envoy platform crates
Documentation
// @generated by `cargo check-all`. Do not edit by hand.
//! Module containing [`PcmClipGenerated`], the sample module generated by
//! the [`pcm_clip!`](macro@crate::audio_player::pcm_clip) macro.
//!
//! Auto-generated.

#[cfg(doc)]
#[allow(non_snake_case)]
/// Sample module generated by the [`pcm_clip!`](macro@crate::audio_player::pcm_clip)
/// macro, showing the generated items.
///
/// This page serves as the reference for what a generated audio clip module
/// provides. For first-time readers, start with the
/// [`audio_player`](mod@crate::audio_player) module documentation, then return
/// here for the generated
/// `pcm_clip()`/`adpcm_clip()` items.
///
/// The generated items are in a module (not a struct type) because stable Rust
/// does not support inherent associated types on structs.
///
/// Auto-generated.
pub mod PcmClipGenerated {
    use crate::audio_player::{
        __adpcm_data_len_for_pcm_samples, __pcm_clip_from_samples, AdpcmClipBuf, PcmClipBuf,
        VOICE_22050_HZ,
    };
    // TODO_NIGHTLY When nightly feature inherent_associated_types becomes stable,
    // change generated clip items from a module to inherent associated items on a struct.

    /// Sample rate in hertz for this generated clip.
    ///
    /// See the [audio_player module documentation](mod@crate::audio_player) for usage examples.
    pub const SAMPLE_RATE_HZ: u32 = VOICE_22050_HZ;

    /// Number of samples for uncompressed (PCM) version of this clip.
    ///
    pub const PCM_SAMPLE_COUNT: usize = 92_160;

    /// Byte length for compressed (ADPCM) encoding this clip.
    ///
    /// See the [audio_player module documentation](mod@crate::audio_player) for usage examples.
    pub const ADPCM_DATA_LEN: usize = __adpcm_data_len_for_pcm_samples(PCM_SAMPLE_COUNT);

    /// `const` function that returns the uncompressed (PCM) version of this clip.
    ///
    /// See the [audio_player module documentation](mod@crate::audio_player) for usage examples.
    #[must_use]
    pub const fn pcm_clip() -> PcmClipBuf<SAMPLE_RATE_HZ, PCM_SAMPLE_COUNT> {
        __pcm_clip_from_samples([0; PCM_SAMPLE_COUNT])
    }

    /// `const` function that returns the compressed (ADPCM) encoding for this clip.
    ///
    /// See the [audio_player module documentation](mod@crate::audio_player) for usage examples.
    #[must_use]
    pub const fn adpcm_clip() -> AdpcmClipBuf<SAMPLE_RATE_HZ, ADPCM_DATA_LEN> {
        pcm_clip().with_adpcm::<ADPCM_DATA_LEN>()
    }
}