Skip to main content

ChannelWriter

Struct ChannelWriter 

Source
pub struct ChannelWriter<'a> { /* private fields */ }
Expand description

Appends notes and rests to one channel of a Score.

Implementations§

Source§

impl ChannelWriter<'_>

Source

pub fn position(&self) -> u64

The position in ticks where the next note or rest starts.

Source

pub fn instrument(&mut self, index: usize) -> Result<&mut Self>

Selects the instrument for the following notes, by its index.

Source

pub fn volume(&mut self, volume: u8) -> Result<&mut Self>

Channel volume for the following notes, 0 through 15. The default is 15.

Source

pub fn gate(&mut self, eighths: u8) -> Result<&mut Self>

The part of each following note, in eighths, played before its release. The default is 8.

Source

pub fn note(&mut self, pitch: Pitch, length: Length) -> Result<&mut Self>

Source

pub fn note_with_velocity( &mut self, pitch: Pitch, length: Length, velocity: u8, ) -> Result<&mut Self>

Appends a note with velocity 0..=127, independently of channel volume.

Source

pub fn chord(&mut self, pitches: &[Pitch], length: Length) -> Result<&mut Self>

Appends 1..=16 distinct simultaneous pitches, advancing once. Requires a synthwave instrument and no more members than its configured voice limit.

Source

pub fn chord_with_velocity( &mut self, pitches: &[Pitch], length: Length, velocity: u8, ) -> Result<&mut Self>

Source

pub fn rest(&mut self, length: Length) -> Result<&mut Self>

Source

pub fn tie(&mut self, length: Length) -> Result<&mut Self>

Lengthens the previous note, or the previous rest, by length.

Source

pub fn loop_point(&mut self) -> Result<&mut Self>

Marks the current position as the song’s loop point. All channels that mark one must mark the same tick.

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for ChannelWriter<'a>

§

impl<'a> Freeze for ChannelWriter<'a>

§

impl<'a> RefUnwindSafe for ChannelWriter<'a>

§

impl<'a> Send for ChannelWriter<'a>

§

impl<'a> Sync for ChannelWriter<'a>

§

impl<'a> Unpin for ChannelWriter<'a>

§

impl<'a> UnsafeUnpin for ChannelWriter<'a>

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.