Y u no 64 bit VSTs?


#1

BTW. What is the reason juce can’t build 64bit VST’s on Mac? There seem to be bundles of them out there. Am I missing something?


#2

I can’t answer your question, because i’m able to build 64bit vst plugins on mac.


#3

I can’t answer your question, because i’m able to build 64bit vst plugins on mac.


#4

When you say you “can’t build them”, what exactly is stopping you?


#5

Hang on a second now… It does seem to work. (?) Let me explain… Where are my glasses…

I am running on a clean system so I haven’t installed a 64 bit VST host, only the vst host I have built myself with juce.
It’s the juce vst host that doesn’t do 64 bit! Is that so, and why? The vst host doesn’t get a 64 bit build.


#6

Let me clarify. The juce vst host doesn’t do 64 bit builds. Is there a reason for that or is the code not updated?


#7

What do you mean it doesn’t “do” them? Are you saying the host won’t build in 64-bit mode? If so, what are the errors?


#8

I mean, that the class “VSTPluginFormat” is inhibited from being compiled, (and used in the AudioPluginFormatManager) through a series of statements such as:


#9

Ah yes… I’d forgotten about that. Can’t remember the exact reason for it… Anyone tried getting it to run in 64-bits?


#10

Considering the general readiness of 64 bit code in juce, I would guess this part is also quite there. I know you have many other things to do, but if it would be possible for you to look into this, I would be very grateful!


#11

I also need this for a project and it seems a bit more complex than a few switches. I think the problem boils down to a lack of 64-bit Carbon support in juce_mac_CarbonViewWrapperComponent. When trying to compile this file in 64-bit mode I get a ton of "undeclared identifier " compiler errors. Perhaps there are different versions of these calls for 64-bit Carbon. Is Carbon even needed as per the “#error “To build VSTs, you need to enable the JUCE_SUPPORT_CARBON flag in your config!”” in juce_VSTPluginFormat.cpp?

Anyway to get the plugin host demo to this stage I had to comment out the ! (JUCE_MAC && JUCE_64BIT) in juce_VSTPluginFormat.cpp line 29 and juce_AudioPluginFormatManager.cpp line 58. Then I had to add JUCE_SUPPORT_CARBON=1 to the Introjucer’s pre-processor definitions hence all the errors described above.

Any thoughts welcome.


#12

Hi Dave,
Carbon is not fully implemented in 64 bit. If you want 64 bit you need to go Cocoa. It’s as simple as that. I have a vague recollection that Carbon has a few 64 bit calls implemented but essentially its a no-go.

Without looking at the code, I assume that the 64bit VST plug-in code provided bu Juce is implemented in Cocoa. What remains by Jules to do is to add the same things to the host.


#13

Yes, I was just wondering if there is anything that necessitates VST using a Carbon window or if this could be updated to a Cocoa one. Is this just legacy code from the old Carbon days of the library?


#14

I don’t know for sure if 32 bit VST plug-ins require or expect a Cocoa or Carbon host window, but 64 bit VST plug-ins got to be Cocoa. Neither do I know if the VST plug-in would have a way of knowing if the host window IS of Carbon or Cocoa origin. Mac isn’t my strong side. I rely on Juce for this kind of compliance.
Personally, I wouldn’t rely on the VST documentation for this information as my experience is that plug-in devs not necessarily follow the docs all the time. I also think Steinberg is way to vague on matters that count, but that’s beside the point.


#15

Hi guys,

I got the same problem so I managed to patch juce_VSTPluginFormat.cpp and juce_AudioPluginFormatManager.cpp to be able to compile with VST support in both 32 and 64bit modes.

My only concern is that I don’t have any 64bit-only VST to validate the change, nor do I have old-school 32bit Carbon VST to ensure that it is still displayable with the patch. Of course I’m going to make a 64bit VST real quick to validate the first point, but for the latter, I will need your help.

Here is the patch (I don’t have the latest tip so the line numbers might be wrong for your files):

