Class: Webmidi::Message::UMP::Data64

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) ⇒ Data64

Returns a new instance of Data64.



260
261
262
# File 'lib/webmidi/message/ump.rb', line 260

def initialize(words:, group: 0, timestamp: nil)
  super(message_type: :data_64, words: words, group: group, timestamp: timestamp)
end

Instance Method Details

#byte_countObject



268
269
270
# File 'lib/webmidi/message/ump.rb', line 268

def byte_count
  (@words.first >> 16) & 0x0F
end

#data_bytesObject



272
273
274
275
276
277
278
279
280
281
# File 'lib/webmidi/message/ump.rb', line 272

def data_bytes
  [
    (@words.first >> 8) & 0xFF,
    @words.first & 0xFF,
    (@words[1] >> 24) & 0xFF,
    (@words[1] >> 16) & 0xFF,
    (@words[1] >> 8) & 0xFF,
    @words[1] & 0xFF
  ].first(byte_count)
end

#deconstruct_keys(keys) ⇒ Object



283
284
285
# File 'lib/webmidi/message/ump.rb', line 283

def deconstruct_keys(keys)
  super.merge(packet_format: packet_format, byte_count: byte_count, data_bytes: data_bytes)
end

#packet_formatObject



264
265
266
# File 'lib/webmidi/message/ump.rb', line 264

def packet_format
  DATA_PACKET_FORMAT_BY_NIBBLE.fetch((@words.first >> 20) & 0x0F, :unknown)
end