use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class MaschineJamPanMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
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 String c = DAWColor.getColorIndex(track.getColor());
final int color = this.colorManager.getColorIndex(c);
final int value = this.model.getValueChanger().toMidiValue(track.getPan());
return new FaderConfig(FaderConfig.TYPE_PAN, color, value);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class MaschineJamVolumeMode method setupFader.
/**
* {@inheritDoc}
*/
@Override
public FaderConfig setupFader(final int index) {
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 String c = DAWColor.getColorIndex(track.getColor());
final int color = this.colorManager.getColorIndex(c);
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);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TouchstripCommand method updateValue.
/**
* Update the LED value of the ribbon strip.
*/
public void updateValue() {
final RibbonMode ribbonMode = this.surface.getConfiguration().getRibbonMode();
switch(ribbonMode) {
case PITCH_DOWN:
case PITCH_UP:
case PITCH_DOWN_UP:
case CC_1:
case CC_11:
this.surface.setRibbonValue(this.ribbonValue);
break;
case MASTER_VOLUME:
final ITrack t = this.model.getMasterTrack();
this.surface.setRibbonValue(t == null ? 0 : this.model.getValueChanger().toMidiValue(t.getVolume()));
break;
case NOTE_REPEAT_PERIOD:
case NOTE_REPEAT_LENGTH:
final Resolution[] values = Resolution.values();
final INoteRepeat noteRepeat = this.surface.getMidiInput().getDefaultNoteInput().getNoteRepeat();
final double value = ribbonMode == RibbonMode.NOTE_REPEAT_PERIOD ? noteRepeat.getPeriod() : noteRepeat.getNoteLength();
final int index = Resolution.getMatch(value);
this.surface.setRibbonValue((int) Math.round(index * 127.0 / (values.length - 1)));
break;
default:
// Not used
break;
}
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class MidiModule method getNoteColor.
/**
* Get the color for a note.
*
* @param note The note
* @return The color
*/
private ColorEx getNoteColor(final int note) {
final ColorManager colorManager = this.model.getColorManager();
final boolean isKeyboardEnabled = this.model.canSelectedTrackHoldNotes();
if (!isKeyboardEnabled)
return ColorEx.BLACK;
if (this.keyManager.isKeyPressed(note))
return this.model.hasRecordingState() ? ColorEx.RED : ColorEx.GREEN;
final ITrack cursorTrack = this.model.getCursorTrack();
final String colorID = AbstractView.replaceOctaveColorWithTrackColor(cursorTrack, this.keyManager.getColor(note));
final int colorIndex = colorManager.getColorIndex(colorID);
return colorManager.getColor(colorIndex, null);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class AutoColor method updateTracks.
/**
* Updates all tracks (in the page) for a color.
*
* @param color The color to match for
* @param patterns The patterns to match
*/
private void updateTracks(final DAWColor color, final List<Pattern> patterns) {
for (int i = 0; i < this.trackBank.getPageSize(); i++) {
final ITrack track = this.trackBank.getItem(i);
matchColorToTrack(track, track.getName(), color, patterns);
}
}
Aggregations