PlayerState

Struct PlayerState 

Source
pub struct PlayerState {
    pub song_pattern_position: u32,
    pub current_line: u32,
    pub song_has_ended: bool,
    pub has_looped: bool,
    /* private fields */
}
Expand description

Keeps track of all the dynamic state required for playing the song.

Fields§

§song_pattern_position: u32§current_line: u32

current line position in the pattern. Every pattern has 64 lines

§song_has_ended: bool

set when the song stops playing

§has_looped: bool

set when the song loops. The player does not unset this flag after it has been set. To detect subsequent loops the flag to be manually unset by the client

Implementations§

Source§

impl PlayerState

Source

pub fn new(num_channels: u32, device_sample_rate: u32) -> PlayerState

Source

pub fn get_song_line<'a>(&self, song: &'a Song) -> &'a Vec<Note>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.