Class: Webmidi::Message::UMP::SystemCommon

Inherits:
Raw
  • Object
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) ⇒ SystemCommon

Returns a new instance of SystemCommon.



234
235
236
# File 'lib/webmidi/message/ump.rb', line 234

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

Instance Method Details

#data1Object



246
247
248
# File 'lib/webmidi/message/ump.rb', line 246

def data1
  (@words.first >> 8) & 0x7F
end

#data2Object



250
251
252
# File 'lib/webmidi/message/ump.rb', line 250

def data2
  @words.first & 0x7F
end

#deconstruct_keys(keys) ⇒ Object



254
255
256
# File 'lib/webmidi/message/ump.rb', line 254

def deconstruct_keys(keys)
  super.merge(status_byte: status_byte, status: status, data1: data1, data2: data2)
end

#statusObject



242
243
244
# File 'lib/webmidi/message/ump.rb', line 242

def status
  SYSTEM_COMMON_STATUSES.fetch(status_byte, :unknown)
end

#status_byteObject



238
239
240
# File 'lib/webmidi/message/ump.rb', line 238

def status_byte
  (@words.first >> 16) & 0xFF
end