module MMPlayer::Instructions::MIDI
Instructions
for dealing with MIDI
Public Instance Methods
Assign a callback for the given MIDI
control change @param [Integer] index The MIDI
control change index to assign the callback for or nil for all @param [Proc] callback The callback to execute when a matching message is received @return [Hash]
# File lib/mmplayer/instructions/midi.rb, line 37 def on_cc(index = nil, &callback) @midi.add_cc_callback(index, &callback) end
Assign a callback for a given MIDI
note @param [Integer, String] note A MIDI
note eg 64 “F4” or nil for all @param [Proc] callback The callback to execute when a matching message is received @return [Hash]
# File lib/mmplayer/instructions/midi.rb, line 28 def on_note(note = nil, &callback) @midi.add_note_callback(note, &callback) end
Assign a callback for a given MIDI
system command @param [String, Symbol] note A MIDI
system command eg :start, :continue, :stop @param [Proc] callback The callback to execute when a matching message is received @return [Hash]
# File lib/mmplayer/instructions/midi.rb, line 19 def on_system(command, &callback) @midi.add_system_callback(command, &callback) end
Set the MIDI
channel to receive messages on @param [Integer, nil] num The channel number 0-15 or nil for all
# File lib/mmplayer/instructions/midi.rb, line 10 def receive_channel(num) @midi.channel = num end