diff --git a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
index 5d3dc1c..c802da1 100644
--- a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
+++ b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
@@ -32,9 +32,9 @@ void AudioPluginFormatManager::addDefaultFormats()
    #if JUCE_DEBUG
     // you should only call this method once!
     for (int i = formats.size(); --i >= 0;)
     {
-       #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
+       #if JUCE_PLUGINHOST_VST
         jassert (dynamic_cast <VSTPluginFormat*> (formats[i]) == nullptr);
        #endif
 
        #if JUCE_PLUGINHOST_AU && JUCE_MAC
@@ -54,9 +54,9 @@ void AudioPluginFormatManager::addDefaultFormats()
    #if JUCE_PLUGINHOST_AU && JUCE_MAC
     formats.add (new AudioUnitPluginFormat());
    #endif
 
-   #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
+   #if JUCE_PLUGINHOST_VST
     formats.add (new VSTPluginFormat());
    #endif
 
    #if JUCE_PLUGINHOST_DX && JUCE_WINDOWS
diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
index bba816b..91d9d80 100644
--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
+++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
@@ -25,9 +25,8 @@
 
 #if JUCE_PLUGINHOST_VST
 
 //==============================================================================
-#if ! (JUCE_MAC && JUCE_64BIT)
 
 #if JUCE_MAC && JUCE_SUPPORT_CARBON
  #include "../../juce_gui_extra/native/juce_mac_CarbonViewWrapperComponent.h"
 #endif
@@ -380,9 +379,12 @@ public:
     ModuleHandle (const File& file_)
         : file (file_),
           moduleMain (0)
          #if JUCE_MAC
-          , fragId (0), resHandle (0), bundleRef (0), resFileId (0)
+          #if JUCE_PPC
+            , fragId (0)
+          #endif
+          , resHandle (0), bundleRef (0), resFileId (0)
          #endif
     {
         getActiveModules().add (this);
 
@@ -442,9 +444,11 @@ public:
         eff->dispatcher (eff, effClose, 0, 0, 0, 0);
     }
 
 #else
+  #if JUCE_PPC
     CFragConnectionID fragId;
+  #endif
     Handle resHandle;
     CFBundleRef bundleRef;
     FSSpec parentDirFSSpec;
     short resFileId;
@@ -1130,9 +1134,9 @@ public:
         pluginHWND = 0;
        #elif JUCE_LINUX
         pluginWindow = None;
         pluginProc = None;
-       #else
+       #elif JUCE_MAC && JUCE_SUPPORT_CARBON
         addAndMakeVisible (innerWrapper = new InnerWrapperComponent (*this));
        #endif
 
         activeVSTWindows.add (this);
@@ -1144,9 +1148,11 @@ public:
 
     ~VSTPluginWindow()
     {
        #if JUCE_MAC
+        #if JUCE_SUPPORT_CARBON
         innerWrapper = nullptr;
+        #endif
        #else
         closePluginWindow();
        #endif
 
@@ -1741,13 +1747,10 @@ private:
         }
     }
 #endif
 
-#if JUCE_MAC
+#if JUCE_MAC && JUCE_SUPPORT_CARBON
     //==============================================================================
-   #if ! JUCE_SUPPORT_CARBON
-    #error "To build VSTs, you need to enable the JUCE_SUPPORT_CARBON flag in your config!"
-   #endif
 
     class InnerWrapperComponent   : public CarbonViewWrapperComponent
     {
     public:
@@ -2916,7 +2919,6 @@ FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch()
     return FileSearchPath ("/usr/lib/vst");
    #endif
 }
 
-#endif
 #undef log
 #endif

#16

[quote=“Dri”]Hi guys,

I got the same problem so I managed to patch juce_VSTPluginFormat.cpp and juce_AudioPluginFormatManager.cpp to be able to compile with VST support in both 32 and 64bit modes.

[/quote]
Brilliant. If it works I’m going to motion to Jules to have a look at it so it’s actually integrated.


#17

Ok the previous version was only half working, since it could not display the 64bit VST editor window. I hacked the VSTPluginFormat code a bit more to replace the CarbonViewWrapper by a plain NSViewComponent in the case where JUCE_SUPPORT_CARBON is not set.

The result makes this already messy class a little bit more messy… but at least it works!

