pub struct SingleNoteTuningChangeOptions {
    pub realtime: bool,
    pub device_id: u8,
    pub tuning_program: u8,
    pub with_bank_select: Option<u8>,
}
Expand description

Properties of the generated Single Note Tuning Change message.

Examples

let a4 = NoteLetter::A.in_octave(4).as_piano_key();
let target_pitch = Pitch::from_hz(445.0);

let tuning_change = SingleNoteTuningChange { key: a4, target_pitch };

// Use default options
let options = SingleNoteTuningChangeOptions::default();

let tuning_message = SingleNoteTuningChangeMessage::from_tuning_changes(
    &options,
    std::iter::once(tuning_change),
)
.unwrap();

assert_eq!(
    Vec::from_iter(tuning_message.sysex_bytes()),
    [[0xf0, 0x7f, 0x7f, 0x08, 0x02, // RT Single Note Tuning Change
      0, 1,                         // Tuning program / number of changes
      69, 69, 25, 5,                // Tuning changes
      0xf7]]                        // Sysex end
);

// Use custom options
let options = SingleNoteTuningChangeOptions {
    realtime: false,
    device_id: 55,
    tuning_program: 66,
    with_bank_select: Some(77),
};

let tuning_message = SingleNoteTuningChangeMessage::from_tuning_changes(
    &options,
    std::iter::once(tuning_change),
)
.unwrap();

assert_eq!(
    Vec::from_iter(tuning_message.sysex_bytes()),
    [[0xf0, 0x7e, 55, 0x08, 0x07, // Non-RT Single Note Tuning Change with Bank Select
      77, 66, 1,                  // Tuning program / tuning bank / number of changes
      69, 69, 25, 5,              // Tuning changes
      0xf7]]                      // Sysex end
);

Fields§

§realtime: bool

If set to true, generate a realtime SysEx message (defaults to true).

§device_id: u8

Specifies the device ID (defaults to broadcast/0x7f).

§tuning_program: u8

Specifies the tuning program to be affected (defaults to 0).

§with_bank_select: Option<u8>

If given, generate a Single Note Tuning Change with Bank Select message.

Trait Implementations§

source§

impl Clone for SingleNoteTuningChangeOptions

source§

fn clone(&self) -> SingleNoteTuningChangeOptions

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for SingleNoteTuningChangeOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for SingleNoteTuningChangeOptions

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Copy for SingleNoteTuningChangeOptions

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.