@@ -91,11 +91,10 @@ START_NAMESPACE_DISTRHO | |||
/** | |||
Get the plugin version, in hexadecimal. | |||
TODO format to be defined | |||
*/ | |||
uint32_t getVersion() const override | |||
{ | |||
return 0x1000; | |||
return d_version(1, 0, 0); | |||
} | |||
/** | |||
@@ -104,7 +103,7 @@ START_NAMESPACE_DISTRHO | |||
*/ | |||
int64_t getUniqueId() const override | |||
{ | |||
return cconst('M', 'u', 't', 'e'); | |||
return d_cconst('M', 'u', 't', 'e'); | |||
} | |||
/* ---------------------------------------------------------------------------------------- | |||
@@ -186,12 +185,12 @@ START_NAMESPACE_DISTRHO | |||
uint32_t getVersion() const override | |||
{ | |||
return 0x1000; | |||
return d_version(1, 0, 0); | |||
} | |||
int64_t getUniqueId() const override | |||
{ | |||
return cconst('G', 'a', 'i', 'n'); | |||
return d_cconst('G', 'a', 'i', 'n'); | |||
} | |||
/* ---------------------------------------------------------------------------------------- | |||
@@ -298,12 +297,12 @@ START_NAMESPACE_DISTRHO | |||
uint32_t getVersion() const override | |||
{ | |||
return 0x1000; | |||
return d_version(1, 0, 0); | |||
} | |||
int64_t getUniqueId() const override | |||
{ | |||
return cconst('P', 'r', 'o', 'g'); | |||
return d_cconst('P', 'r', 'o', 'g'); | |||
} | |||
/* ---------------------------------------------------------------------------------------- | |||
@@ -529,6 +529,9 @@ public: | |||
Write a MIDI output event.@n | |||
This function must only be called during run().@n | |||
Returns false when the host buffer is full, in which case do not call this again until the next run(). | |||
@note This function is not implemented yet!@n | |||
It's here so that developers can prepare MIDI plugins in advance.@n | |||
If you plan to use this, please report to DPF authos so it can be implemented. | |||
*/ | |||
bool writeMidiEvent(const MidiEvent& midiEvent) noexcept; | |||
#endif | |||
@@ -109,16 +109,25 @@ public: | |||
void* getPluginInstancePointer() const noexcept; | |||
#endif | |||
#if DISTRHO_PLUGIN_HAS_EMBED_UI && DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
/* -------------------------------------------------------------------------------------------------------- | |||
* External embeddable UI helpers */ | |||
* External UI helpers */ | |||
/** | |||
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. | |||
*/ | |||
static const char* getNextBundlePath() noexcept; | |||
# if DISTRHO_PLUGIN_HAS_EMBED_UI | |||
/** | |||
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. | |||
*/ | |||
static uintptr_t getNextWindowId() noexcept; | |||
# endif | |||
#endif | |||
protected: | |||
@@ -46,8 +46,6 @@ public: | |||
pthread_mutexattr_init(&attr); | |||
pthread_mutexattr_setprotocol(&attr, inheritPriority ? PTHREAD_PRIO_INHERIT : PTHREAD_PRIO_NONE); | |||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL); | |||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK); | |||
pthread_mutexattr_setrobust(&attr, PTHREAD_MUTEX_ROBUST); | |||
pthread_mutex_init(&fMutex, &attr); | |||
pthread_mutexattr_destroy(&attr); | |||
} | |||
@@ -21,7 +21,7 @@ | |||
#include "Sleep.hpp" | |||
#include "String.hpp" | |||
#ifdef DISTRHO_OS_LINUX | |||
#ifdef DISTRHO_OS_LINUX_FULL | |||
# include <sys/prctl.h> | |||
#endif | |||
@@ -199,7 +199,7 @@ public: | |||
{ | |||
DISTRHO_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',); | |||
#ifdef DISTRHO_OS_LINUX | |||
#ifdef DISTRHO_OS_LINUX_FULL | |||
prctl(PR_SET_NAME, name, 0, 0, 0); | |||
#endif | |||
#if defined(__GLIBC__) && (__GLIBC__ * 1000 + __GLIBC_MINOR__) >= 2012 | |||
@@ -37,7 +37,10 @@ | |||
# define DISTRHO_DLL_EXTENSION "dylib" | |||
# elif defined(__HAIKU__) | |||
# define DISTRHO_OS_HAIKU 1 | |||
# elif defined(__linux__) | |||
# elif defined(__linux__) || defined(__linux) | |||
# define DISTRHO_OS_LINUX 1 | |||
# define DISTRHO_OS_LINUX_FULL 1 | |||
# elif defined(__FreeBSD__) || defined(__GNU__) | |||
# define DISTRHO_OS_LINUX 1 | |||
# endif | |||
#endif | |||
@@ -378,7 +378,7 @@ public: | |||
if (fLastPositionData.barBeat >= 0.0f) | |||
{ | |||
const double rest = std::fmod(fLastPositionData.barBeat, 1.0); | |||
const double rest = std::fmod(fLastPositionData.barBeat, 1.0f); | |||
fTimePosition.bbt.beat = fLastPositionData.barBeat-rest+1.0; | |||
fTimePosition.bbt.tick = rest*fTimePosition.bbt.ticksPerBeat+0.5; | |||
} | |||
@@ -554,9 +554,9 @@ public: | |||
if (fLastPositionData.barBeat >= 0.0f) | |||
{ | |||
fLastPositionData.barBeat = std::fmod(fLastPositionData.barBeat+addedBarBeats, | |||
fLastPositionData.beatsPerBar); | |||
(double)fLastPositionData.beatsPerBar); | |||
const double rest = std::fmod(fLastPositionData.barBeat, 1.0); | |||
const double rest = std::fmod(fLastPositionData.barBeat, 1.0f); | |||
fTimePosition.bbt.beat = fLastPositionData.barBeat-rest+1.0; | |||
fTimePosition.bbt.tick = rest*fTimePosition.bbt.ticksPerBeat+0.5; | |||
@@ -25,12 +25,13 @@ START_NAMESPACE_DISTRHO | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Static data, see DistrhoUIInternal.hpp */ | |||
double d_lastUiSampleRate = 0.0; | |||
void* d_lastUiDspPtr = nullptr; | |||
double d_lastUiSampleRate = 0.0; | |||
void* d_lastUiDspPtr = nullptr; | |||
#ifdef HAVE_DGL | |||
Window* d_lastUiWindow = nullptr; | |||
Window* d_lastUiWindow = nullptr; | |||
#endif | |||
uintptr_t g_nextWindowId = 0; | |||
uintptr_t g_nextWindowId = 0; | |||
const char* g_nextBundlePath = nullptr; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* UI */ | |||
@@ -98,14 +99,21 @@ void* UI::getPluginInstancePointer() const noexcept | |||
} | |||
#endif | |||
#if DISTRHO_PLUGIN_HAS_EMBED_UI && DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
#if DISTRHO_PLUGIN_HAS_EXTERNAL_UI | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* External embeddable UI helpers */ | |||
* External UI helpers */ | |||
const char* UI::getNextBundlePath() noexcept | |||
{ | |||
return g_nextBundlePath; | |||
} | |||
# if DISTRHO_PLUGIN_HAS_EMBED_UI | |||
uintptr_t UI::getNextWindowId() noexcept | |||
{ | |||
return g_nextWindowId; | |||
} | |||
# endif | |||
#endif | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
@@ -32,12 +32,13 @@ START_NAMESPACE_DISTRHO | |||
// ----------------------------------------------------------------------- | |||
// Static data, see DistrhoUI.cpp | |||
extern double d_lastUiSampleRate; | |||
extern void* d_lastUiDspPtr; | |||
extern double d_lastUiSampleRate; | |||
extern void* d_lastUiDspPtr; | |||
#ifdef HAVE_DGL | |||
extern Window* d_lastUiWindow; | |||
extern Window* d_lastUiWindow; | |||
#endif | |||
extern uintptr_t g_nextWindowId; | |||
extern uintptr_t g_nextWindowId; | |||
extern const char* g_nextBundlePath; | |||
// ----------------------------------------------------------------------- | |||
// UI callbacks | |||
@@ -199,13 +200,15 @@ private: | |||
}; | |||
#else | |||
static inline | |||
UI* createUiWrapper(void* const dspPtr, const uintptr_t winId) | |||
UI* createUiWrapper(void* const dspPtr, const uintptr_t winId, const char* const bundlePath) | |||
{ | |||
d_lastUiDspPtr = dspPtr; | |||
g_nextWindowId = winId; | |||
UI* const ret = createUI(); | |||
d_lastUiDspPtr = nullptr; | |||
g_nextWindowId = 0; | |||
d_lastUiDspPtr = dspPtr; | |||
g_nextWindowId = winId; | |||
g_nextBundlePath = bundlePath; | |||
UI* const ret = createUI(); | |||
d_lastUiDspPtr = nullptr; | |||
g_nextWindowId = 0; | |||
g_nextBundlePath = nullptr; | |||
return ret; | |||
} | |||
#endif | |||
@@ -218,14 +221,15 @@ class UIExporter | |||
public: | |||
UIExporter(void* const ptr, const intptr_t winId, | |||
const editParamFunc editParamCall, const setParamFunc setParamCall, const setStateFunc setStateCall, const sendNoteFunc sendNoteCall, const setSizeFunc setSizeCall, | |||
void* const dspPtr = nullptr) | |||
void* const dspPtr = nullptr, | |||
const char* const bundlePath = nullptr) | |||
#ifdef HAVE_DGL | |||
: glApp(), | |||
glWindow(glApp, winId, dspPtr), | |||
fChangingSize(false), | |||
fUI(glWindow.getUI()), | |||
#else | |||
: fUI(createUiWrapper(dspPtr, winId)), | |||
: fUI(createUiWrapper(dspPtr, winId, bundlePath)), | |||
#endif | |||
fData((fUI != nullptr) ? fUI->pData : nullptr) | |||
{ | |||
@@ -238,6 +242,11 @@ public: | |||
fData->setStateCallbackFunc = setStateCall; | |||
fData->sendNoteCallbackFunc = sendNoteCall; | |||
fData->setSizeCallbackFunc = setSizeCall; | |||
#ifdef HAVE_DGL | |||
// unused | |||
return; (void)bundlePath; | |||
#endif | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -39,11 +39,11 @@ START_NAMESPACE_DISTRHO | |||
class UiLv2 | |||
{ | |||
public: | |||
UiLv2(const intptr_t winId, | |||
UiLv2(const char* const bundlePath, const intptr_t winId, | |||
const LV2_Options_Option* options, const LV2_URID_Map* const uridMap, const LV2UI_Resize* const uiResz, const LV2UI_Touch* uiTouch, | |||
const LV2UI_Controller controller, const LV2UI_Write_Function writeFunc, | |||
LV2UI_Widget* const widget, void* const dspPtr) | |||
: fUI(this, winId, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback, dspPtr), | |||
: fUI(this, winId, editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback, dspPtr, bundlePath), | |||
fUridMap(uridMap), | |||
fUiResize(uiResz), | |||
fUiTouch(uiTouch), | |||
@@ -319,7 +319,8 @@ private: | |||
// ----------------------------------------------------------------------- | |||
static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, const char*, LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||
static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, const char* bundlePath, | |||
LV2UI_Write_Function writeFunction, LV2UI_Controller controller, LV2UI_Widget* widget, const LV2_Feature* const* features) | |||
{ | |||
if (uri == nullptr || std::strcmp(uri, DISTRHO_PLUGIN_URI) != 0) | |||
{ | |||
@@ -421,7 +422,7 @@ static LV2UI_Handle lv2ui_instantiate(const LV2UI_Descriptor*, const char* uri, | |||
d_lastUiSampleRate = 44100.0; | |||
} | |||
return new UiLv2(winId, options, uridMap, uiResize, uiTouch, controller, writeFunction, widget, instance); | |||
return new UiLv2(bundlePath, winId, options, uridMap, uiResize, uiTouch, controller, writeFunction, widget, instance); | |||
} | |||
#define uiPtr ((UiLv2*)ui) | |||