summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Zammit <damien@zamaudio.com>2019-02-09 22:02:59 +1100
committerDamien Zammit <damien@zamaudio.com>2019-02-09 22:25:24 +1100
commit4a6b601b828f5eb623ba450cb4ca9b1c6b92f3ef (patch)
treef5f739174d55586690014cf58647182a097548bc
parent765e2dda8810dc382ade80065999c2f59c032938 (diff)
Get parameter count from DSP (direct access)au-ui
-rw-r--r--distrho/src/CocoaUI/PluginAU_CocoaUI.m20
-rw-r--r--distrho/src/DistrhoUIInternal.hpp9
-rw-r--r--examples/Parameters/DistrhoPluginInfo.h3
3 files changed, 28 insertions, 4 deletions
diff --git a/distrho/src/CocoaUI/PluginAU_CocoaUI.m b/distrho/src/CocoaUI/PluginAU_CocoaUI.m
index e8e1d7bf..dec13f50 100644
--- a/distrho/src/CocoaUI/PluginAU_CocoaUI.m
+++ b/distrho/src/CocoaUI/PluginAU_CocoaUI.m
@@ -3,6 +3,7 @@
#include <AudioToolbox/AudioToolbox.h>
#include <AudioUnit/AUCocoaUIView.h>
#include "DistrhoUIInternal.hpp"
+#include "DistrhoPluginInternal.hpp" // Direct access
#define MAX_PARAMS 100
@@ -13,6 +14,7 @@ class UIAu
public:
UIAu(const char* const uiTitle)
: fUI(this, 0, nullptr, setParameterCallback, setStateCallback, sendNoteCallback, setSizeCallback),
+ fPlugin((PluginExporter *)fUI.getDirectAccess()),
fHostClosed(false)
{
fUI.setWindowTitle(uiTitle);
@@ -22,15 +24,24 @@ public:
{
}
+ uint32_t getParameterCountFromDSP()
+ {
+ return fPlugin->getParameterCount();
+ }
+
void auui_showhide(bool show)
{
fUI.setWindowVisible(show);
}
+ void parameterChanged(const uint32_t rindex, const float value)
+ {
+ fUI.parameterChanged(rindex, value);
+ }
+
protected:
void setParameterValue(const uint32_t rindex, const float value)
{
- //FIXME fUI.setParameterValue(rindex, value);
}
void setState(const char* const key, const char* const value)
@@ -44,6 +55,7 @@ protected:
private:
UIExporter fUI;
+ PluginExporter *fPlugin;
bool fHostClosed;
// -------------------------------------------------------------------
@@ -117,8 +129,9 @@ END_NAMESPACE_DISTRHO
// remove previous listeners
if (mAU) [self _removeListeners];
mAU = inAU;
+ fUIAu = new UIAu(DISTRHO_PLUGIN_NAME);
- paramCount = 1; //globalUI->dspPtr.getParameterCount();
+ paramCount = fUIAu->getParameterCountFromDSP();
UInt32 i;
for (i = 0; i < paramCount; ++i) {
@@ -128,7 +141,6 @@ END_NAMESPACE_DISTRHO
mParameter[i].mElement = 0;
}
- fUIAu = new UIAu(DISTRHO_PLUGIN_NAME);
// add new listeners
[self _addListeners];
@@ -199,7 +211,7 @@ void ParameterListenerDispatcher (void *inRefCon, void *inObject,
parameter: (const AudioUnitParameter *)inParameter
value: (Float32)inValue
{
- //DPF: setUIParameter(inParameter->mParameterID, inValue);
+ fUIAu->parameterChanged(inParameter->mParameterID, inValue);
}
@end
diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp
index 4ea26580..c226db32 100644
--- a/distrho/src/DistrhoUIInternal.hpp
+++ b/distrho/src/DistrhoUIInternal.hpp
@@ -341,6 +341,15 @@ public:
// -------------------------------------------------------------------
+#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
+ void* getDirectAccess() const noexcept
+ {
+ DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0);
+
+ return fData->dspPtr;
+ }
+#endif
+
uint32_t getParameterOffset() const noexcept
{
DISTRHO_SAFE_ASSERT_RETURN(fData != nullptr, 0);
diff --git a/examples/Parameters/DistrhoPluginInfo.h b/examples/Parameters/DistrhoPluginInfo.h
index 7fbe74e9..a9908812 100644
--- a/examples/Parameters/DistrhoPluginInfo.h
+++ b/examples/Parameters/DistrhoPluginInfo.h
@@ -27,6 +27,9 @@
#define DISTRHO_PLUGIN_NUM_OUTPUTS 2
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
+// FIXME
+#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 1
+
#define DISTRHO_PLUGIN_AU_SUBTYPE 'prms'
#define DISTRHO_PLUGIN_AU_MANUF 'dpf '