use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class TrackMode method onValueKnob.
/**
* {@inheritDoc}
*/
@Override
public void onValueKnob(final int index, final int value) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
if (selectedTrack == null)
return;
final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
switch(index) {
case 0:
selectedTrack.changeVolume(value);
return;
case 1:
selectedTrack.changePan(value);
return;
}
final MCUConfiguration config = this.surface.getConfiguration();
if (index == 2) {
if (config.isDisplayCrossfader())
selectedTrack.changeCrossfadeModeAsNumber(value);
else if (!effectTrackBankActive)
selectedTrack.getSend(0).changeValue(value);
} else if (!effectTrackBankActive)
selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).changeValue(value);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class TrackMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
if (!this.surface.getConfiguration().hasDisplay1())
return;
this.drawDisplay2();
if (!this.drawTrackHeader())
return;
final Display d = this.surface.getDisplay().clear();
final IChannelBank currentTrackBank = this.model.getCurrentTrackBank();
final ITrack selectedTrack = currentTrackBank.getSelectedTrack();
if (selectedTrack == null) {
d.notify("Please select a track...", true, false);
return;
}
final MCUConfiguration config = this.surface.getConfiguration();
final boolean displayTrackNames = this.surface.getConfiguration().isDisplayTrackNames();
if (!displayTrackNames) {
d.setCell(0, 0, "Volume");
d.setCell(0, 1, "Pan");
}
d.setCell(1, 0, selectedTrack.getVolumeStr(6));
d.setCell(1, 1, selectedTrack.getPanStr(6));
int sendStart = 2;
int sendCount = 6;
if (config.isDisplayCrossfader()) {
sendStart = 3;
sendCount = 5;
final String crossfadeMode = selectedTrack.getCrossfadeMode();
if (!displayTrackNames)
d.setCell(0, 2, "Crossfade");
d.setCell(1, 2, "A".equals(crossfadeMode) ? "A" : "B".equals(crossfadeMode) ? " B" : " <> ");
}
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
for (int i = 0; i < sendCount; i++) {
final int pos = sendStart + i;
if (!isEffectTrackBankActive) {
final ISend send = selectedTrack.getSend(i);
if (send.doesExist()) {
if (!displayTrackNames)
d.setCell(0, pos, StringUtils.fixASCII(send.getName()));
d.setCell(1, pos, send.getDisplayedValue(6));
}
}
}
if (!displayTrackNames)
d.done(0);
d.done(1);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class TrackMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
protected void updateKnobLEDs() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final int upperBound = this.model.getValueChanger().getUpperBound();
final ITrack t = tb.getSelectedTrack();
if (t == null) {
for (int i = 0; i < 8; i++) this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, 0, upperBound);
return;
}
this.surface.setKnobLED(0, MCUControlSurface.KNOB_LED_MODE_WRAP, t.getVolume(), upperBound);
this.surface.setKnobLED(1, MCUControlSurface.KNOB_LED_MODE_BOOST_CUT, t.getPan(), upperBound);
final boolean displayCrossfader = this.surface.getConfiguration().isDisplayCrossfader();
final int start = displayCrossfader ? 3 : 2;
final int end = displayCrossfader ? 5 : 6;
if (displayCrossfader) {
final String crossfadeMode = t.getCrossfadeMode();
this.surface.setKnobLED(2, MCUControlSurface.KNOB_LED_MODE_SINGLE_DOT, "A".equals(crossfadeMode) ? 1 : "B".equals(crossfadeMode) ? 127 : 64, upperBound);
}
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
for (int i = 0; i < end; i++) this.surface.setKnobLED(start + i, MCUControlSurface.KNOB_LED_MODE_WRAP, isEffectTrackBankActive ? 0 : t.getSend(i).getValue(), upperBound);
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class VolumeMode method drawTrackHeader.
/**
* {@inheritDoc}
*/
@Override
protected boolean drawTrackHeader() {
if (!super.drawTrackHeader())
return false;
if (this.surface.getConfiguration().isDisplayTrackNames())
return true;
final IChannelBank tb = this.model.getCurrentTrackBank();
final Display d = this.surface.getDisplay();
final int extenderOffset = this.surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
if (tb.getTrack(extenderOffset + i).doesExist())
d.setCell(0, i, "Volume");
else
d.clearCell(0, i);
}
d.done(0);
return true;
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class VolumeMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
protected void updateKnobLEDs() {
final IChannelBank tb = this.model.getCurrentTrackBank();
final int upperBound = this.model.getValueChanger().getUpperBound();
final int extenderOffset = this.surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(extenderOffset + i);
this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, t.getVolume(), upperBound);
}
}
Aggregations