|
Dusk Audio Framework
|
#include <DafUI.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 |
Protected Member Functions | |
| virtual void | parameterChanged (uint32_t index, float value) |
| virtual void | programLoaded (uint32_t index) |
| virtual void | stateChanged (const char *key, const char *value) |
| virtual void | sampleRateChanged (double newSampleRate) |
| virtual void | uiIdle () |
| virtual void | uiScaleFactorChanged (double scaleFactor) |
| std::vector< DGL_NAMESPACE::ClipboardDataOffer > | getClipboardDataOfferTypes () |
| virtual uint32_t | uiClipboardDataOffer () |
| virtual void | uiFocus (bool focus, DGL_NAMESPACE::CrossingMode mode) |
| virtual void | uiReshape (uint width, uint height) |
| void | onResize (const ResizeEvent &ev) override |
Friends | |
| class | PluginWindow |
| class | UIExporter |
DAF 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, DAF 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. (programmatically 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 DAF 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.
|
protectedvirtual |
A parameter has changed on the plugin side.
This is called by the host to inform the UI about parameter changes.
|
protectedvirtual |
A program has been loaded on the plugin side.
This is called by the host to inform the UI about program changes.
|
protectedvirtual |
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
|
protected |
Get the types available for the data in a clipboard. Must only be called within the context of uiClipboardDataOffer.
|
protectedvirtual |
Window clipboard data offer function, called when clipboard has data present, possibly with several datatypes. While handling this event, the data types can be investigated with getClipboardDataOfferTypes() to decide whether to accept the offer.
Reimplement and return a non-zero id to accept the clipboard data offer for a particular type. UIs must ignore any type they do not recognize.
The default implementation accepts the "text/plain" mimetype.
|
protectedvirtual |
Windows focus function, called when the window gains or loses the keyboard focus. This function is for plugin UIs to be able to override Window::onFocus(bool, CrossingMode).
The default implementation does nothing.
|
protectedvirtual |
Window reshape function, called when the window is resized. This function is for plugin UIs to be able to override Window::onReshape(uint, uint).
Called from the drawing path, with the graphics context current, before the first draw that follows the resize. The plugin UI size has already been set by the time this runs. The default implementation sets up the drawing context where necessary.
You should almost never need to override this function. The most common exception is custom OpenGL setup, but only really needed for custom OpenGL drawing code.
|
overrideprotected |