module MVLC::Instructions::MIDI

Instructions for dealing with MIDI

Public Instance Methods

cc(index = nil, &callback)
Alias for: on_cc
note(note = nil, &callback)
Alias for: on_note
on_cc(index = nil, &callback) click to toggle source

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/mvlc/instructions/midi.rb, line 37
def on_cc(index = nil, &callback)
  @midi.add_cc_callback(index, &callback)
end
Also aliased as: cc
on_note(note = nil, &callback) click to toggle source

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/mvlc/instructions/midi.rb, line 28
def on_note(note = nil, &callback)
  @midi.add_note_callback(note, &callback)
end
Also aliased as: note
on_system(command, &callback) click to toggle source

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/mvlc/instructions/midi.rb, line 19
def on_system(command, &callback)
  @midi.add_system_callback(command, &callback)
end
Also aliased as: system
receive_channel(num) click to toggle source

Set the MIDI channel to receive messages on @param [Integer, nil] num The channel number 0-15 or nil for all

# File lib/mvlc/instructions/midi.rb, line 10
def receive_channel(num)
  @midi.channel = num
end
Also aliased as: rx_channel
rx_channel(num)
Alias for: receive_channel
system(command, &callback)
Alias for: on_system