Skip to content

Commit

Permalink
* Akai Fire
Browse files Browse the repository at this point in the history
  * Fixed: Also prevent deletion of note in sequencer when knob was touched but not turned.
* Komplete Kontrol MkI
  * Fixed: Interpretation of knob speed was wrong.
  • Loading branch information
git-moss committed Aug 13, 2020
1 parent 33cc004 commit 39b7d45
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 20 deletions.
Binary file modified DrivenByMoss-Manual.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public void init (final ISettingsUI globalSettings, final ISettingsUI documentSe
///////////////////////////
// Session

this.activateFlipSessionSetting (globalSettings);
this.activateSelectClipOnLaunchSetting (globalSettings);
this.activateDrawRecordStripeSetting (globalSettings);
this.activateActionForRecArmedPad (globalSettings);
Expand Down
14 changes: 13 additions & 1 deletion src/main/java/de/mossgrabers/controller/fire/mode/NoteMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ public void onKnobTouch (final int index, final boolean isTouched)

this.isKnobTouched[index] = isTouched;
if (isTouched)
{
this.clip.startEdit (this.channel, this.step, this.note);
this.preventNoteDeletion ();
}
else
this.clip.stopEdit ();
}
Expand Down Expand Up @@ -115,14 +118,23 @@ public void onKnobValue (final int index, final int value)
// This is the select knob
case 4:
if (this.host.canEdit (EditCapability.NOTE_EDIT_TRANSPOSE))
{
this.clip.changeStepTranspose (this.channel, this.step, this.note, value);
this.preventNoteDeletion ();
}
break;

default:
return;
}
}

// Note was modified, prevent deletion of note on button up

/**
* Note was modified, prevent deletion of note on button up.
*/
private void preventNoteDeletion ()
{
final View activeView = this.surface.getViewManager ().getActiveView ();
if (activeView instanceof AbstractSequencerView)
AbstractSequencerView.class.cast (activeView).setNoteEdited ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected void registerTriggerCommands ()
this.addButton (ButtonID.MUTE, "Back", new BackButtonCommand (this.model, surface), Kontrol1ControlSurface.BUTTON_BACK, () -> this.getModeColor (ButtonID.MUTE));
this.addButton (ButtonID.SOLO, "Enter", new EnterButtonCommand (this.model, surface), Kontrol1ControlSurface.BUTTON_ENTER, () -> this.getModeColor (ButtonID.SOLO));

this.addButton (ButtonID.BROWSE, "Browse", new BrowserCommand<> (this.model, surface), Kontrol1ControlSurface.BUTTON_BROWSE, () -> this.getModeColor (ButtonID.BROWSE));
this.addButton (ButtonID.BROWSE, "Browse", new BrowserCommand<> (this.model, surface, ButtonID.SHIFT, null), Kontrol1ControlSurface.BUTTON_BROWSE, () -> this.getModeColor (ButtonID.BROWSE));
this.addButton (ButtonID.SHIFT, "Shift", NopCommand.INSTANCE, Kontrol1ControlSurface.BUTTON_SHIFT);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,13 @@ public void mainEncoderChanged (final boolean valueIncreased)

/** {@inheritDoc} */
@Override
public void encoderChanged (final int encIndex, final boolean valueIncreased)
public void encoderChanged (final int encIndex, final int change)
{
final int v;
if (this.isShiftPressed ())
v = valueIncreased ? 1 : 127;
v = change < 0 ? 127 : 1;
else
v = valueIncreased ? 3 : 125;

v = change < 0 ? 127 + change : change;
this.getContinuous (ContinuousID.get (ContinuousID.KNOB1, encIndex)).getCommand ().execute (v);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -857,16 +857,28 @@ private void processHIDMessage (final byte reportID, final byte [] data)
final int pos = start + 2 * encIndex;

final int value = Byte.toUnsignedInt (data[pos]) | Byte.toUnsignedInt (data[pos + 1]) << 8;
final int hValue = Byte.toUnsignedInt (data[pos + 1]);
if (this.encoderValues[encIndex] != value)
{
final int prevHValue = (this.encoderValues[encIndex] & 0xF00) >> 8;
final boolean valueIncreased = (this.encoderValues[encIndex] < value || prevHValue == 3 && hValue == 0) && !(prevHValue == 0 && hValue == 3);
// Value is between 0 and 999. It increases or descrease and wraps around if it goes
// below 0 or above 999

int diff = value - this.encoderValues[encIndex];
// Check for wrap around from 999 to 0 when increasing
if (diff < -500)
diff = 999 + diff;
// Check for wrap around from 0 to 999 when decreasing
else if (diff > 500)
diff = diff - 999;

this.encoderValues[encIndex] = value;
if (!this.isFirstStateMsg)
{
final int ei = encIndex;
this.host.scheduleTask ( () -> this.callback.encoderChanged (ei, valueIncreased), 0);

// Slow down, minimum value seems to be 4
final int control = diff / 4;

this.host.scheduleTask ( () -> this.callback.encoderChanged (ei, control), 0);
}
encoderChange = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public interface UIChangeCallback
* An encoder was turned.
*
* @param encIndex The index of the encoder (0-7)
* @param valueIncreased The change value
* @param change The change value
*/
void encoderChanged (int encIndex, boolean valueIncreased);
void encoderChanged (int encIndex, int change);


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ public void onKnobTouch (final int index, final boolean isTouched)
@Override
public void updateDisplay ()
{
if (!this.model.hasSelectedDevice ())
{
this.surface.getModeManager ().restoreMode ();
return;
}

final ITextDisplay d = this.surface.getTextDisplay ();
final IBrowser browser = this.model.getBrowser ();
if (!browser.isActive ())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import de.mossgrabers.framework.daw.data.bank.ISlotBank;
import de.mossgrabers.framework.daw.data.bank.ITrackBank;
import de.mossgrabers.framework.utils.ButtonEvent;
import de.mossgrabers.framework.utils.FrameworkException;
import de.mossgrabers.framework.utils.Pair;


Expand Down Expand Up @@ -276,8 +277,12 @@ public boolean isBirdsEyeActive ()
*/
protected void drawSessionGrid ()
{
final ITrackBank tb = this.model.getCurrentTrackBank ();
final boolean flipSession = this.surface.getConfiguration ().isFlipSession ();

if (flipSession && this.columns != this.rows)
throw new FrameworkException ("Session flip is only supported for same size of rows and columns!");

final ITrackBank tb = this.model.getCurrentTrackBank ();
for (int x = 0; x < this.columns; x++)
{
final ITrack t = tb.getItem (x);
Expand Down

0 comments on commit 39b7d45

Please sign in to comment.