use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class DuplicateCommand method executeNormal.
/**
* {@inheritDoc}
*/
@Override
public void executeNormal(final ButtonEvent event) {
if (event != ButtonEvent.UP)
return;
// Is there a selected track?
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getSelectedTrack();
if (track == null || !track.doesExist())
return;
// Is there a selected slot?
final ISlot slot = track.getSelectedSlot();
if (slot == null)
return;
final boolean isPlaying = slot.isPlaying();
// Duplicate the clip in the selected slot
slot.duplicate();
if (!isPlaying)
return;
// Need to wait a bit with starting the duplicated clip until it is selected
this.model.getHost().scheduleTask(() -> {
final ISlot slotNew = track.getSelectedSlot();
if (slotNew != null) {
slotNew.launch();
return;
}
// Try to find the clip in the next page...
track.scrollClipPageForwards();
this.model.getHost().scheduleTask(() -> {
final ISlot slotNew2 = track.getSelectedSlot();
if (slotNew2 != null)
slotNew2.launch();
}, 200);
}, 200);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FootswitchCommand method execute.
/**
* {@inheritDoc}
*/
@Override
public void execute(final ButtonEvent event) {
switch(this.getSetting()) {
case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_PLAY:
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_PLAY, event);
break;
case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_RECORD:
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_RECORD, event);
break;
case AbstractConfiguration.FOOTSWITCH_2_STOP_ALL_CLIPS:
if (event == ButtonEvent.DOWN)
this.model.getCurrentTrackBank().stop();
break;
case AbstractConfiguration.FOOTSWITCH_2_TOGGLE_CLIP_OVERDUB:
if (event == ButtonEvent.DOWN)
this.model.getTransport().toggleLauncherOverdub();
break;
case AbstractConfiguration.FOOTSWITCH_2_UNDO:
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_UNDO, event);
break;
case AbstractConfiguration.FOOTSWITCH_2_TAP_TEMPO:
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_TAP_TEMPO, event);
break;
case AbstractConfiguration.FOOTSWITCH_2_NEW_BUTTON:
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_NEW, event);
break;
case AbstractConfiguration.FOOTSWITCH_2_CLIP_BASED_LOOPER:
final IChannelBank tb = this.model.getCurrentTrackBank();
final ITrack track = tb.getSelectedTrack();
if (track == null) {
this.surface.getDisplay().notify("Please select an Instrument track first.", true, true);
return;
}
final ISlot selectedSlot = track.getSelectedSlot();
final ISlot slot = selectedSlot == null ? track.getSlot(0) : selectedSlot;
if (event == ButtonEvent.DOWN) {
if (slot.hasContent()) {
// If there is a clip in the selected slot, enable (not toggle)
// LauncherOverdub.
this.model.getTransport().setLauncherOverdub(true);
} else {
// If there is no clip in the selected slot, create a clip and begin record
// mode. Releasing it ends record mode.
this.surface.getViewManager().getActiveView().executeTriggerCommand(Commands.COMMAND_NEW, event);
slot.select();
this.model.getTransport().setLauncherOverdub(true);
}
} else {
// Releasing it would turn off LauncherOverdub.
this.model.getTransport().setLauncherOverdub(false);
}
// Start transport if not already playing
slot.launch();
break;
case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_ARRANGE:
if (event == ButtonEvent.DOWN)
this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_ARRANGE);
break;
case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_MIX:
if (event == ButtonEvent.DOWN)
this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_MIX);
break;
case AbstractConfiguration.FOOTSWITCH_2_PANEL_LAYOUT_EDIT:
if (event == ButtonEvent.DOWN)
this.model.getApplication().setPanelLayout(IApplication.PANEL_LAYOUT_EDIT);
break;
case AbstractConfiguration.FOOTSWITCH_2_ADD_INSTRUMENT_TRACK:
if (event == ButtonEvent.DOWN)
this.model.getApplication().addInstrumentTrack();
break;
case AbstractConfiguration.FOOTSWITCH_2_ADD_AUDIO_TRACK:
if (event == ButtonEvent.DOWN)
this.model.getApplication().addAudioTrack();
break;
case AbstractConfiguration.FOOTSWITCH_2_ADD_EFFECT_TRACK:
if (event == ButtonEvent.DOWN)
this.model.getApplication().addEffectTrack();
break;
case AbstractConfiguration.FOOTSWITCH_2_QUANTIZE:
if (event == ButtonEvent.DOWN)
this.model.getCursorClip().quantize(this.surface.getConfiguration().getQuantizeAmount() / 100.0);
break;
}
}
use of de.mossgrabers.framework.daw.data.ITrack 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.data.ITrack 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.data.ITrack 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);
}
}
Aggregations