use of de.mossgrabers.framework.daw.IChannelBank 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.IChannelBank 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.IChannelBank in project DrivenByMoss by git-moss.
the class PushControllerSetup method createModel.
/**
* {@inheritDoc}
*/
@Override
protected void createModel() {
this.model = this.factory.createModel(this.colorManager, this.valueChanger, this.scales, 8, 8, this.isPush2 ? 8 : 6, this.isPush2 ? 48 : 16, this.isPush2 ? 48 : 16, false, -1, -1, -1, -1);
final ITrackBank trackBank = this.model.getTrackBank();
trackBank.setIndication(true);
trackBank.addTrackSelectionObserver(this::handleTrackChange);
final IChannelBank effectTrackBank = this.model.getEffectTrackBank();
if (effectTrackBank != null)
effectTrackBank.addTrackSelectionObserver(this::handleTrackChange);
this.model.getMasterTrack().addTrackSelectionObserver((index, isSelected) -> {
final PushControlSurface surface = this.getSurface();
final ModeManager modeManager = surface.getModeManager();
if (isSelected)
modeManager.setActiveMode(Modes.MODE_MASTER);
else if (modeManager.isActiveMode(Modes.MODE_MASTER))
modeManager.restoreMode();
});
}
use of de.mossgrabers.framework.daw.IChannelBank 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.IChannelBank 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