pub struct ParameterNumberMessage {
pub channel: MidiChannel,
pub kind: ParameterNumberKind,
pub parameter: u16,
pub value: f32,
pub is_increment: bool,
pub is_decrement: bool,
}Expand description
A complete RPN or NRPN message with its 14-bit value.
This represents a fully-decoded RPN/NRPN sequence after the RpnTracker
has assembled all the CC messages.
§Example
ⓘ
use beamer_core::{RpnTracker, ControlChange, cc, rpn};
let mut tracker = RpnTracker::new();
// Simulate receiving CC sequence for Pitch Bend Sensitivity = 12 semitones
tracker.process_cc(&ControlChange { channel: 0, controller: cc::RPN_MSB, value: 0.0 });
tracker.process_cc(&ControlChange { channel: 0, controller: cc::RPN_LSB, value: 0.0 });
let msg = tracker.process_cc(&ControlChange { channel: 0, controller: cc::DATA_ENTRY_MSB, value: 12.0/127.0 });
if let Some(msg) = msg {
assert!(msg.is_pitch_bend_sensitivity());
let (semitones, cents) = msg.pitch_bend_sensitivity();
assert_eq!(semitones, 12);
}Fields§
§channel: MidiChannelMIDI channel (0-15).
kind: ParameterNumberKindRPN or NRPN.
parameter: u1614-bit parameter number (MSB << 7 | LSB).
value: f3214-bit data value, normalized to 0.0-1.0.
is_increment: boolWhether this was a data increment (+1 to current value).
is_decrement: boolWhether this was a data decrement (-1 from current value).
Implementations§
Source§impl ParameterNumberMessage
impl ParameterNumberMessage
Sourcepub const fn rpn(channel: MidiChannel, parameter: u16, value: f32) -> Self
pub const fn rpn(channel: MidiChannel, parameter: u16, value: f32) -> Self
Create a new RPN message.
Sourcepub const fn nrpn(channel: MidiChannel, parameter: u16, value: f32) -> Self
pub const fn nrpn(channel: MidiChannel, parameter: u16, value: f32) -> Self
Create a new NRPN message.
Sourcepub fn is_pitch_bend_sensitivity(&self) -> bool
pub fn is_pitch_bend_sensitivity(&self) -> bool
Check if this is the Pitch Bend Sensitivity RPN.
Sourcepub fn pitch_bend_sensitivity(&self) -> (u8, u8)
pub fn pitch_bend_sensitivity(&self) -> (u8, u8)
For Pitch Bend Sensitivity: get semitones and cents.
Returns (semitones, cents) where MSB = semitones (0-127) and LSB = cents (0-127).
Trait Implementations§
Source§impl Clone for ParameterNumberMessage
impl Clone for ParameterNumberMessage
Source§fn clone(&self) -> ParameterNumberMessage
fn clone(&self) -> ParameterNumberMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ParameterNumberMessage
impl Debug for ParameterNumberMessage
Source§impl PartialEq for ParameterNumberMessage
impl PartialEq for ParameterNumberMessage
impl Copy for ParameterNumberMessage
impl StructuralPartialEq for ParameterNumberMessage
Auto Trait Implementations§
impl Freeze for ParameterNumberMessage
impl RefUnwindSafe for ParameterNumberMessage
impl Send for ParameterNumberMessage
impl Sync for ParameterNumberMessage
impl Unpin for ParameterNumberMessage
impl UnwindSafe for ParameterNumberMessage
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