[−][src]Trait helgoboss_midi::ShortMessageFactory
Static methods for creating short MIDI messages.
This trait is supposed to be implemented for structs that represent a short MIDI message and also support their creation. Only one method needs to be implemented, the rest is done by default methods.
Required methods
pub unsafe fn from_bytes_unchecked(bytes: (u8, U7, U7)) -> Self
[src]
Creates a MIDI message from the given bytes without checking the status byte. The tuple consists of the status byte, data byte 1 and data byte 2 in exactly this order.
Safety
Callers must make sure that the given status byte is valid, otherwise an invalid MIDI message will be created.
Implementations can therefore assume that the given status byte is valid. This method is
usually called by from_bytes
, which checks the necessary preconditions.
Provided methods
pub fn from_bytes(bytes: (u8, U7, U7)) -> Result<Self, FromBytesError>
[src]
Creates a MIDI message from the given bytes. The tuple consists of the status byte, data byte 1 and data byte 2 in exactly this order.
Errors
If the given status byte is invalid, an error will be returned.
Design
Although one could argue that calling such a function with illegal input values is a
violation of its contract, this function returns a result rather than panicking. It's
because - unlike the functions in test_util
- this function is primarily intended
to be used in real-world situations where the bytes come from somewhere else (e.g. from a
DAW) and therefore acts a bit like a parse function where client code should be able to
recover from wrong input.
pub fn from_other(msg: &impl ShortMessage) -> Self
[src]
Creates this message from a MIDI message of another type.
pub fn channel_message(
r#type: ShortMessageType,
channel: Channel,
data_1: U7,
data_2: U7
) -> Self
[src]
r#type: ShortMessageType,
channel: Channel,
data_1: U7,
data_2: U7
) -> Self
Creates a Channel message.
Panics
This function panics if the given type is not a channel message type.
pub fn system_common_message(
r#type: ShortMessageType,
data_1: U7,
data_2: U7
) -> Self
[src]
r#type: ShortMessageType,
data_1: U7,
data_2: U7
) -> Self
Creates a System Common message.
Panics
This function panics if the given type is not a System Common message type.
pub fn system_real_time_message(r#type: ShortMessageType) -> Self
[src]
Creates a System Real Time message.
Panics
This function panics if the given type is not a System Real Time message type.
pub fn note_on(channel: Channel, key_number: KeyNumber, velocity: U7) -> Self
[src]
Creates a Note On message.
pub fn note_off(channel: Channel, key_number: KeyNumber, velocity: U7) -> Self
[src]
Creates a Note Off message.
pub fn control_change(
channel: Channel,
controller_number: ControllerNumber,
control_value: U7
) -> Self
[src]
channel: Channel,
controller_number: ControllerNumber,
control_value: U7
) -> Self
Creates a Control Change message.
pub fn program_change(channel: Channel, program_number: U7) -> Self
[src]
Creates a Program Change message.
pub fn polyphonic_key_pressure(
channel: Channel,
key_number: KeyNumber,
pressure_amount: U7
) -> Self
[src]
channel: Channel,
key_number: KeyNumber,
pressure_amount: U7
) -> Self
Creates a Polyphonic Key Pressure message.
pub fn channel_pressure(channel: Channel, pressure_amount: U7) -> Self
[src]
Creates a Channel Pressure message.
pub fn pitch_bend_change(channel: Channel, pitch_bend_value: U14) -> Self
[src]
Creates a Pitch Bend Change message.
pub fn system_exclusive_start() -> Self
[src]
Creates the start of a System Exclusive message.
pub fn time_code_quarter_frame(frame: TimeCodeQuarterFrame) -> Self
[src]
Creates a MIDI Time Code Quarter Frame message.
pub fn song_position_pointer(position: U14) -> Self
[src]
Creates a Song Position Pointer message.
pub fn song_select(song_number: U7) -> Self
[src]
Creates a Song Select message.
pub fn tune_request() -> Self
[src]
Creates a Tune Request message.
pub fn system_exclusive_end() -> Self
[src]
Creates the end of a System Exclusive message.
pub fn timing_clock() -> Self
[src]
Creates a Timing Clock message.
pub fn start() -> Self
[src]
Creates a Start message.
pub fn continue() -> Self
[src]
Creates a Continue message.
pub fn stop() -> Self
[src]
Creates a Stop message.
pub fn active_sensing() -> Self
[src]
Creates an Active Sensing message.
pub fn system_reset() -> Self
[src]
Creates a System Reset message.
Implementors
impl ShortMessageFactory for StructuredShortMessage
[src]
pub unsafe fn from_bytes_unchecked(
(status_byte, data_byte_1, data_byte_2): (u8, U7, U7)
) -> Self
[src]
(status_byte, data_byte_1, data_byte_2): (u8, U7, U7)
) -> Self