Skip to content

Commit

Permalink
* All devices
Browse files Browse the repository at this point in the history
  * New: Sped up arranger position changes (play position, loop, etc.). Normal, changes now 1 bar and slow, 1 quarter.
* Electra One
  * New: The last active mode is restored when returning from a different preset.
  * Fixed: Values were still set in other presets when changes appear in the DAW.
  * Fixed: Mode did not update the values when jumping back from a different preset.
* Updated PDF.
  • Loading branch information
git-moss committed Feb 20, 2023
1 parent 96021ca commit bbc5977
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 75 deletions.
Binary file modified DrivenByMoss-Manual.pdf
Binary file not shown.
3 changes: 1 addition & 2 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>de.mossgrabers</groupId>
<artifactId>DrivenByMoss</artifactId>
<name>DrivenByMoss</name>
<version>19.2.0</version>
<version>19.2.1</version>
<licenses>
<license>
<name>LGPL-2.1-or-later</name>
Expand Down Expand Up @@ -37,7 +37,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<optimize>true</optimize>
<fork>true</fork>
<source>17</source>
<target>17</target>
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>DrivenByMoss</artifactId>
<packaging>jar</packaging>
<name>DrivenByMoss</name>
<version>19.2.0</version>
<version>19.2.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down Expand Up @@ -106,7 +106,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<optimize>true</optimize>
<fork>true</fork>
<source>17</source>
<target>17</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public void resetAccent ()
public void changeAccent (final int control, final boolean slow)
{
final boolean increase = this.valueChanger.isIncrease (control);
final double frac = slow ? TransportConstants.INC_FRACTION_TIME_SLOW : TransportConstants.INC_FRACTION_TIME;
final double frac = slow ? TransportConstants.INC_FRACTION_ACCENT_SLOW : TransportConstants.INC_FRACTION_ACCENT;
this.getClip ().getAccent ().inc (increase ? frac : -frac);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import de.mossgrabers.framework.daw.midi.IMidiInput;
import de.mossgrabers.framework.daw.midi.IMidiOutput;
import de.mossgrabers.framework.featuregroup.ModeManager;
import de.mossgrabers.framework.mode.DummyMode;
import de.mossgrabers.framework.mode.Modes;
import de.mossgrabers.framework.view.DummyView;
import de.mossgrabers.framework.view.Views;
Expand Down Expand Up @@ -128,6 +129,7 @@ protected void createModes ()
modeManager.register (Modes.EQ_DEVICE_PARAMS, new EqualizerMode (surface, this.model));
modeManager.register (Modes.TRANSPORT, new TransportMode (surface, this.model));
modeManager.register (Modes.SESSION, new SessionMode (surface, this.model));
modeManager.register (Modes.DUMMY, new DummyMode<> (surface, this.model, ElectraOneControlSurface.KNOB_IDS));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -146,29 +147,26 @@ public class ElectraOneControlSurface extends AbstractControlSurface<ElectraOneC
private static final int INFO_PRESET_LIST = 0x04;
private static final int INFO_DEVICE = 0x7F;

private static final Modes [] MODES =
private static final List<Modes> MODES = new ArrayList<> ();
static
{
Modes.VOLUME,
Modes.SEND,
Modes.DEVICE_PARAMS,
Modes.EQ_DEVICE_PARAMS,
Modes.TRANSPORT,
Modes.SESSION
};
Collections.addAll (MODES, Modes.VOLUME, Modes.SEND, Modes.DEVICE_PARAMS, Modes.EQ_DEVICE_PARAMS, Modes.TRANSPORT, Modes.SESSION);
}

private static final String SET_GROUP_TITLE = "sgt(%s,\"%s\")";
private static final String SET_GROUP_TITLE = "sgt(%s,\"%s\")";

private final List<int []> sysexChunks = new ArrayList<> ();
private final IMidiInput ctrlInput;
private final IMidiOutput ctrlOutput;
private final ObjectMapper mapper = new ObjectMapper ();
private final Map<String, Integer> presetBanks = new HashMap<> ();
private final Map<String, Integer> presetIndices = new HashMap<> ();
private int bankIndex = -1;
private int presetIndex = -1;
private boolean isOnline = false;
private int [] knobStates = new int [12];
private boolean isShiftPressed;
private final List<int []> sysexChunks = new ArrayList<> ();
private final IMidiInput ctrlInput;
private final IMidiOutput ctrlOutput;
private final ObjectMapper mapper = new ObjectMapper ();
private final Map<String, Integer> presetBanks = new HashMap<> ();
private final Map<String, Integer> presetIndices = new HashMap<> ();
private int bankIndex = -1;
private int presetIndex = -1;
private boolean isOnline = false;
private int [] knobStates = new int [12];
private boolean isShiftPressed;
private Modes activeMode = null;


