use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceParamsKnobRowCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final int value) {
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.doesExist())
return;
cd.getParameterBank().getItem(this.index).setValue(value);
this.moveStartTime = new Date().getTime();
if (this.isKnobMoving)
return;
this.isKnobMoving = true;
this.startCheckKnobMovement();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class BrowserCommand method activateBrowser.
/**
* Activate the browser depending on the parameters and the currently active mode.
*
* @param insertDevice Insert a device if true otherwise select preset
* @param beforeCurrent Insert the device before the current device if any
* @return True if activated
*/
private boolean activateBrowser(final boolean insertDevice, final boolean beforeCurrent) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final boolean hasCursorDevice = cursorDevice.doesExist();
final IBrowser browser = this.model.getBrowser();
if (hasCursorDevice) {
// Replace the cursor device
if (!insertDevice) {
browser.replace(cursorDevice);
return true;
}
if (Modes.isLayerMode(this.surface.getModeManager().getActiveID())) {
final Optional<ILayer> layer = cursorDevice.getLayerBank().getSelectedItem();
if (layer.isEmpty())
return false;
browser.addDevice(layer.get());
return true;
}
if (beforeCurrent)
browser.insertBeforeCursorDevice();
else
browser.insertAfterCursorDevice();
return true;
}
// No cursor device, add to the selected channel, if any
final Optional<ITrack> channel = this.model.getCurrentTrackBank().getSelectedItem();
if (channel.isPresent()) {
browser.addDevice(channel.get());
return true;
}
final IMasterTrack master = this.model.getMasterTrack();
if (!master.isSelected())
return false;
browser.addDevice(master);
return true;
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerLeftCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
final ICursorDevice cd = this.model.getCursorDevice();
final IChannelBank<ILayer> bank = cd.getLayerBank();
if (!cd.hasLayers() || bank.getSelectedItem().isEmpty())
cd.selectPrevious();
else
bank.selectPreviousItem();
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class DeviceLayerLeftCommand method executeShifted.
/**
* {@inheritDoc}
*/
@Override
public void executeShifted(final ButtonEvent event) {
if (event != ButtonEvent.DOWN)
return;
// Exit layer
final ICursorDevice cd = this.model.getCursorDevice();
final IChannelBank<ILayer> bank = cd.getLayerBank();
final Optional<ILayer> layer = bank.getSelectedItem();
if (!cd.hasLayers() || layer.isEmpty()) {
if (cd.isNested()) {
cd.selectParent();
cd.selectChannel();
}
} else
layer.get().setSelected(false);
}
use of de.mossgrabers.framework.daw.data.ICursorDevice in project DrivenByMoss by git-moss.
the class SelectedDeviceMode method onKnobValue.
/**
* {@inheritDoc}
*/
@Override
public void onKnobValue(final int index, final int value) {
final ICursorDevice cursorDevice = this.model.getCursorDevice();
if (cursorDevice == null)
return;
final IParameter item = cursorDevice.getParameterBank().getItem(index < 0 ? this.selParam : index);
if (item.doesExist())
item.changeValue(value);
}
Aggregations