Class: Webmidi::Message::UMP::ChannelVoice32
- Defined in:
- lib/webmidi/message/ump.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#data1 ⇒ Object
readonly
Returns the value of attribute data1.
-
#data2 ⇒ Object
readonly
Returns the value of attribute data2.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(status:, channel: 0, data1: 0, data2: 0, group: 0, timestamp: nil) ⇒ ChannelVoice32
constructor
A new instance of ChannelVoice32.
- #to_bytes ⇒ Object
Methods inherited from Base
Methods inherited from Base
#==, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_hex, #with
Constructor Details
#initialize(status:, channel: 0, data1: 0, data2: 0, group: 0, timestamp: nil) ⇒ ChannelVoice32
Returns a new instance of ChannelVoice32.
442 443 444 445 446 447 448 449 450 451 452 |
# File 'lib/webmidi/message/ump.rb', line 442 def initialize(status:, channel: 0, data1: 0, data2: 0, group: 0, timestamp: nil) validate_status!(status) validate_range!(channel, "Channel", 0, 15) validate_range!(data1, "Data byte 1", 0, 127) validate_range!(data2, "Data byte 2", 0, 127) @status = status @channel = channel @data1 = data1 @data2 = data2 super(message_type: :channel_voice_32, group: group, timestamp: ) end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
440 441 442 |
# File 'lib/webmidi/message/ump.rb', line 440 def channel @channel end |
#data1 ⇒ Object (readonly)
Returns the value of attribute data1.
440 441 442 |
# File 'lib/webmidi/message/ump.rb', line 440 def data1 @data1 end |
#data2 ⇒ Object (readonly)
Returns the value of attribute data2.
440 441 442 |
# File 'lib/webmidi/message/ump.rb', line 440 def data2 @data2 end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
440 441 442 |
# File 'lib/webmidi/message/ump.rb', line 440 def status @status end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
465 466 467 |
# File 'lib/webmidi/message/ump.rb', line 465 def deconstruct_keys(keys) super.merge(status: @status, channel: @channel, data1: @data1, data2: @data2) end |
#to_bytes ⇒ Object
454 455 456 457 458 459 460 461 462 463 |
# File 'lib/webmidi/message/ump.rb', line 454 def to_bytes word = (MESSAGE_TYPES[:channel_voice_32] << 28) | (@group << 24) | (status_nibble << 20) | (@channel << 16) | (@data1 << 8) | @data2 [(word >> 24) & 0xFF, (word >> 16) & 0xFF, (word >> 8) & 0xFF, word & 0xFF] end |