use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class MaschineJamTrackMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
final Optional<ITrack> optionalTrack = this.model.getCurrentTrackBank().getSelectedItem();
if (optionalTrack.isEmpty())
return FADER_OFF;
final ITrack track = optionalTrack.get();
if (!track.doesExist())
return FADER_OFF;
final String c = DAWColor.getColorIndex(track.getColor());
final int color = this.colorManager.getColorIndex(c);
switch(index) {
case 0:
final int value = this.model.getValueChanger().toMidiValue(track.getVolume());
if (!this.model.getTransport().isPlaying())
return new FaderConfig(FaderConfig.TYPE_SINGLE, color, value);
final int vu = this.model.getValueChanger().toMidiValue(track.getVu());
return new FaderConfig(FaderConfig.TYPE_DUAL, color, vu, value);
case 1:
final int panValue = this.model.getValueChanger().toMidiValue(track.getPan());
return new FaderConfig(FaderConfig.TYPE_PAN, color, panValue);
default:
final ISendBank sendBank = track.getSendBank();
if (!sendBank.hasExistingItems())
return FADER_OFF;
final int sendIndex = index - 2;
final ISend send = sendBank.getItem(sendIndex);
if (!send.doesExist())
return FADER_OFF;
final int sendValue = this.model.getValueChanger().toMidiValue(send.getValue());
return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, sendValue);
}
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class MaschineJamSendMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
if (this.model.isEffectTrackBankActive())
return FADER_OFF;
final Optional<ITrack> optionalTrack = this.getTrack(index);
if (optionalTrack.isEmpty())
return FADER_OFF;
final ITrack track = optionalTrack.get();
if (!track.doesExist())
return FADER_OFF;
final ISend send = track.getSendBank().getItem(this.sendIndex);
if (!send.doesExist())
return FADER_OFF;
final int value = this.model.getValueChanger().toMidiValue(send.getValue());
return new FaderConfig(FaderConfig.TYPE_SINGLE, MaschineColorManager.COLOR_DARK_GREY, value);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class SendMode method onKnobValue.
/**
* {@inheritDoc}
*/
@Override
public void onKnobValue(final int index, final int value) {
final Optional<ITrack> track = this.model.getCurrentTrackBank().getSelectedItem();
if (track.isEmpty())
return;
final ISend send = track.get().getSendBank().getItem(index);
if (this.isAbsolute)
send.setValue(value);
else
send.changeValue(value);
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class SendMode method getKnobValue.
/**
* {@inheritDoc}
*/
@Override
public int getKnobValue(final int index) {
// Note: Since we need multiple value (more than 8), index is the MIDI CC of the knob
final IValueChanger valueChanger = this.model.getValueChanger();
final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
final ISendBank sendBank = selectedTrack.isEmpty() ? null : selectedTrack.get().getSendBank();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(send.getValue());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final ISend send = sendBank == null ? EmptySend.INSTANCE : sendBank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(send.getValue());
}
final int scrollTracksState = (sendBank != null && sendBank.canScrollPageBackwards() ? 1 : 0) + (sendBank != null && sendBank.canScrollPageForwards() ? 2 : 0);
final int scrollScenesState = 0;
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
return configuration.isFlipTrackClipNavigation() ? scrollScenesState : scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
return configuration.isFlipTrackClipNavigation() ? scrollTracksState : scrollScenesState;
default:
return 0;
}
}
use of de.mossgrabers.framework.daw.data.ISend in project DrivenByMoss by git-moss.
the class MixView method onGridNote.
/**
* {@inheritDoc}
*/
@Override
public void onGridNote(final int note, final int velocity) {
if (velocity == 0)
return;
final int n = note - 36;
final int index = n % 8;
final int what = n / 8;
final ITrack track = this.model.getCurrentTrackBank().getItem(index);
final IDisplay display = this.surface.getDisplay();
switch(what) {
case 7:
this.faderMode = FaderMode.VOLUME;
display.notify("Volume");
this.selectTrack(track);
break;
case 6:
this.faderMode = FaderMode.PAN;
display.notify("Panorama");
this.selectTrack(track);
break;
case 5:
this.faderMode = FaderMode.SEND1;
final ISend send1 = track.getSendBank().getItem(0);
display.notify("Send 1: " + (send1.doesExist() ? send1.getName() : "None"));
this.selectTrack(track);
break;
case 4:
this.faderMode = FaderMode.SEND2;
final ISend send2 = track.getSendBank().getItem(1);
display.notify("Send 2: " + (send2.doesExist() ? send2.getName() : "None"));
this.selectTrack(track);
break;
case 3:
track.stop();
display.notify("Stop clip");
break;
case 2:
track.toggleMute();
display.notify("Mute");
break;
case 1:
track.toggleSolo();
display.notify("Solo");
break;
case 0:
track.toggleRecArm();
display.notify("Rec Arm");
break;
default:
// Not used
break;
}
}
Aggregations