use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class TrackHandler method getSendValue.
private int getSendValue(final int trackIndex, final int sendIndex) {
final Optional<ITrack> track = this.getTrack(trackIndex);
if (track.isEmpty())
return 0;
final ISendBank sendBank = track.get().getSendBank();
if (sendIndex >= sendBank.getPageSize())
return 0;
final ISend send = sendBank.getItem(sendIndex);
if (send == null)
return 0;
return send.getValue();
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class TrackHandler method changeSendVolume.
private void changeSendVolume(final int trackIndex, final int sendIndex, final KnobMode knobMode, final MidiValue value) {
final Optional<ITrack> track = this.getTrack(trackIndex);
if (track.isEmpty())
return;
final ISendBank sendBank = track.get().getSendBank();
if (sendIndex >= sendBank.getPageSize())
return;
final ISend send = sendBank.getItem(sendIndex);
if (send == null)
return;
final int val = value.getValue();
if (isAbsolute(knobMode))
send.setValue(this.getAbsoluteValueChanger(value), val);
else
send.changeValue(this.getRelativeValueChanger(knobMode), val);
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class SendMode method onKnobTouch.
/**
* {@inheritDoc}
*/
@Override
public void onKnobTouch(final int index, final boolean isTouched) {
this.isKnobTouched[index] = isTouched;
final int channel = this.getExtenderOffset() + index;
final ITrack t = this.getTrackBank().getItem(channel);
if (!t.doesExist())
return;
final ISendBank sendBank = t.getSendBank();
if (this.sendIndex < sendBank.getPageSize())
sendBank.getItem(this.sendIndex).touchValue(isTouched);
}
use of de.mossgrabers.framework.daw.data.bank.ISendBank 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 ITextDisplay d = this.surface.getTextDisplay().clear();
final Optional<ITrack> selectedTrack = this.getSelectedTrack();
if (selectedTrack.isEmpty()) {
d.notify("Please select a track...");
return;
}
final boolean displayTrackNames = this.surface.getConfiguration().isDisplayTrackNames();
if (!displayTrackNames) {
d.setCell(0, 0, "Volume");
d.setCell(0, 1, "Pan");
}
final ITrack t = selectedTrack.get();
d.setCell(1, 0, t.getVolumeStr(6));
d.setCell(1, 1, t.getPanStr(6));
final int sendStart = 2;
final int sendCount = 6;
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
final ISendBank sendBank = t.getSendBank();
for (int i = 0; i < sendCount; i++) {
final int pos = sendStart + i;
if (!isEffectTrackBankActive && i < sendBank.getItemCount()) {
final ISend send = sendBank.getItem(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.data.bank.ISendBank in project DrivenByMoss by git-moss.
the class TrackMode method updateKnobLEDs.
/**
* {@inheritDoc}
*/
@Override
public void updateKnobLEDs() {
final int upperBound = this.model.getValueChanger().getUpperBound();
final Optional<ITrack> t = this.getSelectedTrack();
if (t.isEmpty()) {
for (int i = 0; i < 8; i++) this.surface.setKnobLED(i, MCUControlSurface.KNOB_LED_MODE_WRAP, 0, upperBound);
return;
}
final ITrack track = t.get();
this.surface.setKnobLED(0, MCUControlSurface.KNOB_LED_MODE_WRAP, track.getVolume(), upperBound);
this.surface.setKnobLED(1, MCUControlSurface.KNOB_LED_MODE_BOOST_CUT, track.getPan(), upperBound);
final int start = 2;
final int end = 6;
final boolean isEffectTrackBankActive = this.model.isEffectTrackBankActive();
final ISendBank sendBank = track.getSendBank();
for (int i = 0; i < end; i++) {
final int value;
if (!isEffectTrackBankActive && i < sendBank.getItemCount())
value = sendBank.getItem(i).getValue();
else
value = 0;
this.surface.setKnobLED(start + i, MCUControlSurface.KNOB_LED_MODE_WRAP, value, upperBound);
}
}
Aggregations