From: Mark Slee Date: Sat, 19 Oct 2013 22:05:35 +0000 (-0700) Subject: Fix up preset selection with two APCs X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f6394aaaec0b3c3f364a376860967f84959e0580;p=SugarCubes.git Fix up preset selection with two APCs --- 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()) {