nathanlong85 / midi_footswitch_v2

MIT License
0 stars 0 forks source link

Implement PC Buttons and LEDs #6

Open nathanlong85 opened 1 year ago

nathanlong85 commented 1 year ago

This will just be for sending PC messages initially.

nathanlong85 commented 1 year ago

Here's some quick and dirty Ruby to calculate the number of banks and preset range per bank for a given number of PC buttons

PC_COUNT = 5

num_banks = 127.0/PC_COUNT
banks = (0..num_banks).to_a

banks.each do |bank|
  min = bank * PC_COUNT

  max = 
    if min == 127
      127
    else
      m = min + (PC_COUNT - 1)
      m > 127 ? 127 : m
    end

  puts "Bank #{bank}: #{min} - #{max}"

# (0...PC_COUNT).each do |preset_multiplier|
#     preset = preset_multiplier + (bank * PC_COUNT)
#     break if preset > 127
#
#     puts preset
#end
end