Search in sources :

Example 1 with RelativeHardwareValueMatcher

use of com.bitwig.extension.controller.api.RelativeHardwareValueMatcher in project DrivenByMoss by git-moss.

the class MidiInputImpl method bind.

/**
 * {@inheritDoc}
 */
@Override
public void bind(final IHwRelativeKnob knob, final BindType type, final int channel, final int control, final RelativeEncoding encoding) {
    if (type != BindType.CC)
        throw new BindException(type);
    final RelativeHardwareValueMatcher valueMatcher;
    switch(encoding) {
        case TWOS_COMPLEMENT:
            valueMatcher = this.port.createRelative2sComplementCCValueMatcher(channel, control, 127);
            break;
        case OFFSET_BINARY:
            valueMatcher = this.port.createRelativeBinOffsetCCValueMatcher(channel, control, 127);
            break;
        case SIGNED_BIT:
            valueMatcher = this.port.createRelativeSignedBitCCValueMatcher(channel, control, 127);
            break;
        case SIGNED_BIT2:
            valueMatcher = this.port.createRelativeSignedBit2CCValueMatcher(channel, control, 127);
            break;
        default:
            // Can never been reached
            throw new BindException(type);
    }
    ((HwRelativeKnobImpl) knob).getHardwareKnob().setAdjustValueMatcher(valueMatcher);
}
Also used : RelativeHardwareValueMatcher(com.bitwig.extension.controller.api.RelativeHardwareValueMatcher) BindException(de.mossgrabers.framework.controller.hardware.BindException)

Aggregations

RelativeHardwareValueMatcher (com.bitwig.extension.controller.api.RelativeHardwareValueMatcher)1 BindException (de.mossgrabers.framework.controller.hardware.BindException)1