Module: MIDIEvents::ChannelMessage

Includes:
MIDIEvents
Included in:
ChannelAftertouch, Message, ControlChange, PitchBend, PolyphonicAftertouch, ProgramChange
Defined in:
lib/midi-events/channel_message.rb

Overview

Common behavior amongst Channel Message types

Defined Under Namespace

Modules: ClassMethods Classes: Accessors, Message

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/midi-events/channel_message.rb', line 6

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/midi-events/channel_message.rb', line 6

def name
  @name
end

Class Method Details

.new(*data, &block) ⇒ RawChannelMessage

Shortcut to RawChannelMessage.new aka build a ChannelMessage from raw nibbles and bytes eg ChannelMessage.new(0x9, 0x0, 0x40, 0x40)

Parameters:

  • data (*Fixnum)

    The status nibbles and data bytes

Returns:

  • (RawChannelMessage)

    The resulting RawChannelMessage object



13
14
15
# File 'lib/midi-events/channel_message.rb', line 13

def self.new(*data, &block)
  Message.new(*data, &block)
end

Instance Method Details

#initialize(*data) ⇒ Object

Parameters:

  • data (*Fixnum)

    The status nibbles and data bytes



18
19
20
21
22
23
# File 'lib/midi-events/channel_message.rb', line 18

def initialize(*data)
  data = data.dup
  options = data.last.is_a?(Hash) ? data.pop : {}
  add_constant_value(options[:const], data) unless options[:const].nil?
  initialize_channel_message(self.class.type_for_status, *data)
end