The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

343 lines
21KB

  1. The Juce Polymorphic Plugin Project!
  2. ====================================
  3. (c) 2008 by Raw Material Software, visit www.rawmaterialsoftware.com for more info.
  4. -----------------------------------------------------------------------------------------------------
  5. This file contains as much detail as I could possibly think of about the sometimes fiddly process of setting
  6. up your build environment to build plugins...
  7. If you follow all these steps and still hit a build error, don't despair! There's a thread at the juce
  8. forum where we'll post any extra hints, tips, or problems that people have stumbled upon:
  9. http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?p=23546
  10. -----------------------------------------------------------------------------------------------------
  11. The purpose of this framework is to make is simple to write an audio plugin in a generic
  12. way, which can then be compiled as a VST, AudioUnit, RTAS, or any combination of these.
  13. It's "polymorphic" because the output is a single binary module that acts as all of the
  14. different plugin formats at the same time. This means that you only need to maintain one
  15. project, and only need to perform one build to create a multi-format plugin.
  16. Also included are some helper classes that make it easy to create a stand-alone app to
  17. run your plugin without a host. This might be useful in its own right, but can also be very
  18. handy when developing your plugin, because you can build, test and debug it without needing
  19. to keep restarting a 3rd-party host.
  20. How does it work?
  21. =================
  22. To create your plugin, you just create a subclass of the AudioPluginInstance class to
  23. perform the processing. And your plugin UI is written like any normal Juce UI component.
  24. All the platform-specific code is hidden away in wrapper classes that you just add to
  25. your project - you should (hopefully) never need to even see the inner workings of these.
  26. Licensing issues
  27. ================
  28. Juce is released under the GPL (Gnu Public License) - this means that you're free to use
  29. and redistribute it as long as your products are also released under the GPL. Basically
  30. this means that if you use it, you also have to give away your source code.
  31. If you want to release a closed-source application, you can buy a commercial license
  32. that lets you avoid this restriction - see http://www.rawmaterialsoftware.com/juce for more info,
  33. or see the comments at the top of all the Juce source files.
  34. If you're building the VST projects or releasing a VST, you'll need have a look at Steinberg's
  35. developer site to see what licensing rules apply these days. Their website's at
  36. http://www.steinberg.net
  37. If you're building an RTAS then you'll need to sign Digidesign's developer license to get
  38. their SDK. Visit http://www.digidesign.com for more info.
  39. Getting Started
  40. ===============
  41. There's also a 'demo' folder - this contains an example plugin which can be built in all
  42. the different formats.
  43. Have a look at the demo classes to see how it works, and then to create a real plugin,
  44. you'll need to replace the demo files with your own code.
  45. I've tried to add helpful comments where you might run across common compile errors, to
  46. help describe what you might be doing wrong, as getting a build set-up for some of these
  47. formats can be a bit of a pain. Please let me know if you find there's anything missing
  48. from these instructions or anything I could change to help smooth the build process along
  49. a bit.
  50. I'd recommend NOT putting your own plugin code inside the demo plugin directory - it's
  51. much neater to keep it somewhere separate and to alter the projects to point to your
  52. files instead of the demo ones. That way when new versions of this library come out, it'll
  53. make it easier to update to the latest code.
  54. -----------------------------------------------------------------------------------------------------
  55. Prerequisites for building a VST
  56. ================================
  57. - Visit http://www.steinberg.net and jump through whatever hoops are necessary to download
  58. and install the VST SDK.
  59. - Make sure your include path contains an entry for the "vstsdk2.4" folder containing the SDK.
  60. -----------------------------------------------------------------------------------------------------
  61. Prerequisites for building an RTAS
  62. ==================================
  63. - Contact Digidesign, ask to become a Digidesign Development Partner, sign the relevent
  64. agreements and NDAs.
  65. - From the Digidesign website, download their latest Plug-In SDK
  66. - Install the SDK and build some of the demo plugins to make sure it all works.
  67. - In Visual Studio: Add all of these to your include path:
  68. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\EffectClasses
  69. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\ProcessClasses
  70. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\ProcessClasses\Interfaces
  71. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\Utilities
  72. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\RTASP_Adapt
  73. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\CoreClasses
  74. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\Controls
  75. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\Meters
  76. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\ViewClasses
  77. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\DSPClasses
  78. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\PluginLibrary\Interfaces
  79. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\common
  80. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\common\Platform
  81. c:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugins\SignalProcessing\Public
  82. C:\yourdirectory\PT_80_SDK\AlturaPorts\TDMPlugIns\DSPManager\Interfaces
  83. c:\yourdirectory\PT_80_SDK\AlturaPorts\SADriver\Interfaces
  84. c:\yourdirectory\PT_80_SDK\AlturaPorts\DigiPublic\Interfaces
  85. c:\yourdirectory\PT_80_SDK\AlturaPorts\Fic\Interfaces\DAEClient
  86. c:\yourdirectory\PT_80_SDK\AlturaPorts\NewFileLibs\Cmn
  87. c:\yourdirectory\PT_80_SDK\AlturaPorts\NewFileLibs\DOA
  88. c:\yourdirectory\PT_80_SDK\AlturaPorts\AlturaSource\PPC_H
  89. c:\yourdirectory\PT_80_SDK\AlturaPorts\AlturaSource\AppSupport
  90. c:\yourdirectory\PT_80_SDK\AvidCode\AVX2sdk\AVX\avx2\avx2sdk\inc
  91. C:\yourdirectory\PT_80_SDK\xplat\AVX\avx2\avx2sdk\inc
  92. - In Visual Studio: Using the Digidesign demo projects in the SDK, make sure you've compiled
  93. debug and release versions of the following static libraries:
  94. DAE.lib, DigiExt.lib, DSI.lib, PlugInLib.lib.
  95. - In XCode: After installing the Digidesign SDK, make sure you've run the config_SDK_for_Mac
  96. command in the SDK's root directory. This sets up some of the tools that it needs.
  97. - In XCode: If you're using the Digi files CommonDebugSettings.xcconfig and CommonReleaseSettings.xcconfig,
  98. then you'll probably have to remove the "-x c++" option from their OTHER_CFLAGS setting, because
  99. that prevents it compiling obj-C. Also, you might need to comment-out the GCC_PREFIX_HEADER setting,
  100. unless you can persuade precompiled headers to work (I've never managed to get them working myself..)
  101. You'll also probably want to add a "MacBag" setting to these files, rather than putting it into
  102. your project - e.g. "MacBag = /Users/jules/SDKs/PT_80_SDK/MacBag"
  103. -----------------------------------------------------------------------------------------------------
  104. Choosing the formats to build
  105. =============================
  106. Each plugin project needs to contain a JucePluginCharacteristics.h file, which holds all the
  107. plugin-specific build details. In here, there are three macros that you can set to enable each
  108. of the available formats:
  109. #define JucePlugin_Build_VST 1
  110. #define JucePlugin_Build_RTAS 1
  111. #define JucePlugin_Build_AU 1
  112. You can set these to 0 to disable the formats that you don't want to build, and this will avoid
  113. any compilation problems if, for example, you don't have the appropriate SDK for a particular format.
  114. -----------------------------------------------------------------------------------------------------
  115. Creating a PC VST/RTAS plugin in Visual Studio
  116. ==============================================
  117. - First try loading the VST demo project in JuceAudioPlugin/demo/build. Hopefully this
  118. should build correctly.
  119. - Create a new, empty, win32 project using Visual Studio. Choose "DLL" as the type of
  120. product to build
  121. - If building an RTAS, add to your project all the juce_RTAS_*.cpp files from the wrapper/RTAS folder.
  122. - If building a VST, add to your project all the juce_VST_*.cpp files from the wrapper/VST folder.
  123. - Create yourself a JucePluginCharacteristics.h file, starting with a copy of the one in the
  124. demo project. Go through each item inside it carefully, and set them to the appropriate value
  125. for your plugin.
  126. - Under "Additional Include Directories", add the folder in which you're going to put
  127. your JucePluginCharacteristics.h file.
  128. - If you're doing an RTAS, change these project settings (these can all be ignored if you're only doing a VST):
  129. - Set "C++/Code Generation/Runtime Library" to be "Multi-threaded DLL" or "Multi-threaded Debug DLL"
  130. - Set the "Linker/Input/Module Definition file" to point to "wrapper/RTAS/juce_RTAS_WinExports.def"
  131. - Under "Linker/Input/Delay loaded DLLs", add the following:
  132. "DAE.dll; DigiExt.dll; DSI.dll; PluginLib.dll; DSPManager.dll"
  133. - You may (or may not) need to add "libcmtd.lib; libcmt.lib" to the "Linker/Input/Ignore Specific Library" setting.
  134. - For ONLY the following files:
  135. juce_RTAS_Wrapper.cpp, juce_RTAS_DigiCode1.cpp, juce_RTAS_DigiCode2.cpp, juce_RTAS_DigiCode3.cpp,
  136. change their "C++/Advanced/Calling Convention" property to "__stdcall". All other files should
  137. be left with the default calling convention of "__cdecl"
  138. - Set the "Linker/General/Output File" property to "$(OutDir)\$(ProjectName).dpm" (If you're building
  139. a polymorphic VST/RTAS, then you can simply copy or rename the finished .dpm file to a .dll, and
  140. it'll function as a VST)
  141. - Under "Custom build step", add the following command:
  142. copy /Y "\yourdirectory\juce\extras\audio plugins\wrapper\RTAS\juce_RTAS_WinResources.rsr" "$(TargetPath)".rsr
  143. The corresponding "Outputs" setting for this must be set to "$(TargetPath)".rsr
  144. (This will copy and rename the juce_RTAS_WinResources.rsr file to sit next to the finished .dpm file. It's
  145. a dummy resource file, but PT will refuse to load the plugin unless it has a corresponding .rsr file)
  146. - Because the RTAS code duplicates some win32 constants, you might need to force it to link correctly
  147. by adding "/FORCE:multiple" to the linker's additional command line options.
  148. - You might want to change the output directory to "\Program Files\Common Files\Digidesign\DAE\Plug-Ins\"
  149. if you want the built plugin to go directly into the PT plugins folder
  150. - When setting properties, remember to change them for both your debug and release builds!
  151. - Create your actual plugin classes and add them to the project. Obviously this is the hard bit!
  152. - Add the amalgamated juce source file to the project - have a look at the demo app for neat ways of doing this.
  153. - NOTE: on Windows, because RTAS uses the altura mac-style code, there are annoying clashes caused if
  154. you also include the Apple QuickTime headers, so you might need to turn off quicktime by setting the
  155. juce config macro: #define JUCE_QUICKTIME 0
  156. - NOTE: If you're using MSVC2005 to build your plugin, the users will need to
  157. have the Microsoft VC8 Runtime installed on their machines, otherwise the DLL will
  158. silently fail to load. You should probably add the runtime to your plugin's installer,
  159. and you can get a copy of it here:
  160. http://www.microsoft.com/downloads/details.aspx?FamilyID=32bc1bee-a3f9-4c13-9c99-220b62a191ee&DisplayLang=en
  161. -----------------------------------------------------------------------------------------------------
  162. Creating a Mac AU/VST/RTAS plugin in XCode
  163. ==========================================
  164. - Some of the RTAS SDK files in the demo project might be highlighted red to indicate that they're
  165. missing - if you're not bulding an RTAS, then you can just delete them from the project. If you are
  166. building an RTAS and have the SDK, you might need to update their paths to match your SDK location.
  167. - For an AU, there are a bunch of Apple cpp files that need to be included directly in your project - these
  168. used to be found in /Developer/Examples/CoreAudio/ but in the 10.6 SDK, Apple have moved them to a slightly
  169. more sensible location at /Developer/Extras/CoreAudio. The Juce demo is hardwired to refer to their new
  170. 10.6 location, so if you haven't yet installed the 10.6 SDK, the easiest way to make it all happy is just
  171. to duplicate your /Developer/Examples/CoreAudio folder as /Developer/Extras/CoreAudio. That way old and new
  172. juce plugin projects will all compile without changing any project paths.
  173. - For an AU, make sure that the JucePlugin_Build_AU is enabled in your JucePluginCharacteristics.h
  174. - In XCode, create a new project based on the "Audio Unit Effect" template
  175. - XCode will create a bunch of template source files for you - you can remove all of these from the project
  176. and delete them
  177. - In the target settings, clear the "Exported Symbols File" setting. The exports are specified by directives
  178. within the wrapper code, so don't need to be listed explicitly.
  179. - All all the Apple frameworks that Juce normally requires to the "External Frameworks" list
  180. - Add all the juce_AU_* files from the /wrapper/AU directory to your project
  181. - The template project creates an AUPublic group that contains lots of AudioUnit source files. But
  182. it leaves out files that it thinks you might not need, e.g. if you chose an "Audio Unit Effect" project,
  183. then it won't add the classes for handling MIDI. So you'll probably need to go into this folder
  184. and check that it contains AUMIDIBase.cpp, AUMidiEffectBase.cpp, MusicDeviceBase.cpp, etc
  185. - As for the PC, you'll need to make sure your project contains a correctly set-up JucePluginCharacteristics.h
  186. file - start with a copy of the one in the demo plugin project, and go through it making sure that
  187. all the values make sense for your plugin.
  188. - The JucePluginCharacteristics.h file is included not only by the code, but also by the resources files - so it
  189. needs to be locatable on both your normal header search path, and also on your resource include path, which is
  190. the project setting called 'Rez Search Paths'
  191. - Because of the flat naming structure used by Objective-C, if a host loads several different plugins which
  192. all contain slightly different versions of the juce library, you can get nasty situations where all their obj-C
  193. classes are cross-linked to the similarly-named class in other modules, and everything turns into a big mess...
  194. To avoid this, you're advised to set a unique JUCE_ObjCExtraSuffix value (you'll find this in juce_mac_NativeCode.mm,
  195. or if you're using the amalgamated version, you can just set it before including juce_amalgamated.cpp). Choose a
  196. suffix that's unique to both the name and version of your plugin.
  197. - Create your actual plugin classes and add them to the project. Obviously this is the hard bit!
  198. You should now be able to build a functional AU! If you want VST support as well, then read on...
  199. - Make sure that the JucePlugin_Build_VST is enabled in your JucePluginCharacteristics.h
  200. - For VST support, add all the juce_VST_* files from /wrapper/VST
  201. - In your target info settings, add the vstsdk2_4 folder to your "Header Search Paths" list
  202. - Make sure that in your Info.plist, the "Bundle Name" value is correctly set to the name of your plugin.
  203. Now, if you compile, the resulting bundle should work as both a VST and AU - you can simply copy or rename it,
  204. changing the suffix to ".vst", and put it in your VST folder.
  205. NOTE! In order to copy and rename the plugin to the various different plugin folders, the demo plugin project
  206. contains a VERY useful script, which you'll almost certainly want to copy into your own projects - have
  207. a look in the demo target for the build phase called "Copy into the different plugin folders", and use the
  208. inspector to have a look at the script. It uses advanced cunningness to copy only to the correct target
  209. folders for the types of plugin you're targeting, and should be able to be used in your own project
  210. without needing to edit it.
  211. NOTE! If you use the Finder to rename your xyz.component file to xyz.vst, it might look like it's done
  212. exactly this... but in fact, the Finder may have secretly renamed it as "xyz.vst.component", even though
  213. it shows "xyz.vst" as the name on the screen. I have wasted quite a lot of time angrily wondering why my VSTs
  214. don't seem to work, before realising that this is what has happened. You should use the command-line to rename
  215. it correctly.
  216. If you also want to build an RTAS, then carry on reading...
  217. - Make sure that the JucePlugin_Build_RTAS is enabled in your JucePluginCharacteristics.h
  218. - After installing the Digidesign SDK, make sure you've run the config_SDK_for_Mac command in
  219. its root directory. This sets up some of the tools that it needs.
  220. - Add the files from /wrapper/RTAS to your project. Obviously a couple of these are for Windows, so
  221. you shouldn't add those
  222. - In the Digi SDK, in /AlturaPorts/TDMPlugins/common/mac, there are two config files:
  223. CommonDebugSettings.xconfig and CommonReleaseSettings.xconfig
  224. These contain lots of Digi hackery to get their stuff to compile, so you should add them to your project
  225. and change your project's settings to use these files as their base config. Even so, it's all a bit of a mess,
  226. and you may need to tweak them a bit to get it to work on your system.
  227. - In your target settings, add a custom build setting called "MacBag", and set this to the path where the
  228. "MacBag" folder of the Digi SDK lives.
  229. - Add the following to your "Header Search Paths" setting (it's easiest to copy-and-paste this setting from
  230. the demo project):
  231. "$(MacBag)/../AlturaPorts/TDMPlugIns/PlugInLibrary/**"
  232. "$(MacBag)/../AlturaPorts/TDMPlugIns/DSPManager/**"
  233. "$(MacBag)/../AlturaPorts/TDMPlugIns/SupplementalPlugInLib/Encryption"
  234. "$(MacBag)/../AlturaPorts/TDMPlugIns/SupplementalPlugInLib/GraphicsExtensions"
  235. "$(MacBag)/../AlturaPorts/TDMPlugIns/common"
  236. "$(MacBag)/../AlturaPorts/TDMPlugIns/common/PI_LibInterface"
  237. "$(MacBag)/../AlturaPorts/TDMPlugIns/PACEProtection/**"
  238. "$(MacBag)/../AlturaPorts/OMS/Headers"
  239. "$(MacBag)/../AlturaPorts/Fic/Interfaces/**"
  240. "$(MacBag)/../AlturaPorts/Fic/Source/SignalNets"
  241. "$(MacBag)/../AlturaPorts/DSIPublicInterface/PublicHeaders"
  242. "$(MacBag)/../DAEWin/Include"
  243. "$(MacBag)/../AlturaPorts/DigiPublic/Interfaces"
  244. "$(MacBag)/../AlturaPorts/DigiPublic"
  245. "$(MacBag)/../AlturaPorts/NewFileLibs/DOA"
  246. "$(MacBag)/../AlturaPorts/NewFileLibs/Cmn"
  247. "$(MacBag)/../AlturaPorts/TDMPlugIns/SignalProcessing/**"
  248. "$(MacBag)/../AvidCode/AVX2sdk/AVX/avx2/avx2sdk/inc"
  249. "$(MacBag)/../AvidCode/AVX2sdk/AVX/avx2/avx2sdk/utils"
  250. - If you get include errors compiling some of the DigiDesign code, you may need to
  251. add "/Developer/Headers/FlatCarbon" to your header search path.
  252. - In the SDK, find the PluginLibrary.xcodeproj file, and add this to your "External frameworks and Libraries".
  253. If you've already compiled this library, you can open its item in your XCode project treeview, to find
  254. the "libPluginLibrary.a" item inside it. Drag this subitem down to your Target/"Link Binary With Libraries"
  255. build stage and drop it there to add it to the link process.
  256. - In your Info.plist, change the "Bundle OS Type Code" to "TDMw", and the "Bundle Creator OS Type Code" to
  257. "PTul".
  258. - You may need to remove the "OTHER_CFLAGS = -x c++" from the RTAS settings file to stop it complaining about
  259. obj-C code
  260. You should now be able to build an RTAS! Again, just renaming the finished bundle to ".dpm" and
  261. putting it in your RTAS folder should be do the trick.
  262. If you get any weird build problems, a good tip is to try comparing the demo plugin's build settings with your
  263. own - this should usually show up what's missing.
  264. Note about exported symbols:
  265. When XCode builds the plugin, I've had unpredictable results when trying to stop it from exporting
  266. all of the internal functions as public symbols. There are some flags that are supposed to turn this
  267. off, but sometimes they don't seem to have any effect, and using an explicit exports file also
  268. seems a bit hit-and-miss. (If anyone knows better and can get this working, please let me know!)
  269. Anyway, as well as being wasteful and showing everyone what's inside your plugin, leaving all
  270. the symbols in there will cause fatal crashes when used with Tracktion, or alongside any other
  271. Juce-based plugins. A way of making sure your plugin is stripped is to use the command
  272. "strip -x -S YourPlugin.vst/Contents/MacOS/YourPlugin" after bulding it, which removes the
  273. unnecessary symbols (although in my experience this also doesn't seem to work all the time,
  274. so it's a good idea to check it using the unix "nm" command).