/**
Expand Down Expand Up @@ -518,41 +516,30 @@ private void handleSysexCommandsController (final int commandID, final int [] da
if (this.isOnline)
{
final int page = data[SUB_CMD_START_POS + 1];
if (page >= 0 && page < MODES.length)
if (page >= 0 && page < MODES.size ())
{
this.host.println ("Switching to mode: " + MODES[page].name ());
this.getModeManager ().setActive (MODES[page]);
final Modes mode = MODES.get (page);
this.host.println ("Switching to mode: " + mode.name ());
this.modeManager.setActive (mode);
}
}
break;

case EVENT_POT_TOUCH:
final IMode active = this.getModeManager ().getActive ();
if (active instanceof final AbstractElectraOneMode electraMode)
final int potID = data[SUB_CMD_START_POS + 1];
final int controlID = (data[SUB_CMD_START_POS + 3] << 7) + data[SUB_CMD_START_POS + 2];
if (potID < 0 || potID >= 12)
{
final int potID = data[SUB_CMD_START_POS + 1];
final int controlID = (data[SUB_CMD_START_POS + 3] << 7) + data[SUB_CMD_START_POS + 2];
if (potID < 0 || potID >= 12)
{
this.host.error ("Touch event with knob ID outside of range: " + potID);
return;
}

this.knobStates[potID] = data[SUB_CMD_START_POS + 4];
electraMode.setEditing (controlID, this.knobStates[potID] > 0);
this.host.error ("Touch event with knob ID outside of range: " + potID);
return;
}

this.matchStates ();
this.knobStates[potID] = data[SUB_CMD_START_POS + 4];

// TODO remove
final StringBuilder sb = new StringBuilder ();
for (int i = 0; i < 12; i++)
{
if (i == 6)
sb.append ('\n');
sb.append (this.knobStates[i]).append (' ');
}
this.host.println (sb.toString ());
}
final IMode active = this.modeManager.getActive ();
if (active instanceof final AbstractElectraOneMode electraMode)
electraMode.setEditing (controlID, this.knobStates[potID] > 0);
this.matchStates ();
break;

default:
Expand Down Expand Up @@ -635,9 +622,6 @@ private void switchToSpecificDevicePreset ()
private void updateShift (final boolean isShift)
{
this.isShiftPressed = isShift;

// TODO remove
this.host.println ("Shift: " + this.isShiftPressed);
this.setKnobSensitivityIsSlow (this.isShiftPressed);
}

Expand Down Expand Up @@ -721,11 +705,19 @@ private void handleOnlineStatus (final int bank, final int preset)
if (this.bankIndex == bank && this.presetIndex == preset)
this.setOnline ();
else
{
this.host.println ("Going offline...");
this.isOnline = false;
this.unbindAllInputControls ();
}
this.setOffline ();
}


/**
* Set the extension online.
*/
private void setOffline ()
{
this.host.println ("Going offline...");
this.isOnline = false;
this.activeMode = this.modeManager.getActiveID ();
this.modeManager.setActive (Modes.DUMMY);
}


Expand All @@ -736,17 +728,11 @@ private void setOnline ()
{
this.host.println ("Going online...");
this.isOnline = true;
this.rebindAllInputControls ();

final IMode active = this.getModeManager ().getActive ();
if (active != null)
active.onDeactivate ();

// Switching templates always selects 1st page
this.getModeManager ().setActive (Modes.VOLUME);

// Refresh all control UIs
this.forceFlush ();
if (this.activeMode == null || this.activeMode == Modes.VOLUME)
this.modeManager.setActive (Modes.VOLUME);
else
this.selectPage (MODES.indexOf (this.activeMode));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@
*/
public final class TransportConstants
{
/** 1 beat. */
public static final double INC_FRACTION_TIME = 1.0;
/** 1/20th of a beat. */
public static final double INC_FRACTION_TIME_SLOW = 1.0 / 16;
/** 1 bar. */
public static final double INC_FRACTION_TIME = 1.0 * 4;
/** 1/16th of a quarter. */
public static final double INC_FRACTION_TIME_SLOW = 1.0;

/** 1 percent. */
public static final double INC_FRACTION_ACCENT = 1.0;
/** 1/16 percent. */
public static final double INC_FRACTION_ACCENT_SLOW = 1.0 / 16;

/** The minimum tempo in BPM. */
public static final int MIN_TEMPO = 20;
public static final int MIN_TEMPO = 20;
/** The maximum tempo in BPM. */
public static final int MAX_TEMPO = 666;
public static final int MAX_TEMPO = 666;


/**
Expand Down
Binary file modified src/main/resources/Documentation/DrivenByMoss-Manual.pdf
Binary file not shown.

0 comments on commit bbc5977

Please sign in to comment.