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

VST2 Guis

Charles Saracco edited this page May 2, 2019 · 3 revisions

Host Window Creation

The DAW handles the creation, opening, and managing of the actual GUI window. It merely passes a window handle to the plugin for the plugin to access it. The type of window that is created is platform-dependent, but in rust-vst it is always encoded as a *mut std::os::raw::c_void (a C-style void pointer), referred to as the "parent pointer".

Let's say you had parent: *mut std::os::raw::c_void.

  • In Windows, the parent pointer is really a winapi::HWND__. You can convert the parent pointer by doing parent as *mut winapi::HWND__.
  • In Linux, it's just an ID number to the parent window. You can convert it by doing parent as u32.
  • TODO: Mac OS X

Your job, as a VST2 GUI developer, is to "connect" your GUI to this parent window, so that the DAW can manage the window (open, close, get events, etc). This is usually done by passing parent as an argument during the window creation phase of your platform's "native" window creation API (winapi's user32::CreateWindowExW, X11/XCB's xcb::create_window, etc).

This method gets messy very quickly. It would have been much wiser to have the plugin control its own window, and there are possibly historical reasons for this choice, but it creates confusing problems quickly. MacOS has a very different windowing and eventing system to Windows and has different rules. Also DAWs have historically presented the window slightly differently.

Misc. Notes
  • The size of the editor window that the DAW creates for you is determined based on your Editor::size() function.
  • Editor::position() is usually ignored; most plugins usually just return (0, 0).
Clone this wiki locally