pub struct CtrlChg {
pub start_tick: u32,
pub velocity: Velocity,
pub channel: Channel,
}Expand description
MIDI Control Change event (e.g., sustain pedal, soft pedal).
Represents a MIDI CC (Control Change) message at a specific time position. Commonly used for pedal events like damper (sustain) and soft pedal.
§Examples
// Sustain pedal on at tick 100
let sustain_on = CtrlChg::new(100, Velocity::new(127), Channel::new(0));Fields§
§start_tick: u32The tick position where this control change occurs.
velocity: VelocityThe control value (0-127).
channel: ChannelThe MIDI channel.
Implementations§
Source§impl CtrlChg
impl CtrlChg
Sourcepub fn new(start_tick: u32, velocity: Velocity, channel: Channel) -> Self
pub fn new(start_tick: u32, velocity: Velocity, channel: Channel) -> Self
Creates a new control change event.
§Arguments
start_tick- The tick position for this event.velocity- The control value (0-127).channel- The MIDI channel.
Sourcepub fn drag(&self, tick_delta: i32) -> Self
pub fn drag(&self, tick_delta: i32) -> Self
Creates a new control change with adjusted tick position (for dragging).
§Arguments
tick_delta- Amount to adjust the tick position.
Sourcepub fn with_tick_added(&self, tick_delta: i32) -> Result<Self, TickError>
pub fn with_tick_added(&self, tick_delta: i32) -> Result<Self, TickError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CtrlChg
impl<'de> Deserialize<'de> for CtrlChg
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl HaveBaseStartTick for CtrlChg
impl HaveBaseStartTick for CtrlChg
fn base_start_tick(&self) -> u32
Source§impl HaveStartTick for CtrlChg
impl HaveStartTick for CtrlChg
fn start_tick(&self) -> u32
impl Copy for CtrlChg
impl Eq for CtrlChg
impl StructuralPartialEq for CtrlChg
Auto Trait Implementations§
impl Freeze for CtrlChg
impl RefUnwindSafe for CtrlChg
impl Send for CtrlChg
impl Sync for CtrlChg
impl Unpin for CtrlChg
impl UnwindSafe for CtrlChg
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
Mutably borrows from an owned value. Read more