Skip to content

Commit

Permalink
* Generic Flexi
Browse files Browse the repository at this point in the history
  * New: MIDI channel can be set to All but this will disable the reflection of the value to the device.
* Push 2
  * New: A pinned track shows a pin as its' icon.
  • Loading branch information
git-moss committed Sep 4, 2021
1 parent a7f9b1b commit a04dffe
Show file tree
Hide file tree
Showing 13 changed files with 159 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ protected void updateDisplayElements (final IGraphicDisplay display, final Optio
final boolean enableVUMeters = config.isEnableVUMeters ();
final int vuR = valueChanger.toDisplayValue (enableVUMeters ? layer.getVuRight () : 0);
final int vuL = valueChanger.toDisplayValue (enableVUMeters ? layer.getVuLeft () : 0);
display.addChannelElement (topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue (layer.getVolume ()), valueChanger.toDisplayValue (layer.getModulatedVolume ()), this.isKnobTouched[0] ? layer.getVolumeStr (8) : "", valueChanger.toDisplayValue (layer.getPan ()), valueChanger.toDisplayValue (layer.getModulatedPan ()), this.isKnobTouched[1] ? layer.getPanStr (8) : "", vuL, vuR, layer.isMute (), layer.isSolo (), false, layer.isActivated (), 0);
display.addChannelElement (topMenu, isTopMenuOn, bottomMenu, ChannelType.LAYER, bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue (layer.getVolume ()), valueChanger.toDisplayValue (layer.getModulatedVolume ()), this.isKnobTouched[0] ? layer.getVolumeStr (8) : "", valueChanger.toDisplayValue (layer.getPan ()), valueChanger.toDisplayValue (layer.getModulatedPan ()), this.isKnobTouched[1] ? layer.getPanStr (8) : "", vuL, vuR, layer.isMute (), layer.isSolo (), false, layer.isActivated (), 0, false);
}
else if (sendsIndex == i && l.isPresent ())
{
Expand Down Expand Up @@ -484,7 +484,7 @@ protected void updateChannelDisplay (final IGraphicDisplay display, final int se
final boolean enableVUMeters = this.configuration.isEnableVUMeters ();
final int vuR = valueChanger.toDisplayValue (enableVUMeters ? layer.getVuRight () : 0);
final int vuL = valueChanger.toDisplayValue (enableVUMeters ? layer.getVuLeft () : 0);
display.addChannelElement (selectedMenu, topMenu, isTopMenuOn, layer.doesExist () ? layer.getName () : "", ChannelType.LAYER, layer.getColor (), layer.isSelected (), valueChanger.toDisplayValue (layer.getVolume ()), valueChanger.toDisplayValue (layer.getModulatedVolume ()), isVolume && this.isKnobTouched[i] ? layer.getVolumeStr (8) : "", valueChanger.toDisplayValue (layer.getPan ()), valueChanger.toDisplayValue (layer.getModulatedPan ()), isPan && this.isKnobTouched[i] ? layer.getPanStr () : "", vuL, vuR, layer.isMute (), layer.isSolo (), false, layer.isActivated (), 0);
display.addChannelElement (selectedMenu, topMenu, isTopMenuOn, layer.doesExist () ? layer.getName () : "", ChannelType.LAYER, layer.getColor (), layer.isSelected (), valueChanger.toDisplayValue (layer.getVolume ()), valueChanger.toDisplayValue (layer.getModulatedVolume ()), isVolume && this.isKnobTouched[i] ? layer.getVolumeStr (8) : "", valueChanger.toDisplayValue (layer.getPan ()), valueChanger.toDisplayValue (layer.getModulatedPan ()), isPan && this.isKnobTouched[i] ? layer.getPanStr () : "", vuL, vuR, layer.isMute (), layer.isSolo (), false, layer.isActivated (), 0, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import de.mossgrabers.framework.controller.valuechanger.IValueChanger;
import de.mossgrabers.framework.daw.IModel;
import de.mossgrabers.framework.daw.constants.Capability;
import de.mossgrabers.framework.daw.data.ICursorTrack;
import de.mossgrabers.framework.daw.data.IParameter;
import de.mossgrabers.framework.daw.data.ITrack;
import de.mossgrabers.framework.daw.data.bank.ITrackBank;
Expand Down Expand Up @@ -364,6 +365,7 @@ protected void updateChannelDisplay (final IGraphicDisplay display, final int se
final IValueChanger valueChanger = this.model.getValueChanger ();
final ITrackBank tb = this.model.getCurrentTrackBank ();
final PushConfiguration config = this.surface.getConfiguration ();
final ICursorTrack cursorTrack = this.model.getCursorTrack ();
for (int i = 0; i < 8; i++)
{
final ITrack t = tb.getItem (i);
Expand All @@ -374,7 +376,7 @@ protected void updateChannelDisplay (final IGraphicDisplay display, final int se
final boolean enableVUMeters = config.isEnableVUMeters ();
final int vuR = valueChanger.toDisplayValue (enableVUMeters ? t.getVuRight () : 0);
final int vuL = valueChanger.toDisplayValue (enableVUMeters ? t.getVuLeft () : 0);
display.addChannelElement (selectedMenu, topMenu, isTopMenuOn, t.doesExist () ? t.getName (12) : "", t.getType (), t.getColor (), t.isSelected (), valueChanger.toDisplayValue (t.getVolume ()), valueChanger.toDisplayValue (t.getModulatedVolume ()), isVolume && this.isKnobTouched[i] ? t.getVolumeStr (8) : "", valueChanger.toDisplayValue (t.getPan ()), valueChanger.toDisplayValue (t.getModulatedPan ()), isPan && this.isKnobTouched[i] ? t.getPanStr (8) : "", vuL, vuR, t.isMute (), t.isSolo (), t.isRecArm (), t.isActivated (), crossfadeMode);
display.addChannelElement (selectedMenu, topMenu, isTopMenuOn, t.doesExist () ? t.getName (12) : "", t.getType (), t.getColor (), t.isSelected (), valueChanger.toDisplayValue (t.getVolume ()), valueChanger.toDisplayValue (t.getModulatedVolume ()), isVolume && this.isKnobTouched[i] ? t.getVolumeStr (8) : "", valueChanger.toDisplayValue (t.getPan ()), valueChanger.toDisplayValue (t.getModulatedPan ()), isPan && this.isKnobTouched[i] ? t.getPanStr (8) : "", vuL, vuR, t.isMute (), t.isSolo (), t.isRecArm (), t.isActivated (), crossfadeMode, t.isSelected () && cursorTrack.isPinned ());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import de.mossgrabers.framework.daw.IModel;
import de.mossgrabers.framework.daw.IProject;
import de.mossgrabers.framework.daw.constants.Capability;
import de.mossgrabers.framework.daw.data.ICursorTrack;
import de.mossgrabers.framework.daw.data.IMasterTrack;
import de.mossgrabers.framework.daw.data.ITrack;
import de.mossgrabers.framework.daw.data.empty.EmptyParameter;
Expand Down Expand Up @@ -167,12 +168,14 @@ public void updateDisplay2 (final IGraphicDisplay display)
final int vuR = valueChanger.toDisplayValue (enableVUMeters ? master.getVuRight () : 0);
final int vuL = valueChanger.toDisplayValue (enableVUMeters ? master.getVuLeft () : 0);

display.addChannelElement (TAG_VOLUME, false, master.getName (), ChannelType.MASTER, master.getColor (), master.isSelected (), valueChanger.toDisplayValue (master.getVolume ()), valueChanger.toDisplayValue (master.getModulatedVolume ()), this.isKnobTouched[0] ? master.getVolumeStr (8) : "", valueChanger.toDisplayValue (master.getPan ()), valueChanger.toDisplayValue (master.getModulatedPan ()), this.isKnobTouched[1] ? master.getPanStr (8) : "", vuL, vuR, master.isMute (), master.isSolo (), master.isRecArm (), master.isActivated (), 0);
final ICursorTrack cursorTrack = this.model.getCursorTrack ();

display.addChannelElement (TAG_VOLUME, false, master.getName (), ChannelType.MASTER, master.getColor (), master.isSelected (), valueChanger.toDisplayValue (master.getVolume ()), valueChanger.toDisplayValue (master.getModulatedVolume ()), this.isKnobTouched[0] ? master.getVolumeStr (8) : "", valueChanger.toDisplayValue (master.getPan ()), valueChanger.toDisplayValue (master.getModulatedPan ()), this.isKnobTouched[1] ? master.getPanStr (8) : "", vuL, vuR, master.isMute (), master.isSolo (), master.isRecArm (), master.isActivated (), 0, master.isSelected () && cursorTrack.isPinned ());
display.addChannelSelectorElement ("Pan", false, "", null, ColorEx.BLACK, false, master.isActivated ());

if (this.model.getHost ().supports (Capability.CUE_VOLUME))
{
display.addChannelElement ("Cue Volume", false, "Cue", ChannelType.MASTER, ColorEx.GRAY, false, valueChanger.toDisplayValue (project.getCueVolume ()), -1, this.isKnobTouched[2] ? project.getCueVolumeStr (8) : "", valueChanger.toDisplayValue (project.getCueMix ()), -1, this.isKnobTouched[3] ? project.getCueMixStr (8) : "", 0, 0, false, false, false, true, 0);
display.addChannelElement ("Cue Volume", false, "Cue", ChannelType.MASTER, ColorEx.GRAY, false, valueChanger.toDisplayValue (project.getCueVolume ()), -1, this.isKnobTouched[2] ? project.getCueVolumeStr (8) : "", valueChanger.toDisplayValue (project.getCueMix ()), -1, this.isKnobTouched[3] ? project.getCueMixStr (8) : "", 0, 0, false, false, false, true, 0, false);
display.addChannelSelectorElement ("Cue Mix", false, "", null, ColorEx.BLACK, false, true);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import de.mossgrabers.framework.controller.display.ITextDisplay;
import de.mossgrabers.framework.controller.valuechanger.IValueChanger;
import de.mossgrabers.framework.daw.IModel;
import de.mossgrabers.framework.daw.data.ICursorTrack;
import de.mossgrabers.framework.daw.data.ISend;
import de.mossgrabers.framework.daw.data.ITrack;
import de.mossgrabers.framework.daw.data.bank.ISendBank;
Expand Down Expand Up @@ -98,6 +99,8 @@ public void updateDisplay2 (final IGraphicDisplay display)

this.updateMenuItems (0);

final ICursorTrack cursorTrack = this.model.getCursorTrack ();

final PushConfiguration config = this.surface.getConfiguration ();
for (int i = 0; i < 8; i++)
{
Expand All @@ -120,7 +123,7 @@ public void updateDisplay2 (final IGraphicDisplay display)
final boolean enableVUMeters = config.isEnableVUMeters ();
final int vuR = valueChanger.toDisplayValue (enableVUMeters ? t.getVuRight () : 0);
final int vuL = valueChanger.toDisplayValue (enableVUMeters ? t.getVuLeft () : 0);
display.addChannelElement (topMenu, topMenuSelected, bottomMenu, t.getType (), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue (t.getVolume ()), valueChanger.toDisplayValue (t.getModulatedVolume ()), this.isKnobTouched[0] ? t.getVolumeStr (8) : "", valueChanger.toDisplayValue (t.getPan ()), valueChanger.toDisplayValue (t.getModulatedPan ()), this.isKnobTouched[1] ? t.getPanStr (8) : "", vuL, vuR, t.isMute (), t.isSolo (), t.isRecArm (), t.isActivated (), crossfadeMode);
display.addChannelElement (topMenu, topMenuSelected, bottomMenu, t.getType (), bottomMenuColor, isBottomMenuOn, valueChanger.toDisplayValue (t.getVolume ()), valueChanger.toDisplayValue (t.getModulatedVolume ()), this.isKnobTouched[0] ? t.getVolumeStr (8) : "", valueChanger.toDisplayValue (t.getPan ()), valueChanger.toDisplayValue (t.getModulatedPan ()), this.isKnobTouched[1] ? t.getPanStr (8) : "", vuL, vuR, t.isMute (), t.isSolo (), t.isRecArm (), t.isActivated (), crossfadeMode, cursorTrack.isPinned ());
}
else if (sendsIndex == i)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ public class GenericFlexiConfiguration extends AbstractConfiguration
);
// @formatter:on

private static final List<String> CONTROLLER_CHANNELS = KEYBOARD_CHANNELS.subList (1, KEYBOARD_CHANNELS.size ());
private static final List<String> OPTIONS_RESOLUTION = List.of ("7-bit", "14-bit");

/** A setting of a slot has changed. */
Expand Down Expand Up @@ -367,7 +368,7 @@ else if (number >= 64)

this.typeSetting = globalSettings.getEnumSetting ("Type:", category, OPTIONS_TYPE, OPTIONS_TYPE.get (0));
this.numberSetting = globalSettings.getEnumSetting ("Number:", category, NUMBER_NAMES, NUMBER_NAMES.get (0));
this.midiChannelSetting = globalSettings.getEnumSetting ("Midi Channel:", category, OPTIONS_MIDI_CHANNEL, OPTIONS_MIDI_CHANNEL[0]);
this.midiChannelSetting = globalSettings.getEnumSetting ("Midi Channel:", category, CONTROLLER_CHANNELS, CONTROLLER_CHANNELS.get (0));
this.resolutionSetting = globalSettings.getEnumSetting ("Resolution:", category, OPTIONS_RESOLUTION, OPTIONS_RESOLUTION.get (0));

final String [] knobModeLabels = KnobMode.getLabels ();
Expand Down Expand Up @@ -436,7 +437,7 @@ else if (number >= 64)
this.clearNoteMap ();
});
this.midiChannelSetting.addValueObserver (value -> {
this.getSelectedSlot ().setMidiChannel (AbstractConfiguration.lookupIndex (OPTIONS_MIDI_CHANNEL, value));
this.getSelectedSlot ().setMidiChannel (AbstractConfiguration.lookupIndex (CONTROLLER_CHANNELS, value));
this.clearNoteMap ();
});
this.resolutionSetting.addValueObserver (value -> {
Expand Down Expand Up @@ -595,8 +596,12 @@ public int getSlotCommand (final int type, final int number, final int midiChann
for (int i = 0; i < this.commandSlots.length; i++)
{
final CommandSlot slot = this.commandSlots[i];
if (slot.getCommand () != FlexiCommand.OFF && slot.getType () == type && slot.getMidiChannel () == midiChannel && (type == CommandSlot.TYPE_PITCH_BEND || slot.getNumber () == number))
return i;
if (slot.getCommand () != FlexiCommand.OFF && slot.getType () == type && (type == CommandSlot.TYPE_PITCH_BEND || slot.getNumber () == number))
{
final int channel = slot.getMidiChannel ();
if ((channel == midiChannel || channel == 16))
return i;
}
}
return -1;
}
Expand All @@ -615,8 +620,12 @@ public Optional<Pair<Integer, CommandSlot>> getSlot (final int type, final int n
for (int i = 0; i < this.commandSlots.length; i++)
{
final CommandSlot slot = this.commandSlots[i];
if (slot.getCommand () != FlexiCommand.OFF && slot.getType () == type && slot.getMidiChannel () == midiChannel && (type == CommandSlot.TYPE_PITCH_BEND || slot.getNumber () == number))
return Optional.of (new Pair<> (Integer.valueOf (i), slot));
if (slot.getCommand () != FlexiCommand.OFF && slot.getType () == type && (type == CommandSlot.TYPE_PITCH_BEND || slot.getNumber () == number))
{
final int channel = slot.getMidiChannel ();
if (channel == midiChannel || channel == 16)
return Optional.of (new Pair<> (Integer.valueOf (i), slot));
}
}
return Optional.empty ();
}
Expand Down Expand Up @@ -965,7 +974,7 @@ private void setNumber (final int value)
*/
private void setMidiChannel (final int value)
{
this.midiChannelSetting.set (OPTIONS_MIDI_CHANNEL[value]);
this.midiChannelSetting.set (CONTROLLER_CHANNELS.get (value));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,19 +490,24 @@ private void reflectValue (final CommandSlot slot, final int value)
}

final IMidiOutput output = this.getMidiOutput ();
final int midiChannel = slot.getMidiChannel ();

// Cannot reflect "All" setting
if (midiChannel > 15)
return;

switch (slot.getType ())
{
case CommandSlot.TYPE_NOTE:
output.sendNoteEx (slot.getMidiChannel (), slot.getNumber (), value);
output.sendNoteEx (midiChannel, slot.getNumber (), value);
break;

case CommandSlot.TYPE_CC:
output.sendCCEx (slot.getMidiChannel (), slot.getNumber (), value);
output.sendCCEx (midiChannel, slot.getNumber (), value);
break;

case CommandSlot.TYPE_PITCH_BEND:
output.sendPitchbend (slot.getMidiChannel (), 0, value);
output.sendPitchbend (midiChannel, 0, value);
break;

default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ public void addChannelSelectorElement (final String topMenu, final boolean isTop

/** {@inheritDoc} */
@Override
public void addChannelElement (final String topMenu, final boolean isTopMenuOn, final String bottomMenu, final ChannelType type, final ColorEx bottomMenuColor, final boolean isBottomMenuOn, final int volume, final int modulatedVolume, final String volumeStr, final int pan, final int modulatedPan, final String panStr, final int vuLeft, final int vuRight, final boolean mute, final boolean solo, final boolean recarm, final boolean isActive, final int crossfadeMode)
public void addChannelElement (final String topMenu, final boolean isTopMenuOn, final String bottomMenu, final ChannelType type, final ColorEx bottomMenuColor, final boolean isBottomMenuOn, final int volume, final int modulatedVolume, final String volumeStr, final int pan, final int modulatedPan, final String panStr, final int vuLeft, final int vuRight, final boolean mute, final boolean solo, final boolean recarm, final boolean isActive, final int crossfadeMode, final boolean isPinned)
{
this.addChannelElement (GRID_ELEMENT_CHANNEL_ALL, topMenu, isTopMenuOn, bottomMenu, type, bottomMenuColor, isBottomMenuOn, volume, modulatedVolume, volumeStr, pan, modulatedPan, panStr, vuLeft, vuRight, mute, solo, recarm, isActive, crossfadeMode);
this.addChannelElement (GRID_ELEMENT_CHANNEL_ALL, topMenu, isTopMenuOn, bottomMenu, type, bottomMenuColor, isBottomMenuOn, volume, modulatedVolume, volumeStr, pan, modulatedPan, panStr, vuLeft, vuRight, mute, solo, recarm, isActive, crossfadeMode, isPinned);
}


/** {@inheritDoc} */
@Override
public void addChannelElement (final int channelType, final String topMenu, final boolean isTopMenuOn, final String bottomMenu, final ChannelType type, final ColorEx bottomMenuColor, final boolean isBottomMenuOn, final int volume, final int modulatedVolume, final String volumeStr, final int pan, final int modulatedPan, final String panStr, final int vuLeft, final int vuRight, final boolean mute, final boolean solo, final boolean recarm, final boolean isActive, final int crossfadeMode)
public void addChannelElement (final int channelType, final String topMenu, final boolean isTopMenuOn, final String bottomMenu, final ChannelType type, final ColorEx bottomMenuColor, final boolean isBottomMenuOn, final int volume, final int modulatedVolume, final String volumeStr, final int pan, final int modulatedPan, final String panStr, final int vuLeft, final int vuRight, final boolean mute, final boolean solo, final boolean recarm, final boolean isActive, final int crossfadeMode, final boolean isPinned)
{
int editType;
switch (channelType)
Expand All @@ -272,7 +272,7 @@ public void addChannelElement (final int channelType, final String topMenu, fina
editType = ChannelComponent.EDIT_TYPE_ALL;
break;
}
this.addElement (new ChannelComponent (editType, topMenu, isTopMenuOn, bottomMenu, bottomMenuColor, isBottomMenuOn, type, volume, modulatedVolume, volumeStr, pan, modulatedPan, panStr, vuLeft, vuRight, mute, solo, recarm, isActive, crossfadeMode));
this.addElement (new ChannelComponent (editType, topMenu, isTopMenuOn, bottomMenu, bottomMenuColor, isBottomMenuOn, type, volume, modulatedVolume, volumeStr, pan, modulatedPan, panStr, vuLeft, vuRight, mute, solo, recarm, isActive, crossfadeMode, isPinned));
}


Expand Down
Loading

0 comments on commit a04dffe

Please sign in to comment.