Class: Clef::Midi::ChannelMap

Inherits:
Object
  • Object
show all
Defined in:
lib/clef/midi/channel_map.rb

Instance Method Summary collapse

Instance Method Details

#channel_for(staff_index, percussion: false) ⇒ Integer

Parameters:

  • staff_index (Integer)
  • percussion (Boolean) (defaults to: false)

Returns:

  • (Integer)


9
10
11
12
13
14
# File 'lib/clef/midi/channel_map.rb', line 9

def channel_for(staff_index, percussion: false)
  return 9 if percussion

  base = staff_index % 15
  (base >= 9) ? base + 1 : base
end