Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

GUI Development Tips

Charles Saracco edited this page May 2, 2019 · 1 revision

(TODO: This was what was left over from the old GUI page after re-organizing it. Clean it up further?)

The goal of this project is to deliver several libraries which cater to GUI development within audio plugins (VST, AU, LV2, etc) within Rust. Currently there are solutions outside the Rust ecosystem, but they are subject to heavy license agreements, often cumbersome to develop with, and often force the developer into language and environment choices they may not have otherwise chosen.

There are various approaches and they all have pros and cons. The aim of this document is to summarise them and bring newcomers up to speed with the state of development to encourage them to contribute.

Troubleshooting when developing plugin UIs.

Most GUI-related crashes with rust-vst occur because of unsafe operations on pointers that are actually nil pointers. For example, MacOS has an ARC memory model, which Rust does not control. That means, when you destroy an object that holds a nil pointer, it becomes orphaned data.

Debugging

If you wish to debug within a DAW, you can't write to stdout, so println! is out. You'll need to set up a logging system like simplelogger and write to a text file you can monitor.

Another option is to use mrswatson and run the plugin on the cli. Then you can use println!, but be sure to remove it later when you want to test in a real daw.

The DAW/plugin crashes when the plugin loads.

The DAW is likely trying to access a nil pointer. Check that you have no println! macros in your plugin as this can also cause a crash in some DAWs.

The DAW/plugin crashes when the window is opened or closed.

Check all of the handles you are utilising and make sure they are not creating or attaching objects to windows that are not yours or don't exist. When closing, make sure you destroy all objects first, then allow the DAW to destroy the window. This is probably the most common reason for plugins crashing.

Resources

DPlug - D-based libraries for various audio plugin types