Using JUCE in a Max MSP external


#1

Hi all

I’ve been trying to make a MaxMsp external that uses the JUCE framework, but I seem to be getting nowhere.
I have tried plenty of things and for the moment I have minimised to something as simple as this,

  • Created a projuicer project.
  • Opened it in Xcode and implemented the necessary code.
  • In the same Xcode project I included an additional target - the .mxo object.
  • Linked the maxmspsdk.xcconfig and the Info.plist file to that object.
  • Included the C code to create the external (in fact copied from a previous project as for now I only want the project to compile).
  • Built the xcode project, both the .app and the .mxo were created.
  • When I try to open the external in Max I get,
    • "MainWin: unable to load object bundle executable
    • 2019-01-23 00:03:52.421 Max[1182:46847] Cannot find executable for CFBundle 0x7fecd822d0b0 <path/max-sdk-7.3.3/externals/MainWin.mxo> (not loaded)

Therefore, I seem to be doing something wrong… Can anybody help? Or point to the right direction?

How do you join the two worlds of JUCE and MaxMSP ?

I’ve tried this too
https://github.com/frantic0/Jojo
but I couldn’t get it to work either…

Using JUCE 5.4.1 and Max 8.0.1

Thank you in advance!


#2

did you look here?


here ?

I managed to do this but it was a pain!

#3

Hi seanwayland,

What I actually need is the opposite. I want to use my Juce code in a Max Msp external.

Mainly to use the powerful UI tools of Juce in a Max Msp UI external. In other words to draw graphics (made in Juce) in patchers in Max.


#4

Oh I see excuse me I misread your post …
I have never tried that …
So you want to improve the UI in Max ?
Perhaps another more well trodden route makes sense.
Sorry I can’t help !
https://www.google.com/search?q=extend+maxmsp+UI+site:cycling74.com&rlz=1C5CHFA_enUS749US749&sa=X&ved=2ahUKEwjhyszW2YPgAhWWfSsKHULoCD8QrQIoBDAAegQIBxAL&biw=1171&bih=726
Sean


#5

(I’m the author of Jojo).

AFAIK neither JUCE nor Cycling’74 officially support that trick. Thus it is rather dangerous to base your external on this. It could break at any time. At the time i did my tests Jules fixed some stuff to make it work again (5 years ago), but i’m not sure it is the ROLI policy and/or priority now. I’m not aware of people that to do this in a released product. Is there?

?
@leehu


#6

Hi Nicolas,

Thanks for getting back to me.

I don’t know if there will be a strong demand for such a solution in the future. But for now the ability to make your code portable is a big plus.
I really wish that due to the Max UI externals being limited (compared to the Juce library/framework) a solution to link the two in an easy way will be possible in the future…

Since you are here now, I would like to ask you one thing :slight_smile:
So, I have made one of your examples (jojoSlider) compile. Both the .mxo and library are being created but the .mxo is an empty bundle, i.e. it doesn’t contain the executable that Max needs. Do you have any idea why?
Your settings, build phases, etc seem to be correct but something is not getting included in the final .mxo any thoughts?

Thank you in advance!


#7

Hi,

First i have to say that i don’t use JUCE nor Max/MSP since many years… At that time I have struggled with the Projucer (Introjucer IIRC) to make it export the proper target for Xcode with all the filepath required.

