use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TrackDetailsMode method onFirstRowTrack.
private void onFirstRowTrack(final int index) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack t = tb.getSelectedTrack();
if (t == null)
return;
switch(index) {
case 0:
t.toggleIsActivated();
break;
case 1:
t.toggleRecArm();
break;
case 2:
t.toggleMute();
break;
case 3:
t.toggleSolo();
break;
case 4:
t.toggleMonitor();
break;
case 5:
t.toggleAutoMonitor();
break;
case 6:
this.model.toggleCursorTrackPinned();
break;
case 7:
final ViewManager viewManager = this.surface.getViewManager();
((ColorView) viewManager.getView(Views.VIEW_COLOR)).setMode(ColorView.SelectMode.MODE_TRACK);
viewManager.setActiveView(Views.VIEW_COLOR);
break;
}
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PushControllerSetup method handleTrackChange.
/**
* Handle a track selection change.
*
* @param index The index of the track
* @param isSelected Has the track been selected?
*/
private void handleTrackChange(final int index, final boolean isSelected) {
if (!isSelected)
return;
final PushControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final ModeManager modeManager = surface.getModeManager();
// Recall last used view (if we are not in session mode)
if (!viewManager.isActiveView(Views.VIEW_SESSION)) {
final ITrack selectedTrack = this.model.getCurrentTrackBank().getSelectedTrack();
if (selectedTrack != null) {
final Integer preferredView = viewManager.getPreferredView(selectedTrack.getPosition());
viewManager.setActiveView(preferredView == null ? this.configuration.getDefaultNoteView() : preferredView);
}
}
if (modeManager.isActiveMode(Modes.MODE_MASTER))
modeManager.setActiveMode(Modes.MODE_TRACK);
if (viewManager.isActiveView(Views.VIEW_PLAY))
viewManager.getActiveView().updateNoteMapping();
// Reset drum octave because the drum pad bank is also reset
this.scales.setDrumOctave(0);
if (viewManager.isActiveView(Views.VIEW_DRUM))
viewManager.getView(Views.VIEW_DRUM).updateNoteMapping();
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PushControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final PushControlSurface surface = this.getSurface();
final boolean isSession = surface.getViewManager().isActiveView(Views.VIEW_SESSION);
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isVolume = Modes.MODE_VOLUME.equals(mode);
tb.setIndication(!isEffect && isSession);
if (tbe != null)
tbe.setIndication(isEffect && isSession);
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = tb.getSelectedTrack();
for (int i = 0; i < tb.getNumTracks(); i++) {
final boolean hasTrackSel = selectedTrack != null && selectedTrack.getIndex() == i && Modes.MODE_TRACK.equals(mode);
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && (isVolume || hasTrackSel));
track.setPanIndication(!isEffect && (isPan || hasTrackSel));
for (int j = 0; j < tb.getNumSends(); j++) track.getSend(j).setIndication(!isEffect && (mode.intValue() - Modes.MODE_SEND1.intValue() == j || hasTrackSel));
if (tbe != null) {
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
}
cursorDevice.indicateParameter(i, true);
}
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PitchbendCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
// Don't get in the way of configuration
if (this.surface.isShiftPressed())
return;
final PushConfiguration config = this.surface.getConfiguration();
switch(config.getRibbonMode()) {
case PushConfiguration.RIBBON_MODE_PITCH:
this.surface.sendMidiEvent(0xE0, data1, data2);
break;
case PushConfiguration.RIBBON_MODE_CC:
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), data2);
this.pitchValue = data2;
break;
case PushConfiguration.RIBBON_MODE_CC_PB:
if (data2 > 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 127 - data2 * 2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_PB_CC:
if (data2 > 64)
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), (data2 - 64) * 2);
else if (data2 < 64)
this.surface.sendMidiEvent(0xE0, data1, data2);
else {
this.surface.sendMidiEvent(0xE0, data1, data2);
this.surface.sendMidiEvent(0xB0, config.getRibbonModeCCVal(), 0);
}
break;
case PushConfiguration.RIBBON_MODE_FADER:
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selTrack = tb.getSelectedTrack();
if (selTrack != null)
selTrack.setVolume(this.model.getValueChanger().toDAWValue(data2));
return;
}
this.surface.getOutput().sendPitchbend(data1, data2);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class DeviceLayerMode method updateDisplay1.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay1() {
final Display d = this.surface.getDisplay().clear();
final ICursorDevice cd = this.model.getCursorDevice();
if (!cd.hasSelectedDevice()) {
d.setBlock(1, 0, " Select").setBlock(1, 1, "a device or press").setBlock(1, 2, "'Add Effect'... ").allDone();
return;
}
final boolean noLayers = cd.hasLayers() && cd.hasZeroLayers();
if (noLayers) {
d.setBlock(1, 1, " Please create").setBlock(1, 2, cd.hasDrumPads() ? "a Drum Pad..." : "a Device Layer...");
} else {
final IChannel l = cd.getSelectedLayerOrDrumPad();
if (l != null) {
d.setCell(0, 0, "Volume").setCell(1, 0, l.getVolumeStr(8)).setCell(2, 0, this.surface.getConfiguration().isEnableVUMeters() ? l.getVu() : l.getVolume(), Format.FORMAT_VALUE);
d.setCell(0, 1, "Pan").setCell(1, 1, l.getPanStr(8)).setCell(2, 1, l.getPan(), Format.FORMAT_PAN);
final IChannelBank fxTrackBank = this.model.getEffectTrackBank();
if (fxTrackBank == null) {
for (int i = 0; i < 6; i++) {
final int pos = 2 + i;
final ISend send = l.getSend(i);
d.setCell(0, pos, send.getName()).setCell(1, pos, send.getDisplayedValue(8)).setCell(2, pos, send.getValue(), Format.FORMAT_VALUE);
}
} else {
final boolean isFX = this.model.isEffectTrackBankActive();
for (int i = 0; i < 6; i++) {
final ITrack fxTrack = fxTrackBank.getTrack(i);
final boolean isEmpty = isFX || !fxTrack.doesExist();
final int pos = 2 + i;
if (isEmpty) {
d.clearCell(0, pos);
d.clearCell(2, pos);
} else {
final ISend send = l.getSend(i);
d.setCell(0, pos, fxTrack.getName()).setCell(1, pos, send.getDisplayedValue(8));
d.setCell(2, pos, send.getValue(), Format.FORMAT_VALUE);
}
}
}
}
}
this.drawRow4(d, cd);
}
Aggregations