use of de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration in project DrivenByMoss by git-moss.
the class MixerMode 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();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(track.getVolume());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final ITrack track = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(track.getPan());
}
final Optional<ITrack> selectedTrack = this.bank.getSelectedItem();
final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
int scrollClipsState = 0;
if (selectedTrack.isPresent()) {
final ISlotBank slotBank = selectedTrack.get().getSlotBank();
scrollClipsState = (slotBank.canScrollBackwards() ? 1 : 0) + (slotBank.canScrollForwards() ? 2 : 0);
}
final ISceneBank sceneBank = this.model.getSceneBank();
final int scrollScenesState = (sceneBank.canScrollBackwards() ? 1 : 0) + (sceneBank.canScrollForwards() ? 2 : 0);
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return (this.bank.canScrollPageBackwards() ? 1 : 0) + (this.bank.canScrollPageForwards() ? 2 : 0);
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_TRACKS:
if (configuration.isFlipTrackClipNavigation())
return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
return scrollTracksState;
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_CLIPS:
if (configuration.isFlipTrackClipNavigation())
return scrollTracksState;
return configuration.isFlipClipSceneNavigation() ? scrollScenesState : scrollClipsState;
default:
return 0;
}
}
use of de.mossgrabers.controller.ni.kontrol.mkii.KontrolProtocolConfiguration in project DrivenByMoss by git-moss.
the class ParamsMode 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();
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME && index < KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_VOLUME);
return valueChanger.toMidiValue(parameter.getValue());
}
if (index >= KontrolProtocolControlSurface.KONTROL_TRACK_PAN && index < KontrolProtocolControlSurface.KONTROL_TRACK_PAN + 8) {
final IParameter parameter = this.bank.getItem(index - KontrolProtocolControlSurface.KONTROL_TRACK_PAN);
return valueChanger.toMidiValue(parameter.getValue());
}
final int scrollTracksState = (this.bank.canScrollBackwards() ? 1 : 0) + (this.bank.canScrollForwards() ? 2 : 0);
final IDeviceBank deviceBank = this.cursorDevice.getDeviceBank();
final int scrollScenesState = (deviceBank.canScrollBackwards() ? 1 : 0) + (deviceBank.canScrollForwards() ? 2 : 0);
final KontrolProtocolConfiguration configuration = this.surface.getConfiguration();
switch(index) {
case KontrolProtocolControlSurface.KONTROL_NAVIGATE_BANKS:
return (this.cursorDevice.canSelectPreviousFX() ? 1 : 0) + (this.cursorDevice.canSelectNextFX() ? 2 : 0);
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.controller.ni.kontrol.mkii.KontrolProtocolConfiguration 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;
}
}
Aggregations