Module: MIDIMessage::SystemMessage

Included in:
SystemCommon, SystemRealtime
Defined in:
lib/midi-message/system_message.rb

Overview

Common MIDI system message behavior

Constant Summary collapse

STATUS =
0xF

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object


8
9
10
# File 'lib/midi-message/system_message.rb', line 8

def self.included(base)
  base.send(:include, Message)
end

Instance Method Details

#strip_redundant_nibble(byte) ⇒ Fixnum

In the case of something like SystemCommon.new(0xF2, 0x00, 0x08), the first nibble F is redundant because all system messages start with 0xF and it can be assumed. However, the this method looks to see if this has occurred and strips the redundancy

Parameters:

  • byte (Fixnum)

    The byte to strip of a redundant 0xF

Returns:

  • (Fixnum)

    The remaining nibble


17
18
19
# File 'lib/midi-message/system_message.rb', line 17

def strip_redundant_nibble(byte)
  byte > STATUS ? (byte & 0x0F) : byte
end