Mouse Wheel Movements & Slider Attachments


Slider drags start and end with mouse dragging, and SliderAttachment uses sliderDragStarted() and sliderDragEnded() to determine when to start and end parameter gestures. Because adjusting a slider via mouse wheel doesn’t trigger these drag callbacks it ends up with a lot of automation stuttering in Touch automation (testing on Pro Tools currently) since our value is set without gesture start/end calls.

Our workaround currently is using a custom attachment that determines gesture start and end by starting a timer when the slider receives a mouse wheel.

Are mouse wheel adjustments something that could be supported by the default juce::AudioProcessorValueTreeState::SliderAttachment?


Seems I was slightly off as to the location of the issue, stuttering is because a gesture is started and ended immediately (DragInProgress going out of scope after setValue()) every mouse wheel event in juce_Slider.cpp line 1072:

bool mouseWheelMove (const MouseEvent& e, const MouseWheelDetails& wheel)
    if (scrollWheelEnabled
         && style != TwoValueHorizontal
         && style != TwoValueVertical)
        // sometimes duplicate wheel events seem to be sent, so since we're going to
        // bump the value by a minimum of the interval, avoid doing this twice..
        if (e.eventTime != lastMouseWheelTime)
            lastMouseWheelTime = e.eventTime;

            if (normRange.end > normRange.start && ! e.mods.isAnyMouseButtonDown())
                if (valueBox != nullptr)
                    valueBox->hideEditor (false);

                auto value = static_cast<double> (currentValue.getValue());
                auto delta = getMouseWheelDelta (value, (std::abs (wheel.deltaX) > std::abs (wheel.deltaY)
                                                              ? -wheel.deltaX : wheel.deltaY)
                                                           * (wheel.isReversed ? -1.0f : 1.0f));
                if (delta != 0.0)
                    auto newValue = value + jmax (normRange.interval, std::abs (delta)) * (delta < 0 ? -1.0 : 1.0);

                    DragInProgress drag (*this);
                    setValue (owner.snapValue (newValue, notDragging), sendNotificationSync);

        return true;

    return false;


But isn’t this what you want on a mouse-wheel change?


Hard to say - it works well for moving stepped wheels by a few clicks. On a smooth-wheel mouse trying to adjust sliders, even in small amounts, in Touch automation ends up with some pretty funky curves unless I use a timer to end the gesture