Class: MIDIMessage::ChannelMessage::Message

Inherits:
Object
  • Object
show all
Includes:
MIDIMessage::ChannelMessage
Defined in:
lib/midi-message/channel_message.rb

Overview

Use this if you want to instantiate a raw channel message

For example ChannelMessage::Message.new(0x9, 0x0, 0x40, 0x57) creates a raw note-on message

Constant Summary collapse

DISPLAY_NAME =
"Channel Message"

Constants included from MIDIMessage

MIDIMessage::ChannelPressure, MIDIMessage::Controller, PolyAftertouch, PolyPressure, PolyphonicPressure, VERSION

Instance Attribute Summary

Attributes included from MIDIMessage::ChannelMessage

#data, #name

Instance Method Summary collapse

Methods included from MIDIMessage::ChannelMessage

new

Methods included from MIDIMessage

parse, with_context

Constructor Details

#initialize(*data) ⇒ RawChannelMessage

Build a Channel Mssage from raw nibbles and bytes eg ChannelMessage.new(0x9, 0x0, 0x40, 0x40)

Parameters:

  • data (*Fixnum)

    The status nibbles and data bytes


152
153
154
# File 'lib/midi-message/channel_message.rb', line 152

def initialize(*data)
  initialize_channel_message(*data)
end

Instance Method Details

#to_typeChannelMessage

Convert this RawChannelMessage to one of the more specific ChannelMessage types eg. RawChannelMessage.new(0x9, 0x0, 0x40, 0x40).to_type would result in NoteMessage.new(0x0, 0x40, 0x40)

Returns:


160
161
162
163
# File 'lib/midi-message/channel_message.rb', line 160

def to_type
  status = (@status[0] << 4) + (@status[1])
  MIDIMessage.parse(status, *@data)
end