Struct wmidi::ControlFunction

source ·
pub struct ControlFunction(pub U7);
Expand description

A Control Change signal. The names of each variant of the constants are from the 1997 MIDI 1.0 specification. The names and description reflect the standard assignment and behavior for each CC number, though manufacturers may ignore some controllers or use non-standard mappings. MIDI devices should provide a controller allocation table as part of their user manual.

  • 0 - 31: Continuous Controller Data (MSB)
  • 32 - 63: Continuous Controller Data (LSB)
  • 64 - 119: Single-byte controllers
  • 120 - 127: Channel mode messages

Setting the MSB on a continuous controller resets the LSB to zero. The LSB can be omitted afterwards if the finer resolution is not needed.

Channel mode messages affect the entire instrument and are only valid when sent over the instrument’s “basic channel”.

Tuple Fields§

§0: U7

Implementations§

source§

impl ControlFunction

source

pub const MIN: ControlFunction = _

source

pub const MAX: ControlFunction = _

source

pub const BANK_SELECT: ControlFunction = _

[MIDI 1.0] Specifies which program bank to use when changing program. The MSB and LSB are always sent as a pair, immediately followed by a program change.

source

pub const MODULATION_WHEEL: ControlFunction = _

Either known as Modulation Wheel (MIDI 1.0 and GM1) or Modulation Depth (GM2)

[GM1] “For all instruments, the Modulation Wheel will change the nature of the sound in the most natural (expected) way. i.e. depth of LFO; change of timbre; add more tine sound; etc.)”

[GM2] Specifies the vibrato (LFO pitch modulation) depth to use for that channel. The depth response ranges from 0 cents (no modulation) to the value of RPN 05.00 “Modulation Depth Range”, following a curve that is linear in cents.

source

pub const BREATH_CONTROLLER: ControlFunction = _

Effect was never standardized

source

pub const UNDEFINED_3: ControlFunction = _

source

pub const FOOT_CONTROLLER: ControlFunction = _

Effect was never standardized

source

pub const PORTAMENTO_TIME: ControlFunction = _

[MIDI 1.0] Specifies the pitch increment speed for the portamento effect. The relation between the parameter value and the speed in cents per ms is outside the MIDI specification.

source

pub const DATA_ENTRY_MSB: ControlFunction = _

[MIDI 1.0] Sets the value of the last selected RPN/NRPN.

source

pub const CHANNEL_VOLUME: ControlFunction = _

[MIDI 1.0] Specifies the mixing volume for that channel.

[GM1] The gain in dB should be equivalent to L = 40 * log10(cc7/127).

source

pub const BALANCE: ControlFunction = _

[MIDI 1.0] Specifies the volume balance for that channel. Center is 64, left/bottom is 0 and right/top is 127.

source

pub const UNDEFINED_9: ControlFunction = _

source

pub const PAN: ControlFunction = _

[MIDI 1.0] Specifies the sound location (in stereo) balance for that channel. Center is 64, left is 0 and right is 127.

source

pub const EXPRESSION_CONTROLLER: ControlFunction = _

[MIDI 1.0] Specifies the volume accent for that channel. Unlike ChannelVolume (7), this one is meant to change during performance to create diminuendos and crescendos.

[GM1] The gain in dB should be equivalent to L = 40 * log10(cc7/127) + 40 * log10(cc11/127).

source

pub const EFFECT_CONTROL_1: ControlFunction = _

source

pub const EFFECT_CONTROL_2: ControlFunction = _

source

pub const UNDEFINED_14: ControlFunction = _

source

pub const UNDEFINED_15: ControlFunction = _

source

pub const GENERAL_PURPOSE_CONTROLLER_1: ControlFunction = _

[MIDI 1.0] 2 bytes general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_2: ControlFunction = _

[MIDI 1.0] 2 bytes general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_3: ControlFunction = _

[MIDI 1.0] 2 bytes general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_4: ControlFunction = _

[MIDI 1.0] 2 bytes general-purpose controller for device-specific features.

source

pub const UNDEFINED_20: ControlFunction = _

source

