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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.