64 bit plugins -what support is available in Juce?

Discuss issues relating to audio plugins

Re: 64 bit plugins -what support is available in Juce?

Postby CPB » Sun Jun 26, 2011 7:00 pm

Yes: I've checked my own changes against the tip, and all I've done is enclosed the updateComponentPos and viewBoundsChangedEvent in a #ifndef __LP64__ and #endif.
CPB
JUCE Obsessive
 
Posts: 58
Joined: Tue Jan 29, 2008 8:26 pm
Location: Bournemouth, UK

Re: 64 bit plugins -what support is available in Juce?

Postby jules » Sun Jun 26, 2011 7:00 pm

Ok, thanks! Well, it's no problem for me to add that!
User avatar
jules
Fearless Leader
 
Posts: 17189
Joined: Mon Sep 06, 2004 9:03 am
Location: London, UK

Re: 64 bit plugins -what support is available in Juce?

Postby peteatjuce » Sun Jun 26, 2011 7:43 pm

Hi Jules,

I couldn't get the VST 64-bit build to build, without changing juce_VST_wrapper.mm ... I changed the whole file to be the one that Franky47 gave.
Is there an easier solution to changing that file? :)

As for the other two files I had to change... to get the 64-bit VST and AU variants both working alongside the 32-bit variants.
Here are the changes just so you can see exactly what my (small number of!) changes were:

$ git diff juce_AU_Wrapper.mm
diff --git a/src/audio/plugin_client/AU/juce_AU_Wrapper.mm b/src/audio/plugin_client/AU/juce_AU_Wrapper.mm
index f1467d9..7096afe 100644
--- a/src/audio/plugin_client/AU/juce_AU_Wrapper.mm
+++ b/src/audio/plugin_client/AU/juce_AU_Wrapper.mm
@@ -38,7 +38,7 @@
files to your project.
*/
#ifndef BUILD_AU_CARBON_UI
- #define BUILD_AU_CARBON_UI 1
+//MPC #define BUILD_AU_CARBON_UI 1
#endif

diff --git a/src/audio/plugin_client/juce_IncludeCharacteristics.h b/src/audio/plugin_client/juce_IncludeCharacteristics.h
index efb5a35..52e2d2f 100644
--- a/src/audio/plugin_client/juce_IncludeCharacteristics.h
+++ b/src/audio/plugin_client/juce_IncludeCharacteristics.h
@@ -37,9 +37,22 @@
#include "JucePluginCharacteristics.h"

#if ! defined (__LP64__)
- #define JUCE_SUPPORT_CARBON 1
+#define JUCE_SUPPORT_CARBON 0
#endif

+#ifdef MYPLUGIN_AU
+#define JUCE_ObjCExtraSuffix 01928308
+#elif defined(MY_PLUGIN_VST)
+#define JUCE_ObjCExtraSuffix 19823112
+#endif //
+
+
//==============================================================================
// The following stuff is just to cause a compile error if you've forgotten to
// define all your plugin settings properly.
@@ -94,7 +107,7 @@

//==============================================================================
#if __LP64__ && (defined(__APPLE_CPP__) || defined(__APPLE_CC__)) // (disable VSTs and RTAS in a 6
- #undef JucePlugin_Build_VST
+ // MPC #undef JucePlugin_Build_VST
#undef JucePlugin_Build_RTAS
#endif

HTH!! :)

Pete
User avatar
peteatjuce
JUCE UberWeenie
 
Posts: 418
Joined: Wed Mar 07, 2007 9:42 am

Re: 64 bit plugins -what support is available in Juce?

Postby jules » Sun Jun 26, 2011 7:58 pm

I think that like CPB said above, you only need to add an #if ! JUCE_64BIT section around the two carbon functions in juce_AU_Wrapper. The rest of the changes in Franky47's file are just reversions to old code, so you don't want them in there.

The other carbon bits you mentioned also need some small tweaks, but none of this is major stuff - I'll check something in shortly!
User avatar
jules
Fearless Leader
 
Posts: 17189
Joined: Mon Sep 06, 2004 9:03 am
Location: London, UK

Re: 64 bit plugins -what support is available in Juce?

Postby peteatjuce » Sun Jun 26, 2011 8:20 pm

Hi Jules,

Roger wilco, that worked...! Many thanks... :)

Note sure that your comment in the code " #define ADD_CARBON_BODGE 1 // see note below.." makes much sense, however!

git diff below, just FYI...

Best wishes,

Pete

===

