use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method updateIndication.
protected void updateIndication() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final boolean isTrack = viewManager.isActive(Views.TRACK);
final boolean isDevice = viewManager.isActive(Views.DEVICE);
final boolean isSession = viewManager.isActive(Views.SESSION);
final IMasterTrack mt = this.model.getMasterTrack();
mt.setVolumeIndication(!isDevice);
final ITrackBank tb = this.model.getTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
final ITrackBank tbe = this.model.getEffectTrackBank();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final boolean isEffect = this.model.isEffectTrackBankActive();
tb.setIndication(!isEffect && isSession);
if (tbe != null)
tbe.setIndication(isEffect && isSession);
final IParameterBank parameterBank = cursorDevice.getParameterBank();
for (int i = 0; i < 8; i++) {
final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
final ITrack track = tb.getItem(i);
track.setVolumeIndication(!isEffect && hasTrackSel && !isDevice);
track.setPanIndication(!isEffect && hasTrackSel && !isDevice);
final ISendBank sendBank = track.getSendBank();
for (int j = 0; j < 6; j++) sendBank.getItem(j).setIndication(!isEffect && hasTrackSel && isTrack);
if (tbe != null) {
final Optional<ITrack> selectedFXTrack = tbe.getSelectedItem();
final boolean hasFXTrackSel = selectedFXTrack.isPresent() && selectedFXTrack.get().getIndex() == i;
final ITrack fxTrack = tbe.getItem(i);
fxTrack.setVolumeIndication(isEffect && hasFXTrackSel && isTrack);
fxTrack.setPanIndication(isEffect && hasFXTrackSel && isTrack);
}
parameterBank.getItem(i).setIndication(isDevice);
}
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class FireLayerMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.updateMode();
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
String desc = "Select";
String label = "a drum pad";
int value = -1;
int vuLeft = -1;
int vuRight = -1;
boolean isPan = false;
final ISpecificDevice cd = this.model.getDrumDevice();
final Optional<ILayer> channelOptional = cd.getLayerBank().getSelectedItem();
if (channelOptional.isPresent()) {
final IChannel channel = channelOptional.get();
vuLeft = channel.getVuLeft();
vuRight = channel.getVuRight();
desc = channel.getPosition() + 1 + ": " + channel.getName(9);
final ISendBank sendBank = channel.getSendBank();
switch(this.selectedParameter) {
case VOLUME:
label = "Vol: " + channel.getVolumeStr();
value = channel.getVolume();
break;
case PAN:
label = "Pan: " + channel.getPanStr();
value = channel.getPan();
isPan = true;
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
label = getSendLabel(sendBank, sendIndex);
value = getSendValue(sendBank, sendIndex);
break;
default:
label = "Select a track";
break;
}
}
display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
display.send();
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class FireTrackMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.updateMode();
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
String desc = "Select";
String label = "a track";
int value = -1;
int vuLeft = -1;
int vuRight = -1;
boolean isPan = false;
final Optional<ITrack> trackOptional = this.model.getCurrentTrackBank().getSelectedItem();
if (trackOptional.isPresent()) {
final ITrack track = trackOptional.get();
vuLeft = track.getVuLeft();
vuRight = track.getVuRight();
desc = track.getPosition() + 1 + ": " + track.getName(9);
final ISendBank sendBank = track.getSendBank();
switch(this.selectedParameter) {
case VOLUME:
label = "Vol: " + track.getVolumeStr();
value = track.getVolume();
break;
case PAN:
label = "Pan: " + track.getPanStr();
value = track.getPan();
isPan = true;
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
label = getSendLabel(sendBank, sendIndex);
value = getSendValue(sendBank, sendIndex);
break;
default:
// Not used
break;
}
}
display.addElement(new TitleValueComponent(desc, label, value, vuLeft, vuRight, isPan));
display.send();
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class MaschineJamTrackMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
final Optional<ITrack> optionalTrack = this.model.getCurrentTrackBank().getSelectedItem();
if (optionalTrack.isEmpty())
return FADER_OFF;
final ITrack track = optionalTrack.get();
if (!track.doesExist())
return FADER_OFF;
final String c = DAWColor.getColorIndex(track.getColor());
final int color = this.colorManager.getColorIndex(c);
switch(index) {
case 0:
final int value = this.model.getValueChanger().toMidiValue(track.getVolume());
if (!this.model.getTransport().isPlaying())
return new FaderConfig(FaderConfig.TYPE_SINGLE, color, value);
final int vu = this.model.getValueChanger().toMidiValue(track.getVu());
return new FaderConfig(FaderConfig.TYPE_DUAL, color, vu, value);
case 1:
final int panValue = this.model.getValueChanger().toMidiValue(track.getPan());
return new FaderConfig(FaderConfig.TYPE_PAN, color, panValue);
default:
final ISendBank sendBank = track.getSendBank();
if (!sendBank.hasExistingItems())
return FADER_OFF;
final int sendIndex = index - 2;
final ISend send = sendBank.getItem(sendIndex);
if (!send.doesExist())
return FADER_OFF;
final int sendValue = this.model.getValueChanger().toMidiValue(send.getValue());
return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, sendValue);
}
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class SendMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
// Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
final IValueChanger valueChanger = this.model.getValueChanger();
final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
final ISendBank sendBank = selectedTrack.isEmpty() ? null : selectedTrack.get().getSendBank();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(send.getValue());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(send.getValue());
}
final int scrollTracksState = (sendBank != null && sendBank.canScrollPageBackwards() ? 1 : 0) + (sendBank != null && sendBank.canScrollPageForwards() ? 2 : 0);
final int scrollScenesState = 0;
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
default:
return 0;
}
}
Aggregations