Method: PM::PatchMaster#panic

Defined in:
lib/patchmaster/patchmaster.rb

#panic(individual_notes = false) ⇒ Object

Sends the CM_ALL_NOTES_OFF controller message to all output instruments on all 16 MIDI channels. If individual_notes is true send individual NOTE_OFF messages to all notes as well.



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/patchmaster/patchmaster.rb', line 158

def panic(individual_notes=false)
  debug("panic(#{individual_notes})")
  @outputs.each do |out|
    buf = []
    MIDI_CHANNELS.times do |chan|
      buf += [CONTROLLER + chan, CM_ALL_NOTES_OFF, 0]
      if individual_notes
        buf += (0..127).collect { |note| [NOTE_OFF + chan, note, 0] }.flatten
      end
    end
    out.midi_out(buf)
  end
end