Class: Webmidi::Message::UMP::FlexData

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

#==, #deconstruct, #eql?, #hash, #same_bytes?, #same_event?, #to_binary, #to_bytes, #to_hex, #with

Constructor Details

#initialize(words:, group: 0, timestamp: nil) ⇒ FlexData

Returns a new instance of FlexData.



328
329
330
# File 'lib/webmidi/message/ump.rb', line 328

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

Instance Method Details

#addressObject



336
337
338
# File 'lib/webmidi/message/ump.rb', line 336

def address
  (@words.first >> 20) & 0x03
end

#channelObject



340
341
342
# File 'lib/webmidi/message/ump.rb', line 340

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

#data_wordsObject



352
353
354
# File 'lib/webmidi/message/ump.rb', line 352

def data_words
  @words[1..]
end

#deconstruct_keys(keys) ⇒ Object



356
357
358
359
360
361
362
363
364
365
# File 'lib/webmidi/message/ump.rb', line 356

def deconstruct_keys(keys)
  super.merge(
    format: format,
    address: address,
    channel: channel,
    status_bank: status_bank,
    status: status,
    data_words: data_words
  )
end

#formatObject



332
333
334
# File 'lib/webmidi/message/ump.rb', line 332

def format
  (@words.first >> 22) & 0x03
end

#statusObject



348
349
350
# File 'lib/webmidi/message/ump.rb', line 348

def status
  @words.first & 0xFF
end

#status_bankObject



344
345
346
# File 'lib/webmidi/message/ump.rb', line 344

def status_bank
  (@words.first >> 8) & 0xFF
end