use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class SendsView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ColorManager cm = this.model.getColorManager();
final IChannelBank tb = this.model.getCurrentTrackBank();
final IMidiOutput output = this.surface.getOutput();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
final ISend send = track.getSend(this.selectedSend);
final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
if (this.trackColors[i] != color || !track.doesExist() || send.getName().isEmpty())
this.setupFader(i);
this.trackColors[i] = color;
output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, send.getValue());
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class VolumeView method drawGrid.
/**
* {@inheritDoc}
*/
@Override
public void drawGrid() {
final ColorManager cm = this.model.getColorManager();
final IChannelBank tb = this.model.getCurrentTrackBank();
final IMidiOutput output = this.surface.getOutput();
for (int i = 0; i < 8; i++) {
final ITrack track = tb.getTrack(i);
final int color = cm.getColor(BitwigColors.getColorIndex(track.getColor()));
if (this.trackColors[i] != color || !track.doesExist())
this.setupFader(i);
this.trackColors[i] = color;
output.sendCC(LaunchpadControlSurface.LAUNCHPAD_FADER_1 + i, track.getVolume());
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class MCUControllerSetup method updateFaders.
private void updateFaders(final IMidiOutput output, final int index, final int channel, final ITrack track) {
int value = track.getVolume();
if (this.configuration.useFadersAsKnobs()) {
final ModeManager modeManager = this.getSurface().getModeManager();
if (modeManager.isActiveMode(Modes.MODE_VOLUME))
value = track.getVolume();
else if (modeManager.isActiveMode(Modes.MODE_PAN))
value = track.getPan();
else if (modeManager.isActiveMode(Modes.MODE_TRACK)) {
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
if (selectedTrack == null)
value = 0;
else {
final ITrack selTrack = tb.getTrack(selectedTrack.getIndex());
switch(index) {
case 0:
value = selTrack.getVolume();
break;
case 1:
value = selTrack.getPan();
break;
default:
final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
if (index == 2) {
if (this.configuration.isDisplayCrossfader()) {
final int crossfadeMode = selectedTrack.getCrossfadeModeAsNumber();
value = crossfadeMode == 2 ? this.valueChanger.getUpperBound() : crossfadeMode == 1 ? this.valueChanger.getUpperBound() / 2 : 0;
} else if (!effectTrackBankActive)
value = selTrack.getSend(0).getValue();
} else if (!effectTrackBankActive)
value = selTrack.getSend(index - (this.configuration.isDisplayCrossfader() ? 3 : 2)).getValue();
break;
}
}
} else if (modeManager.isActiveMode(Modes.MODE_SEND1))
value = track.getSend(0).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND2))
value = track.getSend(1).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND3))
value = track.getSend(2).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND4))
value = track.getSend(3).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND5))
value = track.getSend(4).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND6))
value = track.getSend(5).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND7))
value = track.getSend(6).getValue();
else if (modeManager.isActiveMode(Modes.MODE_SEND8))
value = track.getSend(7).getValue();
else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
value = this.model.getCursorDevice().getFXParam(channel).getValue();
}
if (value != this.faderValues[channel]) {
this.faderValues[channel] = value;
output.sendPitchbend(index, value % 127, value / 127);
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class MCUControllerSetup method updateVUandFaders.
private void updateVUandFaders() {
final double upperBound = this.valueChanger.getUpperBound();
final boolean enableVUMeters = this.configuration.isEnableVUMeters();
final boolean hasMotorFaders = this.configuration.hasMotorFaders();
final IChannelBank tb = this.model.getCurrentTrackBank();
IMidiOutput output;
for (int index = 0; index < this.numMCUDevices; index++) {
final MCUControlSurface surface = this.getSurface(index);
output = surface.getOutput();
final int extenderOffset = surface.getExtenderOffset();
for (int i = 0; i < 8; i++) {
final int channel = extenderOffset + i;
final ITrack track = tb.getTrack(channel);
// Update VU LEDs of channel
if (enableVUMeters) {
final int vu = track.getVu();
if (vu != this.vuValues[channel]) {
this.vuValues[channel] = vu;
final int scaledValue = (int) Math.round(vu * 12 / upperBound);
output.sendChannelAftertouch(0x10 * i + scaledValue, 0);
}
}
// Update motor fader of channel
if (hasMotorFaders)
this.updateFaders(output, i, channel, track);
}
}
final IMasterTrack masterTrack = this.model.getMasterTrack();
final MCUControlSurface surface = this.getSurface();
output = surface.getOutput();
// Stereo VU of master channel
if (enableVUMeters) {
int vu = masterTrack.getVuLeft();
if (vu != this.masterVuValues[0]) {
this.masterVuValues[0] = vu;
final int scaledValue = (int) Math.round(vu * 12 / upperBound);
output.sendChannelAftertouch(1, scaledValue, 0);
}
vu = masterTrack.getVuRight();
if (vu != this.masterVuValues[1]) {
this.masterVuValues[1] = vu;
final int scaledValue = (int) Math.round(vu * 12 / upperBound);
output.sendChannelAftertouch(1, 0x10 + scaledValue, 0);
}
}
// Update motor fader of master channel
if (hasMotorFaders) {
final int volume = surface.isShiftPressed() ? this.model.getTransport().getMetronomeVolume() : masterTrack.getVolume();
if (volume != this.masterFaderValue) {
this.masterFaderValue = volume;
output.sendPitchbend(8, volume % 127, volume / 127);
}
}
}
use of de.mossgrabers.framework.daw.IChannelBank in project DrivenByMoss by git-moss.
the class MCUControllerSetup method updateIndication.
private void updateIndication(final Integer mode) {
final ITrackBank tb = this.model.getTrackBank();
final IChannelBank tbe = this.model.getEffectTrackBank();
final boolean isEffect = this.model.isEffectTrackBankActive();
final boolean isPan = Modes.MODE_PAN.equals(mode);
final boolean isTrack = Modes.MODE_TRACK.equals(mode);
final boolean isDevice = Modes.MODE_DEVICE_PARAMS.equals(mode);
tb.setIndication(!isEffect);
tbe.setIndication(isEffect);
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 && isTrack;
final ITrack track = tb.getTrack(i);
track.setVolumeIndication(!isEffect && (isTrack || 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));
final ITrack fxTrack = tbe.getTrack(i);
fxTrack.setVolumeIndication(isEffect);
fxTrack.setPanIndication(isEffect && isPan);
}
for (int i = 0; i < cursorDevice.getNumParameters(); i++) cursorDevice.indicateParameter(i, isDevice);
}
Aggregations