use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class EqHandler method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(final FlexiCommand command, final KnobMode knobMode, final MidiValue value) {
final IEqualizerDevice equalizer = (IEqualizerDevice) this.model.getSpecificDevice(DeviceID.EQ);
if (!equalizer.doesExist()) {
final ITrack cursorTrack = this.model.getCursorTrack();
if (cursorTrack.doesExist() && !this.eqRequested) {
cursorTrack.addEqualizerDevice();
this.eqRequested = true;
}
return;
}
this.eqRequested = false;
switch(command) {
case EQ_SET_TYPE_1:
case EQ_SET_TYPE_2:
case EQ_SET_TYPE_3:
case EQ_SET_TYPE_4:
case EQ_SET_TYPE_5:
case EQ_SET_TYPE_6:
case EQ_SET_TYPE_7:
case EQ_SET_TYPE_8:
final int bandIndex1 = command.ordinal() - FlexiCommand.EQ_SET_TYPE_1.ordinal();
final IParameter type = equalizer.getType(bandIndex1);
this.handleParameter(knobMode, type, value);
return;
case EQ_SET_FREQ_1:
case EQ_SET_FREQ_2:
case EQ_SET_FREQ_3:
case EQ_SET_FREQ_4:
case EQ_SET_FREQ_5:
case EQ_SET_FREQ_6:
case EQ_SET_FREQ_7:
case EQ_SET_FREQ_8:
final int bandIndex2 = command.ordinal() - FlexiCommand.EQ_SET_FREQ_1.ordinal();
ensureBandIsOn(equalizer, bandIndex2);
final IParameter frequency = equalizer.getFrequency(bandIndex2);
this.handleParameter(knobMode, frequency, value);
return;
case EQ_SET_GAIN_1:
case EQ_SET_GAIN_2:
case EQ_SET_GAIN_3:
case EQ_SET_GAIN_4:
case EQ_SET_GAIN_5:
case EQ_SET_GAIN_6:
case EQ_SET_GAIN_7:
case EQ_SET_GAIN_8:
final int bandIndex3 = command.ordinal() - FlexiCommand.EQ_SET_GAIN_1.ordinal();
ensureBandIsOn(equalizer, bandIndex3);
final IParameter gain = equalizer.getGain(bandIndex3);
this.handleParameter(knobMode, gain, value);
return;
case EQ_SET_Q_1:
case EQ_SET_Q_2:
case EQ_SET_Q_3:
case EQ_SET_Q_4:
case EQ_SET_Q_5:
case EQ_SET_Q_6:
case EQ_SET_Q_7:
case EQ_SET_Q_8:
final int bandIndex4 = command.ordinal() - FlexiCommand.EQ_SET_Q_1.ordinal();
ensureBandIsOn(equalizer, bandIndex4);
final IParameter q = equalizer.getQ(bandIndex4);
this.handleParameter(knobMode, q, value);
return;
default:
throw new FlexiHandlerException(command);
}
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TrackHandler method changeTrackPanorama.
private void changeTrackPanorama(final KnobMode knobMode, final int trackIndex, final MidiValue value) {
final Optional<ITrack> track = this.getTrack(trackIndex);
if (track.isEmpty())
return;
final int val = value.getValue();
final IParameter panParameter = track.get().getPanParameter();
if (isAbsolute(knobMode))
panParameter.setValue(this.getAbsoluteValueChanger(value), val);
else
panParameter.changeValue(this.getRelativeValueChanger(knobMode), val);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TrackHandler method scrollTrackLeft.
private void scrollTrackLeft(final boolean switchBank) {
final ITrackBank tb = this.model.getCurrentTrackBank();
final Optional<ITrack> sel = tb.getSelectedItem();
final int index = sel.isEmpty() ? 0 : sel.get().getIndex() - 1;
if (index == -1 || switchBank) {
tb.selectPreviousPage();
return;
}
tb.getItem(index).select();
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class TrackHandler method changeTrackVolume.
private void changeTrackVolume(final KnobMode knobMode, final int trackIndex, final MidiValue value) {
final Optional<ITrack> track = this.getTrack(trackIndex);
if (track.isEmpty())
return;
final int val = value.getValue();
final IParameter volumeParameter = track.get().getVolumeParameter();
if (isAbsolute(knobMode))
volumeParameter.setValue(this.getAbsoluteValueChanger(value), val);
else
volumeParameter.changeValue(this.getRelativeValueChanger(knobMode), val);
}
use of de.mossgrabers.framework.daw.data.ITrack in project DrivenByMoss by git-moss.
the class FireTrackMixerMode method updateDisplay.
/**
* {@inheritDoc}
*/
@Override
public void updateDisplay() {
this.updateMode();
final IGraphicDisplay display = this.surface.getGraphicsDisplay();
final ITrackBank trackBank = this.model.getCurrentTrackBank();
final Optional<ITrack> trackOptional = trackBank.getSelectedItem();
String label = "None";
if (trackOptional.isPresent()) {
final ITrack track = trackOptional.get();
label = track.getPosition() + 1 + ": " + track.getName(9);
}
final int size = trackBank.getPageSize();
final boolean[] selected = new boolean[size];
final int[] values = new int[size];
final boolean isMode = this.isAnyKnobTouched() || !this.model.getTransport().isPlaying();
if (isMode) {
switch(this.selectedParameter) {
case VOLUME:
for (int i = 0; i < size; i++) {
final IChannel channel = trackBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getVolume();
}
break;
case PAN:
for (int i = 0; i < size; i++) {
final IChannel channel = trackBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getPan();
}
break;
case SEND1:
case SEND2:
case SEND3:
case SEND4:
case SEND5:
case SEND6:
final int sendIndex = this.selectedParameter.ordinal() - Modes.SEND1.ordinal();
for (int i = 0; i < size; i++) {
final IChannel channel = trackBank.getItem(i);
selected[i] = channel.isSelected();
final ISendBank sendBank = channel.getSendBank();
if (sendBank != null) {
final ISend send = sendBank.getItem(sendIndex);
if (send.doesExist())
values[i] = send.getValue();
}
}
break;
default:
// Not used
break;
}
} else {
for (int i = 0; i < size; i++) {
final IChannel channel = trackBank.getItem(i);
selected[i] = channel.isSelected();
values[i] = channel.getVu();
}
}
display.addElement(new TitleChannelsComponent(label, selected, values, this.selectedParameter == Modes.PAN && isMode));
display.send();
}
Aggregations