use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class BaseMode method drawDisplay2.
protected void drawDisplay2() {
if (!this.surface.getConfiguration().hasDisplay2())
return;
final IChannelBank tb = this.model.getCurrentTrackBank();
// Format track names
final Display d2 = this.surface.getSecondDisplay();
final int extenderOffset = this.surface.getExtenderOffset();
final boolean isMainDevice = this.surface.isMainDevice();
for (int i = 0; i < 8; i++) {
final ITrack t = tb.getTrack(extenderOffset + i);
d2.setCell(0, i, StringUtils.shortenAndFixASCII(t.getName(), isMainDevice ? 6 : 7));
}
if (isMainDevice)
d2.setCell(0, 8, "Maste");
d2.done(0);
d2.clearRow(1);
if (isMainDevice) {
final IMasterTrack masterTrack = this.model.getMasterTrack();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final ITrack selectedTrack = masterTrack.isSelected() ? masterTrack : tb.getSelectedTrack();
d2.setBlock(1, 0, "Sel.track: ").setBlock(1, 1, selectedTrack == null ? "None" : StringUtils.fixASCII(selectedTrack.getName()));
d2.setBlock(1, 2, "Sel.devce: ").setBlock(1, 3, cursorDevice.hasSelectedDevice() ? cursorDevice.getName() : "None");
}
d2.done(1);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PanView method setupFader.
/**
* {@inheritDoc}
*/
@Override
public void setupFader(final int index) {
final ITrack track = this.model.getCurrentTrackBank().getTrack(index);
this.surface.setupPanFader(index, this.model.getColorManager().getColor(BitwigColors.getColorIndex(track.getColor())));
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PitchbendVolumeCommand method handleTrack.
private void handleTrack(final int index, final double value) {
final boolean effectTrackBankActive = this.model.isEffectTrackBankActive();
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack selectedTrack = tb.getSelectedTrack();
switch(index) {
case 0:
selectedTrack.setVolume(value);
return;
case 1:
selectedTrack.setPan(value);
return;
}
final MCUConfiguration config = this.surface.getConfiguration();
if (index == 2) {
if (config.isDisplayCrossfader()) {
final double range = this.model.getValueChanger().getUpperBound() / 3.0;
selectedTrack.setCrossfadeModeAsNumber((int) Math.round(value / range));
} else if (!effectTrackBankActive)
selectedTrack.getSend(0).setValue(value);
} else if (!effectTrackBankActive)
selectedTrack.getSend(index - (config.isDisplayCrossfader() ? 3 : 2)).setValue(value);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class PitchbendVolumeCommand method onPitchbend.
/**
* {@inheritDoc}
*/
@Override
public void onPitchbend(final int channel, final int data1, final int data2) {
final double value = Math.min(data2 * 127 + (double) data1, this.model.getValueChanger().getUpperBound() - 1);
if (channel == 8) {
if (this.surface.isShiftPressed())
this.model.getTransport().setMetronomeVolume(value);
else
this.model.getMasterTrack().setVolume(value);
return;
}
final int extenderOffset = this.surface.getExtenderOffset();
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getTrack(extenderOffset + channel);
if (this.surface.getConfiguration().useFadersAsKnobs()) {
final ModeManager modeManager = this.surface.getModeManager();
if (modeManager.isActiveMode(Modes.MODE_VOLUME))
track.setVolume(value);
else if (modeManager.isActiveMode(Modes.MODE_PAN))
track.setPan(value);
else if (modeManager.isActiveMode(Modes.MODE_TRACK))
this.handleTrack(channel, value);
else if (modeManager.isActiveMode(Modes.MODE_SEND1))
track.getSend(0).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND2))
track.getSend(1).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND3))
track.getSend(2).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND4))
track.getSend(3).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND5))
track.getSend(4).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND6))
track.getSend(5).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND7))
track.getSend(6).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_SEND8))
track.getSend(7).setValue(value);
else if (modeManager.isActiveMode(Modes.MODE_DEVICE_PARAMS))
this.model.getCursorDevice().setParameter(extenderOffset + channel, (int) value);
return;
}
track.setVolume(value);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class SendSelectCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
if (this.model.isEffectTrackBankActive())
return;
final Integer activeModeId = this.surface.getModeManager().getActiveModeId();
int index = this.modeIds.indexOf(activeModeId) + 1;
if (index < 0 || index >= this.modeIds.size())
index = 0;
final ITrack track = this.model.getCurrentTrackBank().getTrack(0);
if (track.getSend(index).doesExist())
this.surface.getModeManager().setActiveMode(this.modeIds.get(index));
else if (track.getSend(0).doesExist())
this.surface.getModeManager().setActiveMode(this.modeIds.get(0));
}
Aggregations