DISTRHO Plugin Framework
Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends | List of all members
UI Class Referenceabstract

#include <DistrhoUI.hpp>

Inheritance diagram for UI:

Public Member Functions

 UI (uint width=0, uint height=0)
 
virtual ~UI ()
 
bool isResizable () const noexcept
 
uint getBackgroundColor () const noexcept
 
uint getForegroundColor () const noexcept
 
double getSampleRate () const noexcept
 
void editParameter (uint32_t index, bool started)
 
void setParameterValue (uint32_t index, float value)
 
void setState (const char *key, const char *value)
 
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)
 

Friends

class PluginWindow
 
class UIExporter
 

Detailed Description

DPF UI class from where UI instances are created.

Note
You must call setSize during construction, @TODO Detailed information about this class.

Constructor & Destructor Documentation

◆ UI()

UI::UI ( uint  width = 0,
uint  height = 0 
)

UI class constructor. The UI should be initialized to a default state that matches the plugin side.

◆ ~UI()

virtual UI::~UI ( )
virtual

Destructor.

Member Function Documentation

◆ isResizable()

bool UI::isResizable ( ) const
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)

◆ getBackgroundColor()

uint UI::getBackgroundColor ( ) const
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:

const int red = (bgColor >> 24) & 0xff;
const int green = (bgColor >> 16) & 0xff;
const int blue = (bgColor >> 8) & 0xff;

◆ getForegroundColor()

uint UI::getForegroundColor ( ) const
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:

const int red = (fgColor >> 24) & 0xff;
const int green = (fgColor >> 16) & 0xff;
const int blue = (fgColor >> 8) & 0xff;

◆ getSampleRate()

double UI::getSampleRate ( ) const
noexcept

Get the current sample rate used in plugin processing.

See also
sampleRateChanged(double)

◆ editParameter()

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.

◆ setParameterValue()

void UI::setParameterValue ( uint32_t  index,
float  value 
)

setParameterValue.

Change a parameter value in the Plugin.

◆ setState()

void UI::setState ( const char *  key,
const char *  value 
)

setState. @TODO Document this.

◆ sendNote()

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).

◆ getPluginInstancePointer()

void* UI::getPluginInstancePointer ( ) const
noexcept

getPluginInstancePointer. @TODO Document this.

◆ getNextBundlePath()

static const char* UI::getNextBundlePath ( )
staticnoexcept

Get the bundle path that will be used for the next UI.

Note
: This function is only valid during createUI(), it will return null when called from anywhere else.

◆ getNextScaleFactor()

static double UI::getNextScaleFactor ( )
staticnoexcept

Get the scale factor that will be used for the next UI.

Note
: This function is only valid during createUI(), it will return 1.0 when called from anywhere else.

◆ getNextWindowId()

static uintptr_t UI::getNextWindowId ( )
staticnoexcept

Get the Window Id that will be used for the next created window.

Note
: This function is only valid during createUI(), it will return 0 when called from anywhere else.

◆ parameterChanged()

virtual void UI::parameterChanged ( uint32_t  index,
float  value 
)
protectedpure virtual

A parameter has changed on the plugin side.
This is called by the host to inform the UI about parameter changes.

◆ programLoaded()

virtual void UI::programLoaded ( uint32_t  index)
protectedpure virtual

A program has been loaded on the plugin side.
This is called by the host to inform the UI about program changes.

◆ stateChanged()

virtual void UI::stateChanged ( const char *  key,
const char *  value 
)
protectedpure virtual

A state has changed on the plugin side.
This is called by the host to inform the UI about state changes.

◆ sampleRateChanged()

virtual void UI::sampleRateChanged ( double  newSampleRate)
protectedvirtual

Optional callback to inform the UI about a sample rate change on the plugin side.

See also
getSampleRate()

The documentation for this class was generated from the following file: