Class: Webmidi::Message::UMP::Data128
- Inherits:
-
Raw
show all
- Defined in:
- lib/webmidi/message/ump.rb
Instance Attribute Summary
Attributes inherited from Raw
#words
Attributes inherited from Base
#group, #message_type
Attributes inherited from Base
#timestamp
Instance Method Summary
collapse
Methods inherited from Raw
#to_bytes, #with
Methods inherited from Base
#with
Methods inherited from Base
#==, #channel, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_bytes, #to_hex, #with
Constructor Details
#initialize(words:, group: 0, timestamp: nil) ⇒ Data128
Returns a new instance of Data128.
289
290
291
|
# File 'lib/webmidi/message/ump.rb', line 289
def initialize(words:, group: 0, timestamp: nil)
super(message_type: :data_128, words: words, group: group, timestamp: timestamp)
end
|
Instance Method Details
#byte_count ⇒ Object
297
298
299
|
# File 'lib/webmidi/message/ump.rb', line 297
def byte_count
(@words.first >> 16) & 0x0F
end
|
#data_bytes ⇒ Object
305
306
307
|
# File 'lib/webmidi/message/ump.rb', line 305
def data_bytes
word_bytes(@words.first & 0xFF, *@words[1..]).first(byte_count)
end
|
#deconstruct_keys(keys) ⇒ Object
309
310
311
312
313
314
315
316
|
# File 'lib/webmidi/message/ump.rb', line 309
def deconstruct_keys(keys)
super.merge(
packet_format: packet_format,
byte_count: byte_count,
stream_id: stream_id,
data_bytes: data_bytes
)
end
|
293
294
295
|
# File 'lib/webmidi/message/ump.rb', line 293
def packet_format
DATA_PACKET_FORMAT_BY_NIBBLE.fetch((@words.first >> 20) & 0x0F, :unknown)
end
|
#stream_id ⇒ Object
301
302
303
|
# File 'lib/webmidi/message/ump.rb', line 301
def stream_id
(@words.first >> 8) & 0xFF
end
|