Module: Patch::IO::MIDI::Action
Overview
Find and identify MIDI Actions
Instance Method Summary collapse
-
#find_by_index(actions, index) ⇒ Hash
Find an action in the given patch for the given cc index.
-
#midi?(action) ⇒ Boolean
Is the given action MIDI?.
-
#midi_actions(actions) ⇒ Array<Hash>
Filter the given actions only to return MIDI actions.
Instance Method Details
#find_by_index(actions, index) ⇒ Hash
Find an action in the given patch for the given cc index
30 31 32 33 34 |
# File 'lib/patch/io/midi/action.rb', line 30 def find_by_index(actions, index) midi_actions(actions).find do |action| action[:midi][:index] == index end end |
#midi?(action) ⇒ Boolean
Is the given action MIDI?
15 16 17 |
# File 'lib/patch/io/midi/action.rb', line 15 def midi?(action) !action[:midi].nil? && !action[:midi][:index].nil? end |
#midi_actions(actions) ⇒ Array<Hash>
Filter the given actions only to return MIDI actions
22 23 24 |
# File 'lib/patch/io/midi/action.rb', line 22 def midi_actions(actions) actions.select { |action| midi?(action) } end |