Module: MIDIMessage::ChannelMessage

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

Overview

Common behavior amongst Channel Message types

Defined Under Namespace

Modules: ClassMethods Classes: Accessors, Message

Constant Summary

Constants included from MIDIMessage

ChannelPressure, Controller, PolyAftertouch, PolyPressure, PolyphonicPressure, VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MIDIMessage

parse, with_context

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data


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

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name


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

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


15
16
17
# File 'lib/midi-message/channel_message.rb', line 15

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


20
21
22
23
24
25
# File 'lib/midi-message/channel_message.rb', line 20

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