Class: MIDIMessage::ChannelMessage::Message
- Inherits:
-
Object
- Object
- MIDIMessage::ChannelMessage::Message
- 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
Instance Method Summary collapse
-
#initialize(*data) ⇒ RawChannelMessage
constructor
Build a Channel Mssage from raw nibbles and bytes eg ChannelMessage.new(0x9, 0x0, 0x40, 0x40).
-
#to_type ⇒ ChannelMessage
Convert this RawChannelMessage to one of the more specific ChannelMessage types eg.
Methods included from MIDIMessage::ChannelMessage
Methods included from MIDIMessage
Constructor Details
#initialize(*data) ⇒ RawChannelMessage
Build a Channel Mssage from raw nibbles and bytes eg ChannelMessage.new(0x9, 0x0, 0x40, 0x40)
128 129 130 |
# File 'lib/midi-message/channel_message.rb', line 128 def initialize(*data) (*data) end |
Instance Method Details
#to_type ⇒ ChannelMessage
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)
136 137 138 139 |
# File 'lib/midi-message/channel_message.rb', line 136 def to_type status = (@status[0] << 4) + (@status[1]) MIDIMessage.parse(status, *@data) end |