use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class DeviceView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
if (!this.model.hasSelectedDevice())
return;
final ICursorDevice cd = this.model.getCursorDevice();
IChannel sel;
int index;
IChannel dl;
int bank;
int offset;
switch(note - 36) {
// Toggle device on/off
case 0:
cd.toggleEnabledState();
break;
// Device Left
case 1:
if (this.isLayer) {
sel = cd.getSelectedLayer();
index = sel == null || sel.getIndex() == 0 ? 0 : sel.getIndex() - 1;
cd.selectLayer(index);
} else
cd.selectPrevious();
break;
// Device Right
case 2:
if (this.isLayer) {
sel = cd.getSelectedLayer();
index = sel == null ? 0 : sel.getIndex() + 1;
cd.selectLayer(index > 7 ? 7 : index);
} else
cd.selectNext();
break;
// Enter layer
case 3:
if (!cd.hasLayers())
return;
dl = cd.getSelectedLayerOrDrumPad();
if (this.isLayer) {
if (dl != null) {
cd.enterLayerOrDrumPad(dl.getIndex());
cd.selectFirstDeviceInLayerOrDrumPad(dl.getIndex());
}
} else if (dl == null)
cd.selectLayerOrDrumPad(0);
this.isLayer = !this.isLayer;
break;
// Exit layer
case 4:
if (this.isLayer)
this.isLayer = false;
else {
if (cd.isNested()) {
cd.selectParent();
cd.selectChannel();
this.isLayer = true;
}
}
break;
case 5:
// Intentionally empty
break;
// Param bank down
case 6:
cd.setSelectedParameterPage(Math.max(cd.getSelectedParameterPage() - 8, 0));
break;
// Param bank page up
case 7:
cd.setSelectedParameterPage(Math.min(cd.getSelectedParameterPage() + 8, cd.getParameterPageNames().length - 1));
break;
default:
bank = note - 36 - 8;
offset = cd.getSelectedParameterPage() / 8 * 8;
cd.setSelectedParameterPage(offset + bank);
break;
}
}
use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class DeviceLeftCommand method executeShifted.
/**
* {@inheritDoc}
*/
@Override
public void executeShifted(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
// Exit layer
final ICursorDevice cd = this.model.getCursorDevice();
final IChannel layer = cd.getSelectedLayerOrDrumPad();
if (!cd.hasLayers() || layer == null) {
if (cd.isNested()) {
cd.selectParent();
cd.selectChannel();
}
} else
layer.setSelected(false);
}
use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class CursorDeviceImpl method nextLayer.
/**
* {@inheritDoc}
*/
@Override
public void nextLayer() {
final IChannel sel = this.getSelectedLayer();
final int index = sel == null ? 0 : sel.getIndex() + 1;
if (index == this.numDeviceLayers)
this.nextLayerBank();
else
this.selectLayer(index);
}
use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class CursorDeviceImpl method previousLayer.
/**
* {@inheritDoc}
*/
@Override
public void previousLayer() {
final IChannel sel = this.getSelectedLayer();
final int index = sel == null ? 0 : sel.getIndex() - 1;
if (index == -1)
this.previousLayerBank();
else
this.selectLayer(index);
}
use of de.mossgrabers.framework.daw.data.IChannel in project DrivenByMoss by git-moss.
the class CursorDeviceImpl method nextDrumPad.
/**
* {@inheritDoc}
*/
@Override
public void nextDrumPad() {
final IChannel sel = this.getSelectedDrumPad();
int index = sel == null ? 0 : sel.getIndex() + 1;
while (index < this.numDrumPadLayers - 1 && !this.getDrumPad(index).doesExist()) index++;
if (index == this.numDrumPadLayers)
this.nextDrumPadBank();
else
this.selectDrumPad(index);
}
Aggregations