Struct tune::mts::SingleNoteTuningChangeOptions
source · [−]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
sourceimpl Clone for SingleNoteTuningChangeOptions
impl Clone for SingleNoteTuningChangeOptions
sourcefn clone(&self) -> SingleNoteTuningChangeOptions
fn clone(&self) -> SingleNoteTuningChangeOptions
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SingleNoteTuningChangeOptions
impl Debug for SingleNoteTuningChangeOptions
impl Copy for SingleNoteTuningChangeOptions
Auto Trait Implementations
impl RefUnwindSafe for SingleNoteTuningChangeOptions
impl Send for SingleNoteTuningChangeOptions
impl Sync for SingleNoteTuningChangeOptions
impl Unpin for SingleNoteTuningChangeOptions
impl UnwindSafe for SingleNoteTuningChangeOptions
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more