DISTRHO Plugin Framework
|
#include <DistrhoUI.hpp>
Public Member Functions | |
UI (uint width=0, uint height=0, bool automaticallyScaleAndSetAsMinimumSize=false) | |
~UI () override | |
bool | isResizable () const noexcept |
uint | getBackgroundColor () const noexcept |
uint | getForegroundColor () const noexcept |
double | getSampleRate () const noexcept |
const char * | getBundlePath () const noexcept |
void | editParameter (uint32_t index, bool started) |
void | setParameterValue (uint32_t index, float value) |
void | setState (const char *key, const char *value) |
bool | requestStateFile (const char *key) |
void | sendNote (uint8_t channel, uint8_t note, uint8_t velocity) |
void * | getPluginInstancePointer () const noexcept |
Static Public Member Functions | |
static const char * | getNextBundlePath () noexcept |
static double | getNextScaleFactor () noexcept |
static uintptr_t | getNextWindowId () noexcept |
Protected Member Functions | |
virtual void | parameterChanged (uint32_t index, float value)=0 |
virtual void | programLoaded (uint32_t index)=0 |
virtual void | stateChanged (const char *key, const char *value)=0 |
virtual void | sampleRateChanged (double newSampleRate) |
virtual void | uiIdle () |
virtual void | uiScaleFactorChanged (double scaleFactor) |
void | sizeChanged (uint width, uint height) override |
Friends | |
class | PluginWindow |
class | UIExporter |
DPF UI class from where UI instances are created.
UI::UI | ( | uint | width = 0 , |
uint | height = 0 , |
||
bool | automaticallyScaleAndSetAsMinimumSize = false |
||
) |
UI class constructor. The UI should be initialized to a default state that matches the plugin side.
When automaticallyScale is set to true, DPF will automatically scale up the UI to fit the host/desktop scale factor.
It assumes aspect ratio is meant to be kept. Manually call setGeometryConstraints instead if keeping UI aspect ratio is not required.
|
override |
Destructor.
|
noexcept |
Check if this UI window is resizable (by the user or window manager). There are situations where an UI supports resizing but the plugin host does not, so this could return false.
You might want to add a resize handle for such cases, so the user is still allowed to resize the window. (programatically resizing a window is always possible, but the same is not true for the window manager)
|
noexcept |
Get the color used for UI background (i.e. window color) in RGBA format. Returns 0 by default, in case of error or lack of host support.
The following example code can be use to extract individual colors:
|
noexcept |
Get the color used for UI foreground (i.e. text color) in RGBA format. Returns 0xffffffff by default, in case of error or lack of host support.
The following example code can be use to extract individual colors:
|
noexcept |
Get the current sample rate used in plugin processing.
|
noexcept |
Get the bundle path where the UI resides.
Can return null if the UI is not available in a bundle (if it is a single binary).
void UI::editParameter | ( | uint32_t | index, |
bool | started | ||
) |
editParameter.
Touch/pressed-down event. Lets the host know the user is tweaking a parameter. Required in some hosts to record automation.
void UI::setParameterValue | ( | uint32_t | index, |
float | value | ||
) |
setParameterValue.
Change a parameter value in the Plugin.
void UI::setState | ( | const char * | key, |
const char * | value | ||
) |
setState. @TODO Document this.
bool UI::requestStateFile | ( | const char * | key | ) |
Request a new file from the host, matching the properties of a state key.
This will use the native host file browser if available, otherwise a DPF built-in file browser is used.
Response will be sent asynchronously to stateChanged, with the matching key and the new file as the value.
It is not possible to know if the action was cancelled by the user.
void UI::sendNote | ( | uint8_t | channel, |
uint8_t | note, | ||
uint8_t | velocity | ||
) |
Send a single MIDI note from the UI to the plugin DSP side.
A note with zero velocity will be sent as note-off (MIDI 0x80), otherwise note-on (MIDI 0x90).
|
noexcept |
getPluginInstancePointer. @TODO Document this.
|
staticnoexcept |
Get the bundle path that will be used for the next UI.
|
staticnoexcept |
Get the scale factor that will be used for the next UI.
|
staticnoexcept |
Get the Window Id that will be used for the next created window.
|
protectedpure virtual |
A parameter has changed on the plugin side.
This is called by the host to inform the UI about parameter changes.
|
protectedpure virtual |
A program has been loaded on the plugin side.
This is called by the host to inform the UI about program changes.
|
protectedpure virtual |
A state has changed on the plugin side.
This is called by the host to inform the UI about state changes.
|
protectedvirtual |
Optional callback to inform the UI about a sample rate change on the plugin side.
|
inlineprotectedvirtual |
|
protectedvirtual |
Window scale factor function, called when the scale factor changes. This function is for plugin UIs to be able to override Window::onScaleFactorChanged(double).
The default implementation does nothing. WARNING function needs a proper name
|
overrideprotected |