Tracktion / choc

A collection of header only classes, permissively licensed, to provide basic useful tasks with the bare-minimum of dependencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JUCE plugins (CLAP) running in a choc_DesktopWindow (win32 works! not darwin, nor linux)

dbadb opened this issue · comments

I'm trying to use choc-goodness to "host" JUCE-based CLAP plugins. I've had good results so far on windows (!) but less-so on darwin and linux. For my testing, I've been using Vital and Surge XT and they both crash similarly on MacOS. Most likely, I'm missing an important piece of understanding. I've verified that choc_WebView works great on all-three platforms.

In this different case, I create a choc_DesktopWindow and then pass its windowHandle to the CLAP plugin's set_parent method (via CLAP_EXT_GUI). It's at this point that I get the crash on MacOS. Below is the lldb stack trace on a M1-mini running Ventura 13.2.

NSWindow window]: unrecognized selector sent to instance

Seems like JUCE Component's createNewPeer is triggering a method-dispatch that is not understood/implemented by choc_DesktopWindow. Is it possible that I need to create an internal view, analogous to the choc_WebView, to host the plugin?

I realize that issues like this are difficult/impossible to manage since they involve multiple interoperating components. I will continue to delve deeper but thought it worthwhile to create this issue "for the record" and in the hopes that it may ring someone's bell.

2023-06-11 12:49:41.062201-0700  -[NSWindow window]: unrecognized selector sent to instance 0x101406340
2023-06-11 12:49:41.077233-0700  *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSWindow window]: unrecognized selector sent to instance 0x101406340'
*** First throw call stack:
(
	0   CoreFoundation                      0x00000001b23443e8 __exceptionPreprocess + 176
	1   libobjc.A.dylib                     0x00000001b1e8eea8 objc_exception_throw + 60
	2   CoreFoundation                      0x00000001b23e6c0c -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00000001b22aa660 ___forwarding___ + 1600
	4   CoreFoundation                      0x00000001b22a9f60 _CF_forwarding_prep_0 + 96
	5   Vital                               0x000000016a37e75c _ZN4juce9Component13createNewPeerEiPv + 884
	6   Vital                               0x000000016a37dd54 _ZN4juce9Component12addToDesktopEiPv + 860
	7   Vital                               0x000000016a3575ec _ZN15ClapJuceWrapper12guiSetParentEPK11clap_window + 76
	8   Vital                               0x000000016a35ba00 _ZN4clap7helpers6PluginILNS0_19MisbehaviourHandlerE0ELNS0_13CheckingLevelE1EE16clapGuiSetParentEPK11clap_pluginPK11clap_window + 172

I don't think this is a choc "issue" so this is probably the wrong place to discuss it.. maybe move to discord or somewhere else that's better for chatting?
But most likely what's wrong is that the void* window handle that choc gives you is not the thing that the plugin is expecting it to be - e.g. you're passing an NSWindow* and it's expecting an NSView* or something like that

Hi Julian - your point is well taken and your hint is probably helpful too.

closing issue, moving elsewhere, ...