Skip to main content

Wave

Struct Wave 

Source
pub struct Wave { /* private fields */ }
Expand description

Channel 3’s settings, which play whatever load_wave last put in wave RAM.

There is no envelope here, and the volume is the four steps of WaveLevel.

Implementations§

Source§

impl Wave

Source

pub const fn new(level: WaveLevel) -> Self

The wave at level, at the lowest period.

Source

pub const fn note(self, note: Note, octave: u8) -> Self

Tune to note at octave.

This channel reads its waveform half as fast as a pulse channel, so its range sits an octave below theirs: C1 through B4 within about five cents, nothing lower to reach, and the same drift above.

Source

pub const fn at_period(self, period: u16) -> Self

Tune to a period value, which counts up rather than down: the larger it is, the higher the pitch. At most $7FF.

Source

pub const fn length(self, ticks: u16) -> Self

Stop the channel after ticks of a 256 Hz count, at most 256.

Source

pub fn play(&self)

Play on channel 3.

Triggering the channel while it is already playing can corrupt wave RAM on an original Game Boy. stop first avoids that and costs a click.

Source

pub fn retune(&self)

Change the pitch without starting the waveform over.

Source

pub fn set_level(&self)

Change the output level without starting the waveform over.

Channel 3 has no envelope, so this is how its volume moves during a note.

Trait Implementations§

Source§

impl Clone for Wave

Source§

fn clone(&self) -> Wave

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Wave

Source§

impl Eq for Wave

Source§

impl PartialEq for Wave

Source§

fn eq(&self, other: &Wave) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Wave

Auto Trait Implementations§

§

impl BankSafe for Wave

§

impl Freeze for Wave

§

impl RefUnwindSafe for Wave

§

impl Send for Wave

§

impl Sync for Wave

§

impl Unpin for Wave

§

impl UnsafeUnpin for Wave

§

impl UnwindSafe for Wave

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CellValue for T
where T: Copy + BankSafe,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.