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.

292 lines
18KB

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