Skip to content

More Options

p0nce edited this page Oct 26, 2023 · 15 revisions

The Dplug Options in this page are not breaking, and not intended for introducing breaking changes.
They basically change the behaviour of Dplug, are not transitional, and are often used as an aid in development. The Dplug_xxx options are part of the API and will not be removed.

They are implemented as version identifiers, like the other Dplug Options.

version(Dplug_NoMouseCursor)

  • Goal: Ignore everything regarding mouse cursors and keep them untouched.
  • Usage: In your dub.json add "Dplug_NoMouseCursor" to the list of version identifiers. Now, it's as if Dplug plug-ins don't touch mouse cursors at all, like before the feature was implemented.

version(Dplug_ProfileUI)

  • Goal: Produce a flame graph to benchmark your UI.

  • Usage: In your dub.json add "Dplug_ProfileUI" to the list of version identifiers.

    Now the UI context holds a traceProfiler() object that can record events, and does so by default. Every event is recorded for the duration of the session.

    In your UI destructor, put this line:

    version(Dplug_ProfileUI)
    {
        import dplug.core.file;
        writeFile(`/home/myuser/plugin-trace.json`, context.profiler.toBytes());
    }

    This JSON file can be open in https://ui.perfetto.dev/ or chrome://tracing/ to explore visually the UI CPU consumption.

version(Dplug_MouseWheelOutsideWindow)

  • Goal: (Windows only) Hook the mouse callback so that you can use mouse wheel while dragging outside of the plugin window boundaries. This is most useful for eg. EQ plugins where you would want to use mouse wheel while dragging a point out of the plugin window.
    This option is Windows-only, it is ignored on Linux and macOS, where such a thing always works. Dragging + mouse wheel inside the plugin window doesn't need that option. Considerable downside: lagging mouse input when the DAW is busy, this can lower user experience.

  • Usage: In your dub.json add "Dplug_MouseWheelOutsideWindow" to the list of version identifiers.