projectType="audioplug"
customPList="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;&#10;&lt;plist version=&quot;1.0&quot;&gt;&#10;&lt;dict&gt;&#10;&#9;&lt;key&gt;CFBundleDevelopmentRegion&lt;/key&gt;&#10;&#9;&lt;string&gt;English&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleExecutable&lt;/key&gt;&#10;&#9;&lt;string&gt;${PRODUCT_NAME}&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleIconFile&lt;/key&gt;&#10;&#9;&lt;string&gt;&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleIdentifier&lt;/key&gt;&#10;&#9;&lt;string&gt;com.cycling74.${PRODUCT_NAME}&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleInfoDictionaryVersion&lt;/key&gt;&#10;&#9;&lt;string&gt;6.0&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleLongVersionString&lt;/key&gt;&#10;&#9;&lt;string&gt;${PRODUCT_NAME} ${PRODUCT_VERSION}, Copyright 2008 Cycling '74&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundlePackageType&lt;/key&gt;&#10;&#9;&lt;string&gt;iLaX&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleShortVersionString&lt;/key&gt;&#10;&#9;&lt;string&gt;${PRODUCT_VERSION}&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleSignature&lt;/key&gt;&#10;&#9;&lt;string&gt;max2&lt;/string&gt;&#10;&#9;&lt;key&gt;CFBundleVersion&lt;/key&gt;&#10;&#9;&lt;string&gt;${PRODUCT_VERSION}&lt;/string&gt;&#10;&#9;&lt;key&gt;CSResourcesFileMapped&lt;/key&gt;&#10;&#9;&lt;true/&gt;&#10;&lt;/dict&gt;&#10;&lt;/plist&gt;"
extraLinkerFlags="-F${C74SUPPORT}/max-includes&#10;-framework MaxAPI&#10;-bind_at_load"
extraDefs="C74SUPPORT = $(SRCROOT)/../../../../../MaxSDK-5.1.7/c74support&#10;"
extraCompilerFlags="-Wall &#10;-Wno-unused-parameter &#10;-Wno-four-char-constants &#10;-Wno-unknown-pragmas"
customXcodeFlags="WRAPPER_EXTENSION = mxo, GENERATE_PKGINFO_FILE = YES, GCC_SYMBOLS_PRIVATE_EXTERN = YES, PRODUCT_VERSION = 5.1.7, ARCHS = i386, DEPLOYMENT_LOCATION = YES, INSTALL_PATH = /, DSTROOT = &quot;$(SRCROOT)/../../../../../sdk-build&quot;, DEPLOYMENT_POSTPROCESSING = YES, STRIP_INSTALLED_PRODUCT = YES, GCC_GENERATE_DEBUGGING_SYMBOLS = YES, GCC_DEBUGGING_SYMBOLS = full, DEAD_CODE_STRIPPING = YES, DEBUG_INFORMATION_FORMAT = dwarf-with-dsym, DWARF_DSYM_FILE_NAME = &quot;$(PRODUCT_NAME).dSYM&quot;, DWARF_DSYM_FOLDER_PATH = &quot;$(CONFIGURATION_BUILD_DIR)/$(EXECUTABLE_FOLDER_PATH)&quot;"
headerPath="/Developer/Headers/FlatCarbon ; ${C74SUPPORT}/max-includes"

I extracted above the specific “.jucer” settings (commented below):

  1. An “.mxo” is just a macOS “bundle” (a dll wrapped in a specific file hierarchy). Thus you probably need to say to the jucer that your project is a plugin (audioplug).
  2. Include the info.plist provided by Cycling’74.
  3. Define the linker path to the framework maxAPI.
  4. Ditto (a trick to make file path easily modifiable).
  5. Just the compiler flags.
  6. This is one is really important “WRAPPER_EXTENSION = mxo” others are not.
  7. Define the path to headers.

#8

(After a quick build-and-look on the current Projucer app) i’m not sure at all that choosing “audio plugin” works nowaday. Probably that a best approach should be to export as a dll, and use a post-build script to make the package by yourself…


#9

I never got this working for OSX with Projucer - I have to handcraft my own XCode project files - on Windows Projcer can create something that can build an mxe.


#10

Hi Nicolas,

I finally had some time to look into it more. Thank you for the Juce settings, it was very helpful to verify what I’ve done… but unfortunately no great changes still…

I still cannot make it work… Even though it compiles, the final .mxo/Contents/Resources folder does not include the necessary executable…

I’ve also briefly tried with building the dynamic library but I don’t have much experience with dlls and so I didn’t get far.


#11

Hi leehu,

So did you get it working finally with Xcode?
Would you mind sharing a simple working example?


#12

Anyway i’m not even sure that a dll project is a good idea since the executable seems to be a “Mach-O bundle” type. Sorry it is too far in my memory (I switched to “PureData” :slight_smile: since that time).

The problem with a handcraft Xcode project is that it can be hard to configure the JUCE machinery. And the problem with the Projucer is that it can be hard (if it is possible now) to configure it to make a Max/MSP external.

I don’t have valid licenses anymore (that’s why i dropped the JOJO examples) and so i can’t really help you more.

Good luck!


#13

Yeah, I’ll try and get some time in the next couple of days to post details.


#15

this talk from the juce summit a few years ago might help https://www.youtube.com/watch?v=y6QyTQmt9kU