use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method updateIndication.
protected void updateIndication() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
final boolean isTrack = viewManager.isActive(Views.TRACK);
final boolean isDevice = viewManager.isActive(Views.DEVICE);
final boolean isSession = viewManager.isActive(Views.SESSION);
final IMasterTrack mt = this.model.getMasterTrack();
mt.setVolumeIndication(!isDevice);
final ITrackBank tb = this.model.getTrackBank();
final Optional<ITrack> selectedTrack = tb.getSelectedItem();
final ITrackBank tbe = this.model.getEffectTrackBank();
final ICursorDevice cursorDevice = this.model.getCursorDevice();
final boolean isEffect = this.model.isEffectTrackBankActive();
tb.setIndication(!isEffect && isSession);
if (tbe != null)
tbe.setIndication(isEffect && isSession);
final IParameterBank parameterBank = cursorDevice.getParameterBank();
for (int i = 0; i < 8; i++) {
final boolean hasTrackSel = selectedTrack.isPresent() && selectedTrack.get().getIndex() == i;
final ITrack track = tb.getItem(i);
track.setVolumeIndication(!isEffect && hasTrackSel && !isDevice);
track.setPanIndication(!isEffect && hasTrackSel && !isDevice);
final ISendBank sendBank = track.getSendBank();
for (int j = 0; j < 6; j++) sendBank.getItem(j).setIndication(!isEffect && hasTrackSel && isTrack);
if (tbe != null) {
final Optional<ITrack> selectedFXTrack = tbe.getSelectedItem();
final boolean hasFXTrackSel = selectedFXTrack.isPresent() && selectedFXTrack.get().getIndex() == i;
final ITrack fxTrack = tbe.getItem(i);
fxTrack.setVolumeIndication(isEffect && hasFXTrackSel && isTrack);
fxTrack.setPanIndication(isEffect && hasFXTrackSel && isTrack);
}
parameterBank.getItem(i).setIndication(isDevice);
}
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method createViews.
/**
* {@inheritDoc}
*/
@Override
protected void createViews() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
viewManager.register(Views.TRACK, new TrackView(surface, this.model));
viewManager.register(Views.DEVICE, new DeviceView(surface, this.model));
viewManager.register(Views.PLAY, new PlayView(surface, this.model));
viewManager.register(Views.DRUM, new DrumView(surface, this.model));
viewManager.register(Views.SEQUENCER, new SequencerView(surface, this.model));
viewManager.register(Views.SESSION, new SessionView(surface, this.model));
viewManager.register(Views.BROWSER, new BrowserView(surface, this.model));
viewManager.register(Views.SHIFT, new ShiftView(surface, this.model));
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BeatstepControllerSetup method registerContinuousCommands.
/**
* {@inheritDoc}
*/
@Override
protected void registerContinuousCommands() {
final BeatstepControlSurface surface = this.getSurface();
final ViewManager viewManager = surface.getViewManager();
for (int i = 0; i < 8; i++) {
this.addRelativeKnob(ContinuousID.get(ContinuousID.KNOB1, i), "Knob " + (i + 1), new KnobRowViewCommand(i, this.model, surface), BindType.CC, 2, BeatstepControlSurface.BEATSTEP_KNOB_1 + i, RelativeEncoding.OFFSET_BINARY);
this.addRelativeKnob(ContinuousID.get(ContinuousID.DEVICE_KNOB1, i), "Knob " + (i + 9), new KnobRowViewCommand(i + 8, this.model, surface), BindType.CC, 2, BeatstepControlSurface.BEATSTEP_KNOB_9 + i, RelativeEncoding.OFFSET_BINARY);
}
this.addRelativeKnob(ContinuousID.MASTER_KNOB, "Master", new PlayPositionCommand<>(this.model, surface), BindType.CC, 2, BeatstepControlSurface.BEATSTEP_KNOB_MAIN, RelativeEncoding.OFFSET_BINARY);
final PlayView playView = (PlayView) viewManager.get(Views.PLAY);
playView.registerAftertouchCommand(new AftertouchViewCommand<>(playView, this.model, surface));
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class BrowserCommand method discardBrowser.
/**
* Stop browsing and restore the previous mode.
*
* @param commit True to commit otherwise cancel
*/
public void discardBrowser(final boolean commit) {
this.model.getBrowser().stopBrowsing(commit);
if (!commit)
return;
// Workaround for drum page scroll bug
final ViewManager viewManager = this.surface.getViewManager();
if (viewManager.isActive(Views.DRUM))
AbstractDrumView.class.cast(viewManager.get(Views.DRUM)).repositionBankPage();
}
use of de.mossgrabers.framework.featuregroup.ViewManager in project DrivenByMoss by git-moss.
the class NoteViewSelectMode method getButtonColorID.
/**
* {@inheritDoc}
*/
@Override
public String getButtonColorID(final ButtonID buttonID) {
int index = this.isButtonRow(0, buttonID);
if (index >= 0) {
final ViewManager viewManager = this.surface.getViewManager();
if (VIEWS[index] == null)
return AbstractFeatureGroup.BUTTON_COLOR_OFF;
return viewManager.isActive(VIEWS[index]) ? AbstractMode.BUTTON_COLOR_HI : AbstractFeatureGroup.BUTTON_COLOR_ON;
}
index = this.isButtonRow(1, buttonID);
if (index >= 0) {
final ViewManager viewManager = this.surface.getViewManager();
if (VIEWS_TOP[index] == null)
return AbstractFeatureGroup.BUTTON_COLOR_OFF;
return viewManager.isActive(VIEWS_TOP[index]) ? AbstractMode.BUTTON_COLOR_HI : AbstractFeatureGroup.BUTTON_COLOR_ON;
}
return AbstractFeatureGroup.BUTTON_COLOR_OFF;
}
Aggregations