pub struct AudioPlayerGenerated;target_os=none only.Expand description
Sample struct type generated by the 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 module documentation, then return
here for a complete list of available methods and associated constants.
Auto-generated.
Implementations§
Source§impl AudioPlayerGenerated
impl AudioPlayerGenerated
Sourcepub const SAMPLE_RATE_HZ: u32 = VOICE_22050_HZ
pub const SAMPLE_RATE_HZ: u32 = VOICE_22050_HZ
Sample rate used for PCM playback by this generated player type.
Sourcepub const INITIAL_VOLUME: Volume = Volume::MAX
pub const INITIAL_VOLUME: Volume = Volume::MAX
Initial runtime volume relative to Self::MAX_VOLUME.
Sourcepub const MAX_VOLUME: Volume = Volume::MAX
pub const MAX_VOLUME: Volume = Volume::MAX
Runtime volume ceiling for this generated player type.
Sourcepub const fn samples_ms(duration_ms: u32) -> usize
pub const fn samples_ms(duration_ms: u32) -> usize
Returns how many samples are needed for a duration in milliseconds at this player’s sample rate.
Sourcepub const fn silence<const SAMPLE_COUNT: usize>() -> AudioClipBuf<{ Self::SAMPLE_RATE_HZ }, SAMPLE_COUNT>
pub const fn silence<const SAMPLE_COUNT: usize>() -> AudioClipBuf<{ Self::SAMPLE_RATE_HZ }, SAMPLE_COUNT>
Creates a silent clip at this player’s sample rate.
See the audio_player module docs for usage.
Sourcepub const fn tone<const SAMPLE_COUNT: usize>(
frequency_hz: u32,
) -> AudioClipBuf<{ Self::SAMPLE_RATE_HZ }, SAMPLE_COUNT>
pub const fn tone<const SAMPLE_COUNT: usize>( frequency_hz: u32, ) -> AudioClipBuf<{ Self::SAMPLE_RATE_HZ }, SAMPLE_COUNT>
Creates a sine-wave clip at this player’s sample rate.
See the audio_player module docs for usage.
Sourcepub fn new(
data_pin: Peri<'static, PIN_8>,
bit_clock_pin: Peri<'static, PIN_9>,
word_select_pin: Peri<'static, PIN_10>,
pio: Peri<'static, PIO1>,
dma: Peri<'static, DMA_CH0>,
spawner: Spawner,
) -> Result<&'static Self>
pub fn new( data_pin: Peri<'static, PIN_8>, bit_clock_pin: Peri<'static, PIN_9>, word_select_pin: Peri<'static, PIN_10>, pio: Peri<'static, PIO1>, dma: Peri<'static, DMA_CH0>, spawner: Spawner, ) -> Result<&'static Self>
Creates and spawns the generated audio player instance.
See the audio_player module docs for usage.
Sourcepub fn play<const CLIP_COUNT: usize>(
&self,
audio_clips: [&'static AudioClip<{ Self::SAMPLE_RATE_HZ }>; CLIP_COUNT],
at_end: AtEnd,
)
pub fn play<const CLIP_COUNT: usize>( &self, audio_clips: [&'static AudioClip<{ Self::SAMPLE_RATE_HZ }>; CLIP_COUNT], at_end: AtEnd, )
Starts playback of one or more static audio clips.
See the audio_player module docs for usage.
Sourcepub fn stop(&self)
pub fn stop(&self)
Stops current playback as soon as possible.
See the audio_player module docs for usage.
Sourcepub fn set_volume(&self, volume: Volume)
pub fn set_volume(&self, volume: Volume)
Sets runtime playback volume relative to Self::MAX_VOLUME.
See the audio_player module docs for usage.
Sourcepub fn volume(&self) -> Volume
pub fn volume(&self) -> Volume
Returns the current runtime playback volume relative to Self::MAX_VOLUME.
See the audio_player module docs for usage.
Auto Trait Implementations§
impl Freeze for AudioPlayerGenerated
impl RefUnwindSafe for AudioPlayerGenerated
impl Send for AudioPlayerGenerated
impl Sync for AudioPlayerGenerated
impl Unpin for AudioPlayerGenerated
impl UnwindSafe for AudioPlayerGenerated
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more