Struct tune::mts::ScaleOctaveTuningOptions
source · [−]pub struct ScaleOctaveTuningOptions {
pub realtime: bool,
pub device_id: u8,
pub channels: Channels,
pub format: ScaleOctaveTuningFormat,
}
Expand description
Properties of the generated Scale/Octave Tuning message.
Examples
let octave_tuning = ScaleOctaveTuning {
c: Ratio::from_cents(10.0),
csh: Ratio::from_cents(-200.0), // Will be clamped
d: Ratio::from_cents(200.0), // Will be clamped
..Default::default()
};
// Use default options
let options = ScaleOctaveTuningOptions::default();
let tuning_message = ScaleOctaveTuningMessage::from_octave_tuning(
&options,
&octave_tuning,
)
.unwrap();
assert_eq!(
tuning_message.sysex_bytes(),
[0xf0, 0x7e, 0x7f, 0x08, 0x08, // Non-RT Scale/Octave Tuning (1-Byte)
0b00000011, 0b01111111, 0b01111111, // Channel bits
74, 0, 127, 64, 64, 64, 64, 64, 64, 64, 64, 64, // Tuning changes (C - B)
0xf7] // Sysex end
);
// Use custom options
let options = ScaleOctaveTuningOptions {
realtime: true,
device_id: 55,
channels: HashSet::from([0, 3, 6, 9, 12, 15]).into(),
format: ScaleOctaveTuningFormat::TwoByte,
};
let tuning_message = ScaleOctaveTuningMessage::from_octave_tuning(
&options,
&octave_tuning,
)
.unwrap();
assert_eq!(
tuning_message.sysex_bytes(),
[0xf0, 0x7f, 55, 0x08, 0x09, // RT Scale/Octave Tuning (2-Byte)
0b00000010, 0b00100100, 0b01001001, // Channel bits
70, 51, 0, 0, 127, 127, 64, 0, 64, 0, 64, 0, // Tuning changes (C - F)
64, 0, 64, 0, 64, 0, 64, 0, 64, 0, 64, 0, // Tuning changes (F# - B)
0xf7] // Sysex end
);
Fields
realtime: bool
If set to true, generate a realtime SysEx message (defaults to false
).
device_id: u8
Specifies the device ID (defaults to broadcast/0x7f).
channels: Channels
Specifies the channels that are affected by the tuning change (defaults to Channels::All
).
format: ScaleOctaveTuningFormat
Specifies whether to send a 1-byte or 2-byte message (defaults to ScaleOctaveTuningFormat::OneByte
).
Trait Implementations
sourceimpl Clone for ScaleOctaveTuningOptions
impl Clone for ScaleOctaveTuningOptions
sourcefn clone(&self) -> ScaleOctaveTuningOptions
fn clone(&self) -> ScaleOctaveTuningOptions
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 ScaleOctaveTuningOptions
impl Debug for ScaleOctaveTuningOptions
Auto Trait Implementations
impl RefUnwindSafe for ScaleOctaveTuningOptions
impl Send for ScaleOctaveTuningOptions
impl Sync for ScaleOctaveTuningOptions
impl Unpin for ScaleOctaveTuningOptions
impl UnwindSafe for ScaleOctaveTuningOptions
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