use of de.mossgrabers.framework.daw.data.IEqualizerDevice 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);
}
}
Aggregations