Signed-off-by: falkTX <falktx@falktx.com>pull/452/head
| @@ -698,11 +698,11 @@ endif | |||
| # --------------------------------------------------------------------------------------------------------------------- | |||
| # Export | |||
| # ifeq ($(HAVE_DGL),true) | |||
| # $(BUILD_DIR)/export$(APP_EXT): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_EXPORT.cpp.o $(BUILD_DIR)/DistrhoUIMain_EXPORT.cpp.o $(DGL_LIB) | |||
| # else | |||
| ifeq ($(HAVE_DGL),true) | |||
| $(BUILD_DIR)/export$(APP_EXT): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_EXPORT.cpp.o $(BUILD_DIR)/DistrhoUIMain_EXPORT.cpp.o $(DGL_LIB) | |||
| else | |||
| $(BUILD_DIR)/export$(APP_EXT): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_EXPORT.cpp.o | |||
| # endif | |||
| endif | |||
| -@mkdir -p $(shell dirname $@) | |||
| @echo "Creating export tool for $(NAME)" | |||
| $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) -o $@ | |||
| @@ -44,7 +44,7 @@ | |||
| # define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1 | |||
| # include "src/DistrhoUIVST3.cpp" | |||
| #elif defined(DISTRHO_PLUGIN_TARGET_EXPORT) | |||
| # define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 0 | |||
| # define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1 | |||
| #elif defined(DISTRHO_PLUGIN_TARGET_SHARED) || defined(DISTRHO_PLUGIN_TARGET_STATIC) | |||
| # define DISTRHO_PLUGIN_AND_UI_IN_SINGLE_OBJECT 1 | |||
| #else | |||
| @@ -393,14 +393,23 @@ public: | |||
| return kAudioUnitErr_InvalidProperty; | |||
| #endif | |||
| case 19001: | |||
| #if DISTRHO_PLUGIN_HAS_UI && DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||
| case 'DPFa': | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement == 0, inElement, kAudioUnitErr_InvalidElement); | |||
| outDataSize = sizeof(void*); | |||
| outWritable = false; | |||
| return noErr; | |||
| #endif | |||
| case 'DPFp': | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement < fParameterCount, inElement, kAudioUnitErr_InvalidElement); | |||
| outDataSize = sizeof(float); | |||
| outWritable = true; | |||
| return noErr; | |||
| case 19002: | |||
| case 'DPFt': | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement < fParameterCount, inElement, kAudioUnitErr_InvalidElement); | |||
| outDataSize = sizeof(bool); | |||
| @@ -690,6 +699,12 @@ public: | |||
| } | |||
| return noErr; | |||
| #endif | |||
| #if DISTRHO_PLUGIN_HAS_UI && DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||
| case 'DPFa': | |||
| *static_cast<void**>(outData) = fPlugin.getInstancePointer(); | |||
| return noErr; | |||
| #endif | |||
| } | |||
| d_stdout("TODO GetProperty(%d:%s, %d:%s, %d, ...)", inProp, AudioUnitPropertyID2Str(inProp), inScope, AudioUnitScope2Str(inScope), inElement); | |||
| @@ -902,7 +917,7 @@ public: | |||
| // TODO | |||
| return noErr; | |||
| case 19001: | |||
| case 'DPFp': | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement < fParameterCount, inElement, kAudioUnitErr_InvalidElement); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(float), inDataSize, kAudioUnitErr_InvalidPropertyValue); | |||
| @@ -924,7 +939,7 @@ public: | |||
| } | |||
| return noErr; | |||
| case 19002: | |||
| case 'DPFt': | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inScope == kAudioUnitScope_Global, inScope, kAudioUnitErr_InvalidScope); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inElement < fParameterCount, inElement, kAudioUnitErr_InvalidElement); | |||
| DISTRHO_SAFE_ASSERT_UINT_RETURN(inDataSize == sizeof(bool), inDataSize, kAudioUnitErr_InvalidPropertyValue); | |||
| @@ -1041,7 +1056,7 @@ public: | |||
| fLastParameterValues[param] = value; | |||
| fPlugin.setParameterValue(param, value); | |||
| // TODO flag param only, notify listeners later on bg thread (sem_post etc) | |||
| notifyListeners(19003, kAudioUnitScope_Global, param); | |||
| notifyListeners('DPFP', kAudioUnitScope_Global, param); | |||
| } | |||
| return noErr; | |||
| @@ -81,12 +81,12 @@ public: | |||
| CFRunLoopAddTimer(CFRunLoopGetCurrent(), fTimerRef, kCFRunLoopCommonModes); | |||
| AudioUnitAddPropertyListener(fComponent, 19003, auPropertyChangedCallback, this); | |||
| AudioUnitAddPropertyListener(fComponent, 'DPFP', auPropertyChangedCallback, this); | |||
| } | |||
| ~DPF_UI_AU() | |||
| { | |||
| AudioUnitRemovePropertyListenerWithUserData(fComponent, 19003, auPropertyChangedCallback, this); | |||
| AudioUnitRemovePropertyListenerWithUserData(fComponent, 'DPFP', auPropertyChangedCallback, this); | |||
| if (fTimerRef != nullptr) | |||
| { | |||
| @@ -126,7 +126,7 @@ private: | |||
| { | |||
| switch (prop) | |||
| { | |||
| case 19003: | |||
| case 'DPFP': | |||
| { | |||
| AudioUnitParameterValue value; | |||
| if (AudioUnitGetParameter(fComponent, elem, kAudioUnitScope_Global, 0, &value) == noErr) | |||
| @@ -156,7 +156,7 @@ private: | |||
| void editParameter(const uint32_t rindex, const bool started) const | |||
| { | |||
| AudioUnitSetProperty(fComponent, 19002, kAudioUnitScope_Global, rindex, &started, sizeof(bool)); | |||
| AudioUnitSetProperty(fComponent, 'DPFt', kAudioUnitScope_Global, rindex, &started, sizeof(bool)); | |||
| } | |||
| static void editParameterCallback(void* const ptr, const uint32_t rindex, const bool started) | |||
| @@ -166,7 +166,7 @@ private: | |||
| void setParameterValue(const uint32_t rindex, const float value) | |||
| { | |||
| AudioUnitSetProperty(fComponent, 19001, kAudioUnitScope_Global, rindex, &value, sizeof(float)); | |||
| AudioUnitSetProperty(fComponent, 'DPFp', kAudioUnitScope_Global, rindex, &value, sizeof(float)); | |||
| } | |||
| static void setParameterCallback(void* const ptr, const uint32_t rindex, const float value) | |||
| @@ -239,7 +239,12 @@ END_NAMESPACE_DISTRHO | |||
| { | |||
| const double sampleRate = d_nextSampleRate; | |||
| const intptr_t winId = 0; | |||
| void* const instancePointer = nullptr; | |||
| void* instancePointer = nullptr; | |||
| #if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS | |||
| UInt32 size = sizeof(void*); | |||
| AudioUnitGetProperty(component, 'DPFa', kAudioUnitScope_Global, 0, &instancePointer, &size); | |||
| #endif | |||
| ui = new DPF_UI_AU(component, winId, sampleRate, instancePointer); | |||