Class: Webmidi::Message::UMP::ChannelVoice64
- Defined in:
- lib/webmidi/message/ump.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#attribute_type ⇒ Object
readonly
Returns the value of attribute attribute_type.
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#note ⇒ Object
readonly
Returns the value of attribute note.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#velocity ⇒ Object
readonly
Returns the value of attribute velocity.
Attributes inherited from Base
Attributes inherited from Base
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(status:, channel: 0, note: 0, velocity: 0, attribute_type: 0, attribute: 0, group: 0, timestamp: nil) ⇒ ChannelVoice64
constructor
A new instance of ChannelVoice64.
- #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, note: 0, velocity: 0, attribute_type: 0, attribute: 0, group: 0, timestamp: nil) ⇒ ChannelVoice64
Returns a new instance of ChannelVoice64.
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'lib/webmidi/message/ump.rb', line 371 def initialize(status:, channel: 0, note: 0, velocity: 0, attribute_type: 0, attribute: 0, group: 0, timestamp: nil) validate_status!(status) validate_range!(channel, "Channel", 0, 15) validate_range!(note, "Note/controller", 0, 127) validate_range!(attribute_type, "Attribute type", 0, 255) validate_range!(attribute, "Attribute", 0, 0xFFFF) validate_velocity!(status, velocity) @status = status @channel = channel @note = note @velocity = velocity @attribute_type = attribute_type @attribute = attribute super(message_type: :channel_voice_64, group: group, timestamp: ) end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def attribute @attribute end |
#attribute_type ⇒ Object (readonly)
Returns the value of attribute attribute_type.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def attribute_type @attribute_type end |
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def channel @channel end |
#note ⇒ Object (readonly)
Returns the value of attribute note.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def note @note end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def status @status end |
#velocity ⇒ Object (readonly)
Returns the value of attribute velocity.
369 370 371 |
# File 'lib/webmidi/message/ump.rb', line 369 def velocity @velocity end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
402 403 404 405 406 407 |
# File 'lib/webmidi/message/ump.rb', line 402 def deconstruct_keys(keys) super.merge( status: @status, channel: @channel, note: @note, velocity: @velocity, attribute_type: @attribute_type, attribute: @attribute ) end |
#to_bytes ⇒ Object
389 390 391 392 393 394 395 396 397 398 399 400 |
# File 'lib/webmidi/message/ump.rb', line 389 def to_bytes word1 = (MESSAGE_TYPES[:channel_voice_64] << 28) | (@group << 24) | (status_nibble << 20) | (@channel << 16) | (@note << 8) | data2 word2 = word2_value [(word1 >> 24) & 0xFF, (word1 >> 16) & 0xFF, (word1 >> 8) & 0xFF, word1 & 0xFF, (word2 >> 24) & 0xFF, (word2 >> 16) & 0xFF, (word2 >> 8) & 0xFF, word2 & 0xFF] end |