diff --git a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
index 5d3dc1c..c802da1 100644
--- a/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
+++ b/modules/juce_audio_processors/format/juce_AudioPluginFormatManager.cpp
@@ -32,9 +32,9 @@ void AudioPluginFormatManager::addDefaultFormats()
    #if JUCE_DEBUG
     // you should only call this method once!
     for (int i = formats.size(); --i >= 0;)
     {
-       #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
+       #if JUCE_PLUGINHOST_VST
         jassert (dynamic_cast <VSTPluginFormat*> (formats[i]) == nullptr);
        #endif
 
        #if JUCE_PLUGINHOST_AU && JUCE_MAC
@@ -54,9 +54,9 @@ void AudioPluginFormatManager::addDefaultFormats()
    #if JUCE_PLUGINHOST_AU && JUCE_MAC
     formats.add (new AudioUnitPluginFormat());
    #endif
 
-   #if JUCE_PLUGINHOST_VST && ! (JUCE_MAC && JUCE_64BIT)
+   #if JUCE_PLUGINHOST_VST
     formats.add (new VSTPluginFormat());
    #endif
 
    #if JUCE_PLUGINHOST_DX && JUCE_WINDOWS
diff --git a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
index bba816b..21c5fd1 100644
--- a/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
+++ b/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
@@ -25,9 +25,8 @@
 
 #if JUCE_PLUGINHOST_VST
 
 //==============================================================================
-#if ! (JUCE_MAC && JUCE_64BIT)
 
 #if JUCE_MAC && JUCE_SUPPORT_CARBON
  #include "../../juce_gui_extra/native/juce_mac_CarbonViewWrapperComponent.h"
 #endif
@@ -380,9 +379,12 @@ public:
     ModuleHandle (const File& file_)
         : file (file_),
           moduleMain (0)
          #if JUCE_MAC
-          , fragId (0), resHandle (0), bundleRef (0), resFileId (0)
+          #if JUCE_PPC
+            , fragId (0)
+          #endif
+          , resHandle (0), bundleRef (0), resFileId (0)
          #endif
     {
         getActiveModules().add (this);
 
@@ -442,9 +444,11 @@ public:
         eff->dispatcher (eff, effClose, 0, 0, 0, 0);
     }
 
 #else
+  #if JUCE_PPC
     CFragConnectionID fragId;
+  #endif
     Handle resHandle;
     CFBundleRef bundleRef;
     FSSpec parentDirFSSpec;
     short resFileId;
@@ -1130,10 +1134,15 @@ public:
         pluginHWND = 0;
        #elif JUCE_LINUX
         pluginWindow = None;
         pluginProc = None;
-       #else
+       #elif JUCE_MAC && JUCE_SUPPORT_CARBON
         addAndMakeVisible (innerWrapper = new InnerWrapperComponent (*this));
+       #elif JUCE_MAC && ! JUCE_SUPPORT_CARBON
+        addAndMakeVisible (innerWrapper = new NSViewComponent ());
+        NSView* innerView = [[NSView alloc] init];
+        innerWrapper->setView (innerView);
+        [innerView release];
        #endif
 
         activeVSTWindows.add (this);
 
@@ -1144,8 +1153,11 @@ public:
 
     ~VSTPluginWindow()
     {
        #if JUCE_MAC
+#if ! JUCE_SUPPORT_CARBON
+        closePluginWindow();
+#endif
         innerWrapper = nullptr;
        #else
         closePluginWindow();
        #endif
@@ -1183,9 +1195,27 @@ public:
 
             recursiveResize = false;
         }
     }
+#endif
 
+#if JUCE_MAC && ! JUCE_SUPPORT_CARBON
+  void visibilityChanged()
+  {
+    if (isVisible())
+      openPluginWindow();
+    else
+      closePluginWindow();
+  }
+  
+  void childBoundsChanged (Component* child)
+  {
+    if (innerWrapper != nullptr)
+    {
+      setSize (innerWrapper->getWidth(), innerWrapper->getHeight());
+    }
+  }
+#elif ! (JUCE_MAC)
     void componentVisibilityChanged()
     {
         if (isShowing())
             openPluginWindow();
@@ -1340,10 +1370,16 @@ private:
    #endif
 
     //==============================================================================
 #if JUCE_MAC
+  #if JUCE_SUPPORT_CARBON
     void openPluginWindow (WindowRef parentWindow)
     {
+  #else
+    void openPluginWindow ()
+    {
+        NSView* parentWindow = (NSView*)innerWrapper->getView();
+  #endif
         if (isOpen || parentWindow == 0)
             return;
 
         isOpen = true;
@@ -1530,8 +1566,21 @@ private:
             pluginProc = 0;
            #endif
         }
     }
+#elif JUCE_MAC && ! JUCE_SUPPORT_CARBON
+      void closePluginWindow()
+      {
+        if (isOpen)
+        {
+          log ("Closing VST UI: " + plugin.getName());
+          isOpen = false;
+          
+          dispatch (effEditClose, 0, 0, 0, 0);
+          
+          stopTimer();
+        }
+      }
 #endif
 
     //==============================================================================
     int dispatch (const int opcode, const int index, const int value, void* const ptr, float opt)
@@ -1742,12 +1791,10 @@ private:
     }
 #endif
 
 #if JUCE_MAC
+  #if JUCE_SUPPORT_CARBON
     //==============================================================================
-   #if ! JUCE_SUPPORT_CARBON
-    #error "To build VSTs, you need to enable the JUCE_SUPPORT_CARBON flag in your config!"
-   #endif
 
     class InnerWrapperComponent   : public CarbonViewWrapperComponent
     {
     public:
@@ -1827,9 +1874,11 @@ private:
     };
 
     friend class InnerWrapperComponent;
     ScopedPointer <InnerWrapperComponent> innerWrapper;
-
+  #else
+    ScopedPointer <NSViewComponent> innerWrapper;
+  #endif
     void resized()
     {
         if (innerWrapper != nullptr)
             innerWrapper->setSize (getWidth(), getHeight());
@@ -2916,7 +2965,6 @@ FileSearchPath VSTPluginFormat::getDefaultLocationsToSearch()
     return FileSearchPath ("/usr/lib/vst");
    #endif
 }
 
-#endif
 #undef log
 #endif

Jules, could you include that change in the master? I can rebase the patch on the tip if it makes it easier. But I guess you will want to review and probably adapt the styling to your taste?


#18

Cool stuff, thanks! I’ve checked in some changes that should do the job - would appreciate any sanity-checking!


#19

Ran the plugin host demo, instantiating all the 64 bit plugins I have on my system, and it seemed to work like a charm.

Thanks for the quick integration!