pub const UNDEFINED_21: ControlFunction = _

source

pub const UNDEFINED_22: ControlFunction = _

source

pub const UNDEFINED_23: ControlFunction = _

source

pub const UNDEFINED_24: ControlFunction = _

source

pub const UNDEFINED_25: ControlFunction = _

source

pub const UNDEFINED_26: ControlFunction = _

source

pub const UNDEFINED_27: ControlFunction = _

source

pub const UNDEFINED_28: ControlFunction = _

source

pub const UNDEFINED_29: ControlFunction = _

source

pub const UNDEFINED_30: ControlFunction = _

source

pub const UNDEFINED_31: ControlFunction = _

source

pub const BANK_SELECT_LSB: ControlFunction = _

source

pub const MODULATION_WHEEL_LSB: ControlFunction = _

source

pub const BREATH_CONTROLLER_LSB: ControlFunction = _

source

pub const UNDEFINED_3_LSB: ControlFunction = _

source

pub const FOOT_CONTROLLER_LSB: ControlFunction = _

source

pub const PORTAMENTO_TIME_LSB: ControlFunction = _

source

pub const DATA_ENTRY_LSB: ControlFunction = _

[MIDI 1.0] Sets the value of the last selected RPN/NRPN

source

pub const CHANNEL_VOLUME_LSB: ControlFunction = _

source

pub const BALANCE_LSB: ControlFunction = _

source

pub const UNDEFINED_9_LSB: ControlFunction = _

source

pub const PAN_LSB: ControlFunction = _

source

pub const EXPRESSION_CONTROLLER_LSB: ControlFunction = _

source

pub const EFFECT_CONTROL_1_LSB: ControlFunction = _

source

pub const EFFECT_CONTROL_2_LSB: ControlFunction = _

source

pub const UNDEFINED_14_LSB: ControlFunction = _

source

pub const UNDEFINED_15_LSB: ControlFunction = _

source

pub const GENERAL_PURPOSE_CONTROLLER_1_LSB: ControlFunction = _

source

pub const GENERAL_PURPOSE_CONTROLLER_2_LSB: ControlFunction = _

source

pub const GENERAL_PURPOSE_CONTROLLER_3_LSB: ControlFunction = _

source

pub const GENERAL_PURPOSE_CONTROLLER_4_LSB: ControlFunction = _

source

pub const UNDEFINED_20_LSB: ControlFunction = _

source

pub const UNDEFINED_21_LSB: ControlFunction = _

source

pub const UNDEFINED_22_LSB: ControlFunction = _

source

pub const UNDEFINED_23_LSB: ControlFunction = _

source

pub const UNDEFINED_24_LSB: ControlFunction = _

source

pub const UNDEFINED_25_LSB: ControlFunction = _

source

pub const UNDEFINED_26_LSB: ControlFunction = _

source

pub const UNDEFINED_27_LSB: ControlFunction = _

source

pub const UNDEFINED_28_LSB: ControlFunction = _

source

pub const UNDEFINED_29_LSB: ControlFunction = _

source

pub const UNDEFINED_30_LSB: ControlFunction = _

source

pub const UNDEFINED_31_LSB: ControlFunction = _

source

pub const DAMPER_PEDAL: ControlFunction = _

Either known as the Hold, Sustain or Damper pedal.

[MIDI 1.0] Response to NoteOff and AllNotesOff should be delayed while this switch is on (value >= 64) until it transitions to off.

[GM2] May be treated as a continuous controller instead of a switch for the “Half Damper” and “re-damper” effects.

source

pub const PORTAMENTO_ON_OFF: ControlFunction = _

[MIDI 1.0] Turns the Portamento effect on (value >= 64) or off.

source

pub const SOSTENUTO: ControlFunction = _

[MIDI 1.0] Same as DamperPedal (64), but only affects the notes being held while the switch transitions to on (value >= 64). Any note played while the switch is already on behaves as normal.

source

pub const SOFT_PEDAL: ControlFunction = _

[GM2] Notes played while this switch is on (value >= 64) should be played at a reduced volume.

source

