device-envoy-core 0.0.6-alpha.0

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

#[cfg(doc)]
#[allow(non_snake_case)]
/// Sample module generated by the [`adpcm_clip!`](macro@crate::audio_player::adpcm_clip)
/// macro, showing the generated items.
///
/// This page serves as the reference for what a generated ADPCM clip module
/// provides. For first-time readers, start with the
/// [`audio_player`](mod@crate::audio_player) module documentation, then return
/// here for the generated 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 AdpcmClipGenerated {
    use crate::audio_player::{
        __adpcm_data_len_for_pcm_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 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> {
        AdpcmClipBuf::new(256, 505, [0; ADPCM_DATA_LEN])
    }

    /// `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> {
        adpcm_clip().with_pcm::<PCM_SAMPLE_COUNT>()
    }
}