use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class NoteRepeatMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1(final ITextDisplay display) {
display.setCell(0, 0, "Period:");
final int selPeriodIndex = this.getSelectedPeriodIndex();
int pos = 0;
for (final Pair<String, Boolean> p : Push1Display.createMenuList(4, Resolution.getNames(), selPeriodIndex)) {
display.setCell(pos, 1, (p.getValue().booleanValue() ? Push1Display.SELECT_ARROW : " ") + p.getKey());
pos++;
}
if (this.host.supports(Capability.NOTE_REPEAT_LENGTH)) {
display.setCell(0, 2, "Length:");
final int selLengthIndex = this.getSelectedNoteLengthIndex();
pos = 0;
for (final Pair<String, Boolean> p : Push1Display.createMenuList(4, Resolution.getNames(), selLengthIndex)) {
display.setCell(pos, 3, (p.getValue().booleanValue() ? Push1Display.SELECT_ARROW : " ") + p.getKey());
pos++;
}
}
final int upperBound = this.model.getValueChanger().getUpperBound();
if (this.host.supports(Capability.NOTE_REPEAT_MODE)) {
final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_USE_PRESSURE_TO_VELOCITY) ? "Use Pressure" : "";
final ArpeggiatorMode mode = this.noteRepeat.getMode();
final Configuration configuration = this.surface.getConfiguration();
final List<ArpeggiatorMode> arpeggiatorModes = configuration.getArpeggiatorModes();
final int modeIndex = configuration.lookupArpeggiatorModeIndex(mode);
final int value = modeIndex * upperBound / (arpeggiatorModes.size() - 1);
display.setCell(0, 5, "Mode");
display.setCell(1, 5, StringUtils.optimizeName(mode.getName(), 8));
display.setCell(2, 5, value, Format.FORMAT_VALUE);
display.setCell(3, 5, bottomMenu);
}
if (this.host.supports(Capability.NOTE_REPEAT_OCTAVES)) {
final String bottomMenu = this.host.supports(Capability.NOTE_REPEAT_IS_FREE_RUNNING) ? "Sync" : "";
final int octaves = this.noteRepeat.getOctaves();
final int value = octaves * upperBound / 8;
display.setCell(0, 6, "Octaves");
display.setCell(1, 6, Integer.toString(octaves));
display.setCell(2, 6, value, Format.FORMAT_VALUE);
display.setCell(3, 6, bottomMenu);
}
if (this.host.supports(Capability.NOTE_REPEAT_SWING)) {
final IParameter shuffleParam = this.model.getGroove().getParameter(GrooveParameterID.SHUFFLE_AMOUNT);
display.setCell(0, 7, shuffleParam.getName(10));
display.setCell(1, 7, shuffleParam.getDisplayedValue(8));
display.setCell(2, 7, shuffleParam.getValue(), Format.FORMAT_VALUE);
display.setCell(3, 7, "Shuffle");
}
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class DeviceParamsMode method updateDisplay2.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay2(final IGraphicDisplay display) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!this.checkExists2(display, cd))
return;
final String color = this.model.getCurrentTrackBank().getSelectedChannelColorEntry();
final ColorEx bottomMenuColor = DAWColor.getColorEntry(color);
final IDeviceBank deviceBank = cd.getDeviceBank();
final IParameterBank parameterBank = cd.getParameterBank();
final IParameterPageBank parameterPageBank = cd.getParameterPageBank();
final int selectedPage = parameterPageBank.getSelectedItemIndex();
final boolean hasPinning = this.model.getHost().supports(Capability.HAS_PINNING);
final IValueChanger valueChanger = this.model.getValueChanger();
for (int i = 0; i < parameterBank.getPageSize(); i++) {
final boolean isTopMenuOn = this.getTopMenuEnablement(cd, hasPinning, i);
String bottomMenu;
final String bottomMenuIcon;
boolean isBottomMenuOn;
if (this.showDevices) {
final IDevice item = deviceBank.getItem(i);
bottomMenuIcon = item.getName();
bottomMenu = item.doesExist() ? item.getName(12) : "";
isBottomMenuOn = i == cd.getIndex();
} else {
bottomMenuIcon = cd.getName();
bottomMenu = parameterPageBank.getItem(i);
if (bottomMenu.length() > 12)
bottomMenu = bottomMenu.substring(0, 12);
isBottomMenuOn = i == selectedPage;
}
final IParameter param = parameterBank.getItem(i);
final boolean exists = param.doesExist();
final String parameterName = exists ? param.getName(9) : "";
final int parameterValue = valueChanger.toDisplayValue(exists ? param.getValue() : 0);
final String parameterValueStr = exists ? param.getDisplayedValue(8) : "";
final boolean parameterIsActive = this.isKnobTouched[i];
final int parameterModulatedValue = valueChanger.toDisplayValue(exists ? param.getModulatedValue() : -1);
display.addParameterElement(this.hostMenu[i], isTopMenuOn, bottomMenu, bottomMenuIcon, bottomMenuColor, isBottomMenuOn, parameterName, parameterValue, parameterValueStr, parameterIsActive, parameterModulatedValue);
}
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class MaschineJamUserMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
final IParameter parameter = this.model.getUserParameterBank().getItem(index);
if (!parameter.doesExist())
return FADER_OFF;
final int value = this.model.getValueChanger().toMidiValue(parameter.getValue());
return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_WHITE, value);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class MaschineJamParameterMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (!cursorDevice.doesExist())
return FADER_OFF;
final IParameter parameter = cursorDevice.getParameterBank().getItem(index);
if (!parameter.doesExist())
return FADER_OFF;
final int value = this.model.getValueChanger().toMidiValue(parameter.getValue());
return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.PARAM_COLORS.get(index).intValue(), value);
}
use of de.mossgrabers.framework.daw.data.IParameter in project DrivenByMoss by git-moss.
the class ParamsMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
// Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
final IValueChanger valueChanger = this.model.getValueChanger();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(parameter.getValue());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(parameter.getValue());
}
final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
final IDeviceBank deviceBank = this.cursorDevice.getDeviceBank();
final int scrollScenesState = (deviceBank.canScrollBackwards() ? 1 : 0) + (deviceBank.canScrollForwards() ? 2 : 0);
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return (this.cursorDevice.canSelectPreviousFX() ? 1 : 0) + (this.cursorDevice.canSelectNextFX() ? 2 : 0);
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
default:
return 0;
}
}
Aggregations