Search in sources :

Example 1 with NoteOccurrence

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

the class StepInfoImpl method updateData.

/**
 * Set the given state and update all note data from the Bitwig StepInfo.
 *
 * @param stepInfo The step info
 */
public void updateData(final NoteStep stepInfo) {
    switch(stepInfo.state()) {
        case NoteOn:
            this.state = StepState.START;
            break;
        case NoteSustain:
            this.state = StepState.CONTINUE;
            break;
        case Empty:
            this.state = StepState.OFF;
            break;
    }
    this.isMuted = stepInfo.isMuted();
    this.duration = stepInfo.duration();
    this.velocity = stepInfo.velocity();
    this.releaseVelocity = stepInfo.releaseVelocity();
    this.pressure = stepInfo.pressure();
    this.timbre = stepInfo.timbre();
    this.pan = stepInfo.pan();
    this.transpose = stepInfo.transpose();
    this.gain = stepInfo.gain();
    this.isChanceEnabled = stepInfo.isChanceEnabled();
    this.chance = stepInfo.chance();
    this.isOccurrenceEnabled = stepInfo.isOccurrenceEnabled();
    final NoteOccurrence noteOccurrence = stepInfo.occurrence();
    this.occurrence = NoteOccurrenceType.lookup(noteOccurrence.name());
    this.isRecurrenceEnabled = stepInfo.isRecurrenceEnabled();
    this.recurrenceLength = stepInfo.recurrenceLength();
    this.recurrenceMask = stepInfo.recurrenceMask();
    this.isRepeatEnabled = stepInfo.isRepeatEnabled();
    this.repeatCount = stepInfo.repeatCount();
    this.repeatCurve = stepInfo.repeatCurve();
    this.repeatVelocityCurve = stepInfo.repeatVelocityCurve();
    this.repeatVelocityEnd = stepInfo.repeatVelocityEnd();
}
Also used : NoteOccurrence(com.bitwig.extension.controller.api.NoteOccurrence)

Example 2 with NoteOccurrence

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

the class CursorClipImpl method setPrevNextOccurrence.

/**
 * {@inheritDoc}
 */
@Override
public void setPrevNextOccurrence(final int channel, final int step, final int row, final boolean increase) {
    final StepInfoImpl stepInfo = this.getUpdateableStep(channel, step, row);
    final NoteOccurrenceType occurrenceType = stepInfo.getOccurrence();
    final List<NoteOccurrenceType> types = Arrays.asList(NoteOccurrenceType.values());
    final int typeIndex = Math.max(0, types.indexOf(occurrenceType));
    final int newIndex = Math.max(0, Math.min(types.size() - 1, typeIndex + (increase ? 1 : -1)));
    final NoteOccurrenceType newType = types.get(newIndex);
    stepInfo.setOccurrence(newType);
    if (this.editSteps.isEmpty()) {
        final NoteOccurrence v = NoteOccurrence.valueOf(newType.name());
        this.getClip().getStep(channel, step, row).setOccurrence(v);
    }
}
Also used : NoteOccurrence(com.bitwig.extension.controller.api.NoteOccurrence) NoteOccurrenceType(de.mossgrabers.framework.daw.NoteOccurrenceType)

Aggregations

NoteOccurrence (com.bitwig.extension.controller.api.NoteOccurrence)2 NoteOccurrenceType (de.mossgrabers.framework.daw.NoteOccurrenceType)1