diff --git a/src/audio/plugin_client/VST/juce_VST_Wrapper.mm b/src/audio/plugin_client/VST/juce_VST_Wrapper.mm
index ce58a5d..a757d94 100644
--- a/src/audio/plugin_client/VST/juce_VST_Wrapper.mm
+++ b/src/audio/plugin_client/VST/juce_VST_Wrapper.mm
@@ -43,8 +43,10 @@
//==============================================================================
BEGIN_JUCE_NAMESPACE

+
static void updateComponentPos (Component* const comp)
{
+#if ! JUCE_64BIT
HIViewRef dummyView = (HIViewRef) (void*) (pointer_sized_int)
comp->getProperties() ["dummyViewRef"].toString().getHexValue64();

@@ -59,6 +61,8 @@ static void updateComponentPos (Component* const comp)

comp->setTopLeftPosition ((int) (windowPos.left + r.origin.x),
(int) (windowPos.top + r.origin.y));
+#endif // ! JUCE_64BIT
+
}

static pascal OSStatus viewBoundsChangedEvent (EventHandlerCallRef, EventRef, void* user)
User avatar
peteatjuce
JUCE UberWeenie
 
Posts: 418
Joined: Wed Mar 07, 2007 9:42 am

Re: 64 bit plugins -what support is available in Juce?

Postby siedschl » Sun Jul 03, 2011 11:34 am

Everything built fairly easily (AU/VST, 32/64 bit in one plugin), but only the AU version is recognized as 64 bit (using Reaper64). Any other tricks I should know of to get VST really running?
siedschl
JUCE UberWeenie
 
Posts: 273
Joined: Wed Nov 07, 2007 10:56 am

Re: 64 bit plugins -what support is available in Juce?

Postby RiphRaph » Fri Jul 08, 2011 10:57 am

Hi all,
I found a fix to the focus problem I had with my vst plugin on Cubase6 64-bit on Mac. May be it can help some of you.

When a host key was pressed when the focus was on the plugin:
- either the key event was ignored by the plugin as long as the focus was on the plugin (case where the contents of forwardCurrentKeyEventToHost were commented)
- or the plugin just freezed and I had to force quit Cubase (case where the contents of forwardCurrentKeyEventToHost were uncommented)

So this is what I changed to make it work properly:

In juce_VST_Wrapper. mm, forwardCurrentKeyEventToHost must be remain like this (same that 32 bit):
Code: Select all
void forwardCurrentKeyEventToHost (Component* comp)
{
    NSWindow* win = [(NSView*) comp->getWindowHandle() window];
    [[win parentWindow] makeKeyWindow];
    [NSApp postEvent: [NSApp currentEvent] atStart: YES];
}


and in juce_VST_Wrapper.cpp, keyPressed must return false so that it stops sending the message
to forwardCurrentKeyEventToHost to the plugin and sends it to the host:

Code: Select all
       #if JUCE_MAC
        bool keyPressed (const KeyPress& kp)
        {
            return false;

            // If we have an unused keypress, move the key-focus to a host window
            // and re-inject the event..
            //forwardCurrentKeyEventToHost (this);
            //return true;
        }
       #endif
RiphRaph
JUCE Geek
 
Posts: 37
Joined: Tue Oct 12, 2010 10:11 am

Re: 64 bit plugins -what support is available in Juce?

Postby jules » Fri Jul 08, 2011 11:48 am

Why would forwardCurrentKeyEventToHost() need to be changed if your other change means that it'll never be called!? Surely just changing the keyPressed method would be enough?
User avatar
jules
Fearless Leader
 
Posts: 17189
Joined: Mon Sep 06, 2004 9:03 am
Location: London, UK

Re: 64 bit plugins -what support is available in Juce?

Postby siedschl » Fri Jul 08, 2011 5:49 pm

So you got a working 64 bit VST version on Mac? I've figured out in the mean time that in my build, VSTPluginMain does not show up in the binary (for 64 bit builds)...

Edit: was a month behind the latest tip... now it works. Sweet!
siedschl
JUCE UberWeenie
 
Posts: 273
Joined: Wed Nov 07, 2007 10:56 am

Re: 64 bit plugins -what support is available in Juce?

Postby CPB » Mon Jul 11, 2011 12:28 am

Has anyone had any luck getting resizeable UIs to work with Mac 64-bit VSTs? I've tried in the 64-bit builds of both Cubase 6 and Reaper 4, and they both seem to have the same odd issue: when you resize a VST interface, instead of enlarging to fill the client area, it resizes itself so that parts of the interface disappear off the top.

I can post a screenshot, but it's quite easy to duplicate this behaviour using the JucePluginDemo and the 64-bit Reaper demo. Has anyone any ideas about fixing this?