pub const LEGATO_FOOTSWITCH: ControlFunction = _

[MIDI 1.0] This switch turns on (value >= 64) the monophonic legato response mode for that channel, where receiving a NoteOn while a note is already playing will change the pitch of the current note accordingly (without replaying the attack or re-attacking the envelopes).

source

pub const HOLD_2: ControlFunction = _

[MIDI 1.0] Additional controller for hold functions that don’t match the specified definition of DamperPedal (64).

source

pub const SOUND_CONTROLLER_1: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, Default Name: “Sound Variation”

source

pub const SOUND_CONTROLLER_2: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, Default Name: “Timbre/Harmonic Intensity”

[GM2] Sets the strength of the resonance effect for filter(s) for the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_3: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, Default Name: “Release Time”

[GM2] Controls the release time of the envelope for the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_4: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, Default Name: “Attack Time”

[GM2] Controls the attack time of the envelope for the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_5: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, Default Name: “Brightness”

[GM2] Controls the preset cut-off frequency of the filter. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_6: ControlFunction = _

[RP-021] Remappable Sound Controller, Default Name: “Decay Time”

[GM2] Controls the decay time of the envelope for the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_7: ControlFunction = _

[RP-021] Remappable Sound Controller, Default Name: “Vibrato Rate”

[GM2] Controls the vibrato rate on the specified Channel relative to the sound’s preset rate. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_8: ControlFunction = _

[RP-021] Remappable Sound Controller, Default Name: “Vibrato Depth”

[GM2] Controls the vibrato depth for the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_9: ControlFunction = _

[RP-021] Remappable Sound Controller, Default Name: “Vibrato Delay”

[GM2] Controls the vibrato delay on the specified Channel. Exact behavior is left to the manufacturer’s discretion.

source

pub const SOUND_CONTROLLER_10: ControlFunction = _

[MIDI 1.0] Remappable Sound Controller, no default

source

pub const GENERAL_PURPOSE_CONTROLLER_5: ControlFunction = _

[MIDI 1.0] 1 byte general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_6: ControlFunction = _

[MIDI 1.0] 1 byte general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_7: ControlFunction = _

[MIDI 1.0] 1 byte general-purpose controller for device-specific features.

source

pub const GENERAL_PURPOSE_CONTROLLER_8: ControlFunction = _

[MIDI 1.0] 1 byte general-purpose controller for device-specific features.

source

pub const PORTAMENTO_CONTROL: ControlFunction = _

[MIDI 1.0] Specifies the starting MIDI note from which the next NoteOn will slide.

source

pub const UNDEFINED_85: ControlFunction = _

source

pub const UNDEFINED_86: ControlFunction = _

source

pub const UNDEFINED_87: ControlFunction = _

source

pub const UNDEFINED_88: ControlFunction = _

[CA-031] High Resolution Velocity Prefix

If sent before a NoteOn message, the value of this controller acts as an LSB for the velocity of that note.

source

pub const UNDEFINED_89: ControlFunction = _

source

pub const UNDEFINED_90: ControlFunction = _

source

pub const EFFECTS_1_DEPTH: ControlFunction = _

[MIDI 1.0] General-purpose effect depth Controller (default: “External Effects Depth”)

[RP-023] No-longer general-purpose, renamed to “Reverb Send Level”

[GM2] Specifies the Reverb Send Level for that channel, linearly from 0% to 100% of amplitude.

source

pub const EFFECTS_2_DEPTH: ControlFunction = _

[MIDI 1.0] General-purpose effect depth Controller (default: “Tremolo Depth”)

source

pub const EFFECTS_3_DEPTH: ControlFunction = _

[MIDI 1.0] General-purpose effect depth Controller (default: “Chorus Depth”)

[RP-023] No-longer general-purpose, renamed to “Chorus Send Level”

[GM2] Specifies the Chorus Send Level for that channel, linearly from 0% to 100% of amplitude.

source

pub const EFFECTS_4_DEPTH: ControlFunction = _

[MIDI 1.0] General-purpose effect depth Controller (default: “Celeste (Detune) Depth”)

source

