// @generated by `cargo check-all`. Do not edit by hand.
//! Module containing [`AudioPlayerGenerated`], the sample struct type generated
//! by the [`audio_player!`](macro@crate::audio_player) macro.
//!
//! Auto-generated.

#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
use crate::audio_player;

#[cfg(all(not(doc), not(feature = "host"), target_os = "none"))]
audio_player! {
    pub AudioPlayerGenerated {
        data_pin: GPIO21,
        bit_clock_pin: GPIO12,
        word_select_pin: GPIO13,
        sample_rate_hz: crate::audio_player::VOICE_22050_HZ,
    }
}

#[cfg(doc)]
/// Sample struct type generated by the [`audio_player!`](macro@crate::audio_player)
/// macro, showing methods and associated constants.
///
/// This page serves as the reference for what a generated audio player type
/// provides. For first-time readers, start with the
/// [`audio_player`](mod@crate::audio_player) module documentation, then return
/// here for a complete list of available methods and associated constants.
///
/// The macro also generates [`AudioPlayerGeneratedPlayable`], a trait-object
/// alias for clip sources at the same sample rate.
///
/// Auto-generated.
pub struct AudioPlayerGenerated;

#[cfg(doc)]
/// Trait-object clip source type at [`VOICE_22050_HZ`].
///
/// See the [audio_player module documentation](mod@crate::audio_player) for
/// usage examples.
pub type AudioPlayerGeneratedPlayable = dyn Playable<VOICE_22050_HZ>;

#[cfg(doc)]
use crate::audio_player::{AtEnd, AudioPlayer, Playable, Volume, VOICE_22050_HZ};
#[cfg(doc)]
use crate::Result;

#[cfg(doc)]
impl AudioPlayerGenerated {
    /// Sample rate used for playback by this generated player type.
    ///
    /// See the [`audio_player`](mod@crate::audio_player) module docs for usage.
    pub const SAMPLE_RATE_HZ: u32 = VOICE_22050_HZ;
    /// Maximum number of clips accepted by `play(...)`.
    pub const MAX_CLIPS: usize = 16;
    /// Initial runtime volume relative to [`Self::MAX_VOLUME`].
    pub const INITIAL_VOLUME: Volume = Volume::MAX;
    /// Runtime volume ceiling for this generated player type.
    pub const MAX_VOLUME: Volume = Volume::MAX;

    /// Creates and spawns the generated audio player instance.
    ///
    /// See the [`audio_player`](mod@crate::audio_player) module docs for usage.
    pub fn new(
        data_pin: impl Sized,
        bit_clock_pin: impl Sized,
        word_select_pin: impl Sized,
        i2s: impl Sized,
        dma: impl Sized,
        spawner: embassy_executor::Spawner,
    ) -> Result<&'static Self> {
        static INSTANCE: AudioPlayerGenerated = AudioPlayerGenerated;
        let _ = (data_pin, bit_clock_pin, word_select_pin, i2s, dma, spawner);
        Ok(&INSTANCE)
    }
}

#[cfg(doc)]
impl AudioPlayer<VOICE_22050_HZ> for AudioPlayerGenerated {
    const SAMPLE_RATE_HZ: u32 = VOICE_22050_HZ;
    const MAX_CLIPS: usize = 16;
    const INITIAL_VOLUME: Volume = Volume::MAX;
    const MAX_VOLUME: Volume = Volume::MAX;

    fn play<I>(&self, audio_clips: I, at_end: AtEnd)
    where
        I: IntoIterator<Item = &'static dyn Playable<VOICE_22050_HZ>>,
    {
        let _ = (audio_clips, at_end);
    }

    fn stop(&self) {}

    async fn wait_until_stopped(&self) {}

    fn set_volume(&self, volume: Volume) {
        let _ = volume;
    }

    fn volume(&self) -> Volume {
        Volume::MAX
    }
}
