Giter VIP home page Giter VIP logo

Comments (12)

baconpaul avatar baconpaul commented on May 29, 2024 1

Well I couldn't seem to load this in ardour or max but I've only used AUs on my mac, not VSTs, so who knows if that is indicative.

I also spent some time looking at why the au / plugin.h stuff doesn't build. Basically "The Audio Unit API has completely changed since this was written" is what I concluded. None of the base classes or types are in AudioToolbox.framework any more that I saw. I sort of feel like the au bit will need a pretty major rehab to get working but I'm not up for that.

Anyway, again just hoping that sharing what I found helps as you make progress. If there is a place I should "watch" to help with macOS build generally and I missed it, apologies.

from surge.

baconpaul avatar baconpaul commented on May 29, 2024 1

Hey cool thanks for putting that together into a PR!

Sorry to not include the full path. Here's the files and diffs I put together.

paul:~/dev/music/surge$ git status src > editc
paul:~/dev/music/surge$ git diff src >> editc
paul:~/dev/music/surge$ cat editc
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   src/vst3/SurgeVst3EditController.cpp
	modified:   src/vst3/SurgeVst3EditController.h
	modified:   src/vst3/surgeentry.cpp

no changes added to commit (use "git add" and/or "git commit -a")
diff --git a/src/vst3/SurgeVst3EditController.cpp b/src/vst3/SurgeVst3EditController.cpp
index 1515274..c1e2948 100644
--- a/src/vst3/SurgeVst3EditController.cpp
+++ b/src/vst3/SurgeVst3EditController.cpp
@@ -2,6 +2,7 @@
 
 #include "pluginterfaces/base/ustring.h"
 
+#if 0
 tresult PLUGIN_API SurgeVst3EditController::initialize(FUnknown* context)
 {
    tresult result = EditControllerEx1::initialize(context);
@@ -46,4 +47,5 @@ tresult PLUGIN_API SurgeVst3EditController::initialize(FUnknown* context)
 tresult PLUGIN_API SurgeVst3EditController::terminate()
 {
    return EditControllerEx1::terminate();
-}
\ No newline at end of file
+}
+#endif
diff --git a/src/vst3/SurgeVst3EditController.h b/src/vst3/SurgeVst3EditController.h
index 4701791..e3b223b 100644
--- a/src/vst3/SurgeVst3EditController.h
+++ b/src/vst3/SurgeVst3EditController.h
@@ -4,6 +4,7 @@ using namespace Steinberg;
 using namespace Steinberg::Vst;
 
 class SurgeEditorView;
+#if 0
 
 class SurgeVst3EditController : public EditControllerEx1, public IMidiMapping
 {
@@ -46,8 +47,8 @@ public:
                                                   int16 channel,
                                                   CtrlNumber midiControllerNumber,
                                                   ParamID& tag);
-
    DELEGATE_REFCOUNT(EditController)
+
    tresult PLUGIN_API queryInterface(const char* iid, void** obj);
 
    //---Internal functions-------
@@ -58,6 +59,8 @@ public:
    TChar* getDefaultMessageText();
    //------------------------------------------------------------------------
 
+
 private:
    String128 defaultMessageText;
 };
+#endif
diff --git a/src/vst3/surgeentry.cpp b/src/vst3/surgeentry.cpp
index e77b046..8e1ecc1 100644
--- a/src/vst3/surgeentry.cpp
+++ b/src/vst3/surgeentry.cpp
@@ -4,7 +4,7 @@
 #include "public.sdk/source/main/pluginfactoryvst3.h"
 
 #include "SurgeVst3Processor.h"
-#include "SurgeVst3EditController.h"
+// #include "SurgeVst3EditController.h"
 #include "surgecids.h"
 #include <AbstractSynthesizer.h>

from surge.

baconpaul avatar baconpaul commented on May 29, 2024

I spent a few minutes looking at this. This is because, in Xcode 10 / macOS 10.14, the default prototype of objc_msgSendSuper has changed from the 3 args to a no arg type.

You can fix this by adding

-DOBJC_OLD_DISPATCH_PROTOTYPES=1

screen shot 2018-12-07 at 2 59 31 pm

to your arguments in the build settings in Xcode. With that in place I get up to a linker error I haven't been able to solve.

No idea how to make pre-make put this in by default, or if there is some well defined header location where we could define it rather than compile line. I'm just noodling around on a cold Friday afternoon and found this fix.

The change appears to be related to swift exposing these obj messages in a no-arg form. The relevant change in the SDK is

Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/objc/message.h

#if !OBJC_OLD_DISPATCH_PROTOTYPES
OBJC_EXPORT void
objc_msgSend(void /* id self, SEL op, ... */ )
    OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);

OBJC_EXPORT void
objc_msgSendSuper(void /* struct objc_super *super, SEL op, ... */ )
    OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);
#else
/**
 * Sends a message with a simple return value to an instance of a class.
 *
 * @param self A pointer to the instance of the class that is to receive the message.
 * @param op The selector of the method that handles the message.
 * @param ...
 *   A variable argument list containing the arguments to the method.
 *
 * @return The return value of the method.
 *
 * @note When it encounters a method call, the compiler generates a call to one of the
 *  functions \c objc_msgSend, \c objc_msgSend_stret, \c objc_msgSendSuper, or \c objc_msgSendSuper_stret.
 *  Messages sent to an object’s superclass (using the \c super keyword) are sent using \c objc_msgSendSuper;
 *  other messages are sent using \c objc_msgSend. Methods that have data structures as return values
 *  are sent using \c objc_msgSendSuper_stret and \c objc_msgSend_stret.
 */