pub const EFFECTS_5_DEPTH: ControlFunction = _

[MIDI 1.0] General-purpose effect depth Controller (default: “Phaser Depth”)

source

pub const DATA_INCREMENT: ControlFunction = _

[RP-018] Increments the value of a RPN/NRPN by 1, regardless of the value byte. The actual behavior depends on the parameter.

source

pub const DATA_DECREMENT: ControlFunction = _

[RP-018] Decrements the value of a RPN/NRPN by 1, regardless of the value byte. The actual behavior depends on the parameter.

source

pub const NON_REGISTERED_PARAMETER_NUMBER_LSB: ControlFunction = _

[MIDI 1.0] Selects a parameter to be modified by DataIncrement (96), DataDecrement (97) and DataEntry (6 & 38). Unlike RPNs, NRPNs are manufacturer-specific.

source

pub const NON_REGISTERED_PARAMETER_NUMBER_MSB: ControlFunction = _

source

pub const REGISTERED_PARAMETER_NUMBER_LSB: ControlFunction = _

[MIDI 1.0] Selects a parameter to be modified by DataIncrement (96), DataDecrement (97) and DataEntry (6 & 38).

[MIDI 1.0] MSB=00 LSB=00: Pitch Bend Sensitivity

Specifies the range of the pitch bender (both up and down), with the MSB value being in semitones and the LSB in cents.

[RP-018] Incrementing/decrementing this parameter changes the LSB, which wraps into the MSB at 100 cents to change it by one semitone.

[MIDI 1.0] MSB=00 LSB=01: (Channel) Fine Tuning

Specifies the note displacement from A440 in 8192ths of 100 cents, with 0x40 0x00 acting as zero, 0x00 0x00 as -8192 (-100 cents) and 0x7F 0x7F as +8191 (almost +100 cents).

[RP-018] Incrementing/decrementing this parameter changes the LSB by 1.

[MIDI 1.0] MSB=00 LSB=02: (Channel) Coarse Tuning

Specifies the note displacement from A440 in increments of 100 cents for the MSB, (the LSB is ignored), with 0x40 acting as zero, 0x00 as -64 (-64 semitones) and 0x7F as +63 (+63 semitones).

[RP-018] Incrementing/decrementing this parameter changes the MSB by 1.

[CA-026] MSB=00 LSB=05: Modulation Depth Range

[GM2] Specifies the peak value of ModulationWheel (1), with the MSB value being in semitones and the LSB being in 128ths of 100 cents.

[CA-026] Incrementing/decrementing this parameter changes the LSB by 1.

[GM2] MSB=7F LSB=7F: RPN NULL

This RPN is invalid, data entry will be ignored while this parameter is selected.

source

pub const REGISTERED_PARAMETER_NUMBER_MSB: ControlFunction = _

source

pub const UNDEFINED_102: ControlFunction = _

source

pub const UNDEFINED_103: ControlFunction = _

source

pub const UNDEFINED_104: ControlFunction = _

source

pub const UNDEFINED_105: ControlFunction = _

source

pub const UNDEFINED_106: ControlFunction = _

source

pub const UNDEFINED_107: ControlFunction = _

source

pub const UNDEFINED_108: ControlFunction = _

source

pub const UNDEFINED_109: ControlFunction = _

source

pub const UNDEFINED_110: ControlFunction = _

source

pub const UNDEFINED_111: ControlFunction = _

source

pub const UNDEFINED_112: ControlFunction = _

source

pub const UNDEFINED_113: ControlFunction = _

source

pub const UNDEFINED_114: ControlFunction = _

source

pub const UNDEFINED_115: ControlFunction = _

source

pub const UNDEFINED_116: ControlFunction = _

source

pub const UNDEFINED_117: ControlFunction = _

source

pub const UNDEFINED_118: ControlFunction = _

source

pub const UNDEFINED_119: ControlFunction = _

source

pub const ALL_SOUND_OFF: ControlFunction = _

[MIDI 1.0] Indicates that the receiver should immediately silence (without going through the release phase and ignoring sustain) all notes currently sounding on that channel. May also be used to turn off lights.

