Browse Source

AU related fixups

Signed-off-by: falkTX <falktx@falktx.com>
pull/452/head
falkTX 1 year ago
parent
commit
9be6a49c42
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
5 changed files with 27 additions and 46 deletions
  1. +2
    -2
      Makefile.plugins.mk
  2. +6
    -1
      cmake/DPF-plugin.cmake
  3. +10
    -6
      distrho/src/DistrhoPluginAU.cpp
  4. +5
    -13
      distrho/src/DistrhoUIAU.mm
  5. +4
    -24
      examples/Meters/ExampleUIMeters.cpp

+ 2
- 2
Makefile.plugins.mk View File

@@ -693,9 +693,9 @@ $(au): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_AU.cpp.o
endif
-@mkdir -p $(shell dirname $@)
@echo "Creating AU component for $(NAME)"
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) -framework AudioToolbox $(SHARED) $(SYMBOLS_AU) -o $@
$(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(EXTRA_LIBS) $(EXTRA_DSP_LIBS) $(EXTRA_UI_LIBS) $(DGL_LIBS) -framework AudioToolbox -framework CoreFoundation $(SHARED) $(SYMBOLS_AU) -o $@

# -framework AudioUnit -framework Foundation
# -framework AudioUnit

# ---------------------------------------------------------------------------------------------------------------------
# Export


+ 6
- 1
cmake/DPF-plugin.cmake View File

@@ -561,8 +561,13 @@ function(dpf__build_au NAME HAS_UI)
dpf__add_ui_main("${NAME}-au" "au" "${HAS_UI}")
dpf__set_module_export_list("${NAME}-au" "au")
find_library(APPLE_AUDIOTOOLBOX_FRAMEWORK "AudioToolbox")
find_library(APPLE_COREFOUNDATION_FRAMEWORK "CoreFoundation")
target_compile_options("${NAME}-au" PRIVATE "-ObjC++")
target_link_libraries("${NAME}-au" PRIVATE "${NAME}-dsp" "${NAME}-ui" "${APPLE_AUDIOTOOLBOX_FRAMEWORK}")
target_link_libraries("${NAME}-au" PRIVATE
"${NAME}-dsp"
"${NAME}-ui"
"${APPLE_AUDIOTOOLBOX_FRAMEWORK}"
"${APPLE_COREFOUNDATION_FRAMEWORK}")
set_target_properties("${NAME}-au" PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/${NAME}.component/Contents/MacOS/$<0:>"
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/obj/au/$<0:>"


+ 10
- 6
distrho/src/DistrhoPluginAU.cpp View File

@@ -22,7 +22,7 @@
#include "DistrhoPluginInternal.hpp"
#include "../DistrhoPluginUtils.hpp"

#if DISTRHO_PLUGIN_HAS_UI
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
# include "../extra/RingBuffer.hpp"
#endif

@@ -239,6 +239,9 @@ static constexpr const requestParameterValueChangeFunc requestParameterValueChan
#if ! DISTRHO_PLUGIN_WANT_STATE
static constexpr const updateStateValueFunc updateStateValueCallback = nullptr;
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS
static constexpr const double kDefaultTicksPerBeat = 1920.0;
#endif

typedef std::map<const String, String> StringMap;

@@ -352,9 +355,7 @@ public:

#if DISTRHO_PLUGIN_WANT_TIMEPOS
std::memset(&fHostCallbackInfo, 0, sizeof(fHostCallbackInfo));

// ticksPerBeat is not possible with AU
fTimePosition.bbt.ticksPerBeat = 1920.0;
fTimePosition.bbt.ticksPerBeat = kDefaultTicksPerBeat;
#endif
}

@@ -384,6 +385,7 @@ public:
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS
fTimePosition.clear();
fTimePosition.bbt.ticksPerBeat = kDefaultTicksPerBeat;
#endif
return noErr;
}
@@ -1578,6 +1580,7 @@ public:
#endif
#if DISTRHO_PLUGIN_WANT_TIMEPOS
fTimePosition.clear();
fTimePosition.bbt.ticksPerBeat = kDefaultTicksPerBeat;
#endif
return noErr;
}
@@ -1936,12 +1939,13 @@ private:
Float32 f1 = 4.f; // initial value for beats per bar
Float64 g1 = 0.0;
Float64 g2 = 0.0;
UInt32 u1 = 0.0;
UInt32 u1 = 0;

if (fHostCallbackInfo.musicalTimeLocationProc != nullptr
&& fHostCallbackInfo.musicalTimeLocationProc(fHostCallbackInfo.hostUserData,
nullptr, &f1, &u1, nullptr) == noErr)
{
f1 /= u1;
fTimePosition.bbt.beatsPerBar = f1;
fTimePosition.bbt.beatType = u1;
}
@@ -1984,7 +1988,7 @@ private:
fTimePosition.frame = 0;
}

fTimePosition.bbt.barStartTick = fTimePosition.bbt.ticksPerBeat *
fTimePosition.bbt.barStartTick = kDefaultTicksPerBeat *
fTimePosition.bbt.beatsPerBar *
(fTimePosition.bbt.bar - 1);



+ 5
- 13
distrho/src/DistrhoUIAU.mm View File

@@ -155,20 +155,12 @@ public:

void postSetup()
{
if (fUI.isResizable())
{
// [view setAutoresizingMask:NSViewNotSizable];
[fParentView setAutoresizesSubviews:YES];
}
else
{
[fParentView setAutoresizingMask:NSViewNotSizable];
[fParentView setAutoresizesSubviews:NO];
}

// NSView* const uiView = reinterpret_cast<NSView*>(fUI.getNativeWindowHandle());
const NSSize size = NSMakeSize(fUI.getWidth(), fUI.getHeight());
NSView* const uiView = reinterpret_cast<NSView*>(fUI.getNativeWindowHandle());

[fParentView setFrameSize:NSMakeSize(fUI.getWidth(), fUI.getHeight())];
[fParentView setAutoresizesSubviews:fUI.isResizable()];
[fParentView setFrameSize:size];
[uiView setFrameSize:size];
}

private:


+ 4
- 24
examples/Meters/ExampleUIMeters.cpp View File

@@ -41,9 +41,7 @@ public:
fColorValue(0),
// init meter values to 0
fOutLeft(0.0f),
fOutRight(0.0f),
// FIXME
fNeedsRepaint(false)
fOutRight(0.0f)
{
setGeometryConstraints(32, 128, false);
}
@@ -73,9 +71,7 @@ protected:
if (fOutLeft != value)
{
fOutLeft = value;
// FIXME
// repaint();
fNeedsRepaint = true;
repaint();
}
break;

@@ -88,9 +84,7 @@ protected:
if (fOutRight != value)
{
fOutRight = value;
// FIXME
// repaint();
fNeedsRepaint = true;
repaint();
}
break;
}
@@ -204,15 +198,6 @@ protected:
return true;
}

void uiIdle() override
{
if (fNeedsRepaint)
{
fNeedsRepaint = false;
repaint();
}
}

// -------------------------------------------------------------------------------------------------------

private:
@@ -228,9 +213,6 @@ private:
*/
float fOutLeft, fOutRight;

// FIXME this shouldnt be needed!
bool fNeedsRepaint;

/**
Update color if needed.
*/
@@ -251,9 +233,7 @@ private:
break;
}

// FIXME
// repaint();
fNeedsRepaint = true;
repaint();
}

/**


Loading…
Cancel
Save