use of de.mossgrabers.controller.ni.maschine.core.RibbonMode in project DrivenByMoss by git-moss.
the class RibbonCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.DOWN)
return;
final MaschineConfiguration configuration = this.surface.getConfiguration();
final RibbonMode ribbonMode = configuration.getRibbonMode();
RibbonMode m = this.activeMode;
// If the current mode is part of these modes select the next one
int index = this.modes.indexOf(ribbonMode);
if (index >= 0) {
index++;
if (index >= this.modes.size())
index = 0;
m = this.modes.get(index);
}
this.activeMode = m;
this.surface.getDisplay().notify(m.getName());
configuration.setRibbonMode(m);
((TouchstripCommand) this.surface.getContinuous(ContinuousID.CROSSFADER).getTouchCommand()).resetRibbonValue(m);
}
use of de.mossgrabers.controller.ni.maschine.core.RibbonMode in project DrivenByMoss by git-moss.
the class TouchstripCommand method updateValue.
/**
* Update the LED value of the ribbon strip.
*/
public void updateValue() {
final RibbonMode ribbonMode = this.surface.getConfiguration().getRibbonMode();
switch(ribbonMode) {
case PITCH_DOWN:
case PITCH_UP:
case PITCH_DOWN_UP:
case CC_1:
case CC_11:
this.surface.setRibbonValue(this.ribbonValue);
break;
case MASTER_VOLUME:
final ITrack t = this.model.getMasterTrack();
this.surface.setRibbonValue(t == null ? 0 : this.model.getValueChanger().toMidiValue(t.getVolume()));
break;
case NOTE_REPEAT_PERIOD:
case NOTE_REPEAT_LENGTH:
final Resolution[] values = Resolution.values();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
final double value = ribbonMode == RibbonMode.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
final int index = Resolution.getMatch(value);
this.surface.setRibbonValue((int) Math.round(index * 127.0 / (values.length - 1)));
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.controller.ni.maschine.core.RibbonMode in project DrivenByMoss by git-moss.
the class TouchstripCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final int value) {
this.ribbonValue = value;
final MaschineConfiguration config = this.surface.getConfiguration();
final RibbonMode ribbonMode = config.getRibbonMode();
switch(ribbonMode) {
case PITCH_DOWN:
this.surface.sendMidiEvent(0xE0, 0, (127 - value) / 2);
break;
case PITCH_UP:
this.surface.sendMidiEvent(0xE0, 0, 64 + value / 2);
break;
case PITCH_DOWN_UP:
this.surface.sendMidiEvent(0xE0, 0, value);
break;
case CC_1:
this.surface.sendMidiEvent(0xB0, 1, value);
break;
case CC_11:
this.surface.sendMidiEvent(0xB0, 11, value);
break;
case MASTER_VOLUME:
this.model.getMasterTrack().setVolume(this.model.getValueChanger().toDAWValue(value));
break;
case NOTE_REPEAT_PERIOD:
case NOTE_REPEAT_LENGTH:
final Resolution[] values = Resolution.values();
final double scaled = (127 - value) / 127.0;
final int index = (int) Math.round(scaled * (values.length - 1));
final double resolutionValue = values[values.length - 1 - index].getValue();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
if (ribbonMode == RibbonMode.NOTE_REPEAT_PERIOD)
noteRepeat.setPeriod(resolutionValue);
else
noteRepeat.setNoteLength(resolutionValue);
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.controller.ni.maschine.core.RibbonMode in project DrivenByMoss by git-moss.
the class TouchstripCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event, final int velocity) {
if (event != ButtonEvent.UP)
return;
final MaschineConfiguration config = this.surface.getConfiguration();
final RibbonMode ribbonMode = config.getRibbonMode();
switch(ribbonMode) {
case PITCH_DOWN:
case PITCH_UP:
this.ribbonValue = 0;
this.surface.sendMidiEvent(0xE0, 0, 64);
break;
case PITCH_DOWN_UP:
this.ribbonValue = 64;
this.surface.sendMidiEvent(0xE0, 0, 64);
break;
case CC_1:
case CC_11:
case MASTER_VOLUME:
case NOTE_REPEAT_PERIOD:
case NOTE_REPEAT_LENGTH:
// No automatic reset
break;
default:
// Not used
break;
}
}
Aggregations