source

pub const RESET_ALL_CONTROLLERS: ControlFunction = _

[MIDI 1.0] Indicates that all controllers (including pitch bend and pressure) should be reset to an ideal initial state. This message is ignored if the device is in Omni mode (mode 1 or 2).

[RP-015] Indicates that the following controllers should be reset as such: specified channel:

  • Modulation (cc1): Set to 0
  • Expression (cc11): Set to 127
  • DamperPedal (cc64): Set to 0
  • PortamentoOnOff (cc65): Set to 0
  • Sostenuto (cc66): Set to 0
  • SoftPedal (cc67): Set to 0
  • NRPN (cc98 & cc99): Set to NULL NRPN (0x7F 0x7F)
  • RPN (cc100 & cc101): Set to NULL RPN (0x7F 0x7F)

Also reset the following for the specified channel:

  • Reset pitch-bend to center (0x40 0x00)
  • Reset channel pressure to 0
  • Reset polyphonic pressure of all notes to 0
source

pub const LOCAL_CONTROL: ControlFunction = _

[MIDI 1.0] Specifies whether the instrument should react to notes being physically played on it (0: ControlFunction = off, 127 = on), as opposed to notes sent via MIDI-in.

source

pub const ALL_NOTES_OFF: ControlFunction = _

[MIDI 1.0] Ignored in Omni mode (mode 1 & 2). In Poly operation (mode 3), acts as a NoteOff for all notes playing on the instrument’s basic channel (it is ignored for all other channels). In Mono operation (mode 4), acts as a NoteOff for all notes playing on the specified channel. In all cases, notes being played on the instrument itself should remain unaffected.

[GM2] Turns off all Notes sounding on the specified Channel.

source

pub const OMNI_MODE_ON: ControlFunction = _

[MIDI 1.0] Same as AllNotesOff (123), then set receiver to mode 1 (omni-on, poly) or 2 (omni-on, mono) based on the current mode.

[GM2] Same as AllNotesOff (123), since GM2 does not support Omni mode.

source

pub const OMNI_MODE_OFF: ControlFunction = _

[MIDI 1.0] Same as AllNotesOff (123), then set receiver to mode 3 (omni-off, poly) or 4 (omni-off, mono) based on the current mode.

[GM2] Same as AllNotesOff (123), since GM2 does not support Omni mode.

source

pub const MONO_OPERATION: ControlFunction = _

[MIDI 1.0] Same as AllNotesOff (123), then set receiver to mode 2 (omni-on, mono) or 4 (omni-off, mono) based on the current mode. The value byte indicates how many channels to use, with 0 being “auto”.

[GM2] Same as AllNotesOff (123), then set the channel to mode 4. Will be ignored if the value byte is not equal to 1 of if the channel is a rhythm channel.

source

pub const POLY_OPERATION: ControlFunction = _

[MIDI 1.0] Same as AllNotesOff (123), then set receiver to mode 1 (omni-on, poly) or 3 (omni-off, poly) based on the current mode.

[GM2] Same as AllNotesOff (123), then set the channel to mode 3.

Trait Implementations§

source§

impl Clone for ControlFunction

source§

fn clone(&self) -> ControlFunction

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 ControlFunction

source§

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

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

impl From<ControlFunction> for U7

source§

fn from(control_function: ControlFunction) -> U7

Converts to this type from the input type.
source§

impl From<ControlFunction> for u8

source§

fn from(control_function: ControlFunction) -> u8

Converts to this type from the input type.
source§

impl From<U7> for ControlFunction

source§

fn from(data: U7) -> ControlFunction

Converts to this type from the input type.
source§

impl Hash for ControlFunction

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for ControlFunction

source§

fn cmp(&self, other: &ControlFunction) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for ControlFunction

source§

fn eq(&self, other: &ControlFunction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for ControlFunction

source§

fn partial_cmp(&self, other: &ControlFunction) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for ControlFunction

source§

impl Eq for ControlFunction

source§

impl StructuralEq for ControlFunction

source§

impl StructuralPartialEq for ControlFunction

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.