pub struct ParameterNumberMessage { /* private fields */ }
Expand description

A MIDI Parameter Number message, either registered (RPN) or non-registered (NRPN).

MIDI systems emit those by sending up to 4 short Control Change messages in a row. The ParameterNumberMessageScanner can be used to extract such messages from a stream of ShortMessages.

Example

use helgoboss_midi::{
    controller_numbers, Channel, ParameterNumberMessage, RawShortMessage, U14,
    DataEntryByteOrder::MsbFirst
};

let msg =
    ParameterNumberMessage::registered_14_bit(Channel::new(0), U14::new(420), U14::new(15000));
assert_eq!(msg.channel().get(), 0);
assert_eq!(msg.number().get(), 420);
assert_eq!(msg.value().get(), 15000);
assert!(msg.is_registered());
assert!(msg.is_14_bit());
let short_messages: [Option<RawShortMessage>; 4] = msg.to_short_messages(MsbFirst);
use helgoboss_midi::test_util::control_change;
assert_eq!(
    short_messages,
    [
        Some(control_change(0, 101, 3)),
        Some(control_change(0, 100, 36)),
        Some(control_change(0, 6, 117)),
        Some(control_change(0, 38, 24)),
    ]
);

Implementations

Creates an NRPN message with a 7-bit data-entry value.

Creates an NRPN message with a 14-bit data-entry value.

Creates an NRPN message with a data decrement value.

Creates an NRPN message with a data increment value.

Creates an RPN message with a 7-bit data-entry value.

Creates an RPN message with a 14-bit data-entry value.

Creates an RPN message with a data decrement value.

Creates an RPN message with a data increment value.

Returns the channel of this message.

Returns the parameter number of this message.

Returns the value of this message.

If it’s just a 7-bit message, the value is <= 127.

Returns true if this message has a 14-bit value and false if only a 7-bit value.

Returns whether this message uses a registered parameter number.

Returns the data type of the value in this message.

Translates this message into up to 4 short Control Change messages, which need to be sent in a row in order to encode this (N)RPN message.

If this message has a 14-bit value, all returned short messages are Some and the given data entry byte order is respected. If it has a 7-bit value only, the last short message is None.

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

Converts to this type from the input type.

Feeds this value into the given Hasher. Read more

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

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.