( The comment in setNativeHostWindowSize 'is this necessary, or do the hosts detect a change in the child view and do this automatically?' doesn't apply here. Reaper returns true when asked canHostDo("sizewindow"), so setNativeHostWindowSize is never called. )
CPB
JUCE Obsessive
 
Posts: 58
Joined: Tue Jan 29, 2008 8:26 pm
Location: Bournemouth, UK

Re: 64 bit plugins -what support is available in Juce?

Postby peteatjuce » Wed Jul 13, 2011 11:57 am

OK, so it appears that there may be a bug with Mac OS X 10.5, 64-bit, and Objective-C unloading. I've tried my plug-in on a clean Mac OS X 10.6 machine, with the latest 3.x Reaper 64-bit beta, and it works fine. Same plug-in, same version of Reaper, on a 10.5 machine, and it crashes during the call to _unload_image.

Now, I've found various references peppering the 'net about this bug (such as http://web.archiveorange.com/archive/v/ ... NgmkEQX78z ), but no concrete "This is a know bug in Apple's 10.5 codebase" reference. If this is the case though, I'm happy to lay down a 64-bit VST support requires Mac OS X 10.6. Has anyone heard of such a bug?


Yes, I have a customer who still uses 10.5, and has experienced problems with our universal 32/64-bit VSTi/AU under both Reaper (32-bit) and Logic 9...!

Do you have any suggestions about possible work-arounds, short of making "plain" 32-bit only builds available to such customers...? :shock:

Best wishes,

Pete
User avatar
peteatjuce
JUCE UberWeenie
 
Posts: 418
Joined: Wed Mar 07, 2007 9:42 am

Re: 64 bit plugins -what support is available in Juce?

Postby CPB » Wed Jul 13, 2011 1:04 pm

This sounds slightly different that what I was seeing: in my case, it would only crash when unloading the 64-bit VST plug-in. If the end-user was just using the 32-bit or PPC architecture, it was fine.

I guess the big difference is that I don't use the 'all-in-one polymorphic' plug-in system: VST, AU, RTAS, and Standalone are all discrete bundles. If it's not too big of a change to your build system, perhaps if may be worth your while building individual bundles?
CPB
JUCE Obsessive
 
Posts: 58
Joined: Tue Jan 29, 2008 8:26 pm
Location: Bournemouth, UK

Re: 64 bit plugins -what support is available in Juce?

Postby peteatjuce » Wed Jul 13, 2011 1:28 pm

Hi CPB - thanks for that - I think you're right!

See for example here: http://nomadfactory.com/downloads/index.html
... where there is a separate 32-bit download for OS X 10.5, and a 32/64-bit download for OS X 10.6

What a pain! :(

Pete
User avatar
peteatjuce
JUCE UberWeenie
 
Posts: 418
Joined: Wed Mar 07, 2007 9:42 am

Re: 64 bit plugins -what support is available in Juce?

Postby CPB » Wed Jul 13, 2011 1:45 pm

I didn't think you need to go quite that far: my Mac build process builds four separate projects: VST (ppc/32-bit/64-bit), Audio Unit (ppc/32-bit/64-bit), RTAS (ppc/32-bit) and Standalone (ppc/32-bit).

I'm assuming some overlap in your 64-bit VST and AudioUnit polymorphic bundle is what is causing 10.5's buggy Objective-C unloading code to be called, even in a host which doesn't use VST plug-ins: I'd suggest, if the end-user is willing to try beta versions, just do a build containing Audio Unit only, but all architectures, and see if that works for them...

Alternatively, petition Apple to fix the bug in their code ;)
CPB
JUCE Obsessive
 
Posts: 58
Joined: Tue Jan 29, 2008 8:26 pm
Location: Bournemouth, UK

Re: 64 bit plugins -what support is available in Juce?

Postby peteatjuce » Wed Jul 13, 2011 1:59 pm

Actually, I build VST and AU as separate projects. I hadn't gone the whole-hog of building an "all-in-one", as I'm rather risk averse! ;)

What I've changed recently however, is to make the AU and VSTi both 32/64-bit universal binaries.

And that is what appears to cause the trouble on OS X 10.5 ...! The standalone 32/64 universal app versions of my products are OK - it is the "Universal 32/64-bit AU/VSTi binaries" that are having trouble under 10.5 ... (they are OK on 10.6 from what I can tell from customer feedback!)

So... I'll send my customer a separately build 32-bit-only variant of both, and see if that works...!

Best wishes,

Pete
User avatar
peteatjuce
JUCE UberWeenie
 
Posts: 418
Joined: Wed Mar 07, 2007 9:42 am

PreviousNext

Return to Audio Plugins

Who is online

Users browsing this forum: No registered users and 0 guests