OBJC_EXPORT id _Nullable
objc_msgSend(id _Nullable self, SEL _Nonnull op, ...)
    OBJC_AVAILABLE(10.0, 2.0, 9.0, 1.0, 2.0);

from surge.

baconpaul avatar baconpaul commented on May 29, 2024

With two more changes I was actually able to get a VST packaged on MacOS. Those changes were

1: src/vst3/SurgeVST3EditController is both unused and incompletely implemented. This creates link errors on my mac. So I whacked it by putting a #if 0 around both the class (.h) and implementation (.cpp)

This led to the project linking but failing in the post stage. The post-stage fails because the premake5.lua injects a call to 'package-vst3.sh' and the file is 'package-vst.sh'. Couple of things you could do here but I just copied package-vst.sh to package-vst3.sh and then ran a clean build and got a .vst linked in products.

Who knows it if works of course! But progress.

Hope you don't mind me adding this to the issue. Not exactly clear where the master "build something on mac" issue is sitting!

from surge.

esaruoho avatar esaruoho commented on May 29, 2024
-DOBJC_OLD_DISPATCH_PROTOTYPES=1

No idea how to make pre-make put this in by default, or if there is some well defined header location where we could define it rather than compile line. I'm just noodling around on a cold Friday afternoon and found this fix.

Hi! Thanks for your input. I was able to get vst2 to compile successfully by adding

,
                "OBJC_OLD_DISPATCH_PROTOTYPES=1"

into premake5.lua and will bake a PR out of that. that's one step in the right direction :)

PR is #56 - let's see if it'll get merged in!

from surge.

esaruoho avatar esaruoho commented on May 29, 2024

src/vst3/SurgeVST3EditController is both unused and incompletely implemented. This creates link errors on my mac. So I whacked it by putting a #if 0 around both the class (.h) and implementation (.cpp)

Could you provide a reference to the class (.h) and implementation (.cpp), like, which filenames are they?

from surge.

esaruoho avatar esaruoho commented on May 29, 2024

This led to the project linking but failing in the post stage. The post-stage fails because the premake5.lua injects a call to 'package-vst3.sh' and the file is 'package-vst.sh'. Couple of things you could do here but I just copied package-vst.sh to package-vst3.sh and then ran a clean build and got a .vst linked in products.

Hi, I baked this into a PR too #51 - let's hope @abique and @kurasu and maybe @kzantow have the time to look at these and merge them in. Still not entirely sure how to do the src/vst3/SurgeVST3EditController fix though. Guess I'll do a git grep next :)

from surge.

esaruoho avatar esaruoho commented on May 29, 2024

I also spent some time looking at why the au / plugin.h stuff doesn't build. Basically "The Audio Unit API has completely changed since this was written" is what I concluded. None of the base classes or types are in AudioToolbox.framework any more that I saw. I sort of feel like the au bit will need a pretty major rehab to get working but I'm not up for that.

I did, however, find an AudioUnit.framework - hoping that that'll be somehow more pertinent. But if AudioToolbox.framework is what Surge references, then I guess we're in trouble. :)

from surge.

baconpaul avatar baconpaul commented on May 29, 2024

yes surge also references AudioUnit.framework but that framework has changed quite a bit since this was written. It's now "Audio Unit 3", it seems and we are coded to AU2. If you look in the AudioUnit.framework which ships with os 10.14.1 and Xcode 10.1 the headers all have this lovely feature:

screen shot 2018-12-08 at 8 21 11 am

namely they are just passthroughs to audio toolbox.

I've been googling to see how you actually bridge an AU2. There is this

https://developer.apple.com/documentation/audiotoolbox/auaudiounitv2bridge

which allows AudioToolbox to wrap a V2 audio unit, but I haven't figured out if it applies in our situation or not. And also seems to involve crossing the obj-c / c++ interface / class boundary quite a bit. From AudioToolbox/Headers there's

/*!	@brief	Wraps a v2 audio unit in an AUAudioUnit subclass.
	@discussion
		Implementors of version 3 audio units may derive their implementations from
		AUAudioUnitV2Bridge. It expects the component description with which it is initialized to
		refer to a registered component with a v2 implementation using an
		AudioComponentFactoryFunction. The bridge will instantiate the v2 audio unit via the factory
		function and communicate it with it using the v2 AudioUnit API's (AudioUnitSetProperty,
		etc.)

		Hosts should not access this class; it will be instantiated when needed when creating an
		AUAudioUnit.
*/
OS_EXPORT API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0))
@interface AUAudioUnitV2Bridge : AUAudioUnit
@end

and I stopped there!

I was actually thinking about writing a small standalone wrapper (so as well as surge-vst and surge-au there is surge-standalone) so we have just an app with some basic core audio bindings which loads the innards of surge. Aside from being handy (I really like that the arturia plugins do that, for instance) it could reduce the bits needing debugging. But I don't see myself getting to that in the next week or two unless something magical happens with my brain or schedule!

Hope this is all helpful!

from surge.

baconpaul avatar baconpaul commented on May 29, 2024

Oh on that #if 0 I used in SurgeEditor that's probably too heavy handed to get through a PR. Perhaps we want some #if macintosh or something? Whatever surge uses for OS-specific ifdefs.

from surge.

baconpaul avatar baconpaul commented on May 29, 2024

Pretty sure #59 means you can close this. Thanks!

from surge.

esaruoho avatar esaruoho commented on May 29, 2024

closing

from surge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.