Ejemplo n.º 1
0
static void SelectAllNearestEditCursor(int flag, void *data)
{
    double editCursor = GetCursorPosition();
    RprMidiTakePtr midiTake = RprMidiTake::createFromMidiEditor();

    if (midiTake->countNotes() == 0)
        return;

    int closest = midiTake->getNoteAt(0)->getItemPosition();
    double closestDifference = std::fabs(editCursor - midiTake->getNoteAt(0)->getPosition());
    for(int i = 1; i < midiTake->countNotes(); i++) {
        RprMidiNote *note = midiTake->getNoteAt(i);
        double difference = std::fabs(editCursor - note->getPosition());
        if (difference < closestDifference) {
            closest = note->getItemPosition();
            closestDifference = difference;
        }
    }

    for(int i = 0; i < midiTake->countNotes(); i++) {
        RprMidiNote *note = midiTake->getNoteAt(i);
        if (note->getItemPosition() == closest) {
            note->setSelected(true);
        } else {
            note->setSelected(false);
        }
    }
}
Ejemplo n.º 2
0
static void SelectMutedMidiNotes(int flag, void *data)
{
    RprMidiTakePtr midiTake = RprMidiTake::createFromMidiEditor();
    for(int i = 0; i < midiTake->countNotes(); i++)
        midiTake->getNoteAt(i)->setSelected(midiTake->getNoteAt(i)->isMuted());
}