From f6394aaaec0b3c3f364a376860967f84959e0580 Mon Sep 17 00:00:00 2001 From: Mark Slee Date: Sat, 19 Oct 2013 15:05:35 -0700 Subject: [PATCH] Fix up preset selection with two APCs --- _MIDI.pde | 4 ++-- _Presets.pde | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/_MIDI.pde b/_MIDI.pde index 2abd30d..fc06538 100644 --- a/_MIDI.pde +++ b/_MIDI.pde @@ -585,9 +585,9 @@ public class APC40MidiInput extends GenericDeviceMidiInput { case 52: // CLIP STOP if (nChan < PresetManager.NUM_PRESETS) { if (shiftOn) { - presetManager.store(nChan); + presetManager.store(getTargetDeck(), nChan); } else { - presetManager.select(nChan); + presetManager.select(getTargetDeck(), nChan); } } break; diff --git a/_Presets.pde b/_Presets.pde index 2f716f2..1d1ca42 100644 --- a/_Presets.pde +++ b/_Presets.pde @@ -67,16 +67,16 @@ class PresetManager implements LXParameter.Listener { } } - public void select(int index) { - presets[index].select(); + public void select(Engine.Deck deck, int index) { + presets[index].select(deck); } - public void store(int index) { + public void store(Engine.Deck deck, int index) { presets[index].store(midiEngine.getFocusedPattern()); for (PresetListener listener : listeners) { listener.onPresetStored(presets[index]); } - select(index); + select(deck, index); } public void onPresetLoaded(Preset preset, LXPattern pattern) { @@ -179,8 +179,7 @@ class Preset { manager.write(); } - public void select() { - Engine.Deck deck = midiEngine.getFocusedDeck(); + public void select(Engine.Deck deck) { for (LXPattern pattern : deck.getPatterns()) { if (pattern.getClass().getName().equals(className)) { for (String pLabel : parameters.keySet()) { -- 2.34.1