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.

107 lines
5.5KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. struct AudioPluginAppWizard : public NewProjectWizard
  18. {
  19. AudioPluginAppWizard() {}
  20. String getName() const override { return TRANS("Audio Plug-In"); }
  21. String getDescription() const override { return TRANS("Creates a VST/AU/RTAS/AAX audio plug-in. This template features a single window GUI and Audio/MIDI IO functions."); }
  22. const char* getIcon() const override { return BinaryData::wizard_AudioPlugin_svg; }
  23. StringArray getDefaultModules() override
  24. {
  25. StringArray s (NewProjectWizard::getDefaultModules());
  26. s.add ("juce_audio_plugin_client");
  27. return s;
  28. }
  29. bool initialiseProject (Project& project) override
  30. {
  31. createSourceFolder();
  32. String filterClassName = CodeHelpers::makeValidIdentifier (appTitle, true, true, false) + "AudioProcessor";
  33. filterClassName = filterClassName.substring (0, 1).toUpperCase() + filterClassName.substring (1);
  34. String editorClassName = filterClassName + "Editor";
  35. File filterCppFile = getSourceFilesFolder().getChildFile ("PluginProcessor.cpp");
  36. File filterHFile = filterCppFile.withFileExtension (".h");
  37. File editorCppFile = getSourceFilesFolder().getChildFile ("PluginEditor.cpp");
  38. File editorHFile = editorCppFile.withFileExtension (".h");
  39. project.getProjectTypeValue() = ProjectType_AudioPlugin::getTypeName();
  40. Project::Item sourceGroup (createSourceGroup (project));
  41. project.getConfigFlag ("JUCE_QUICKTIME") = Project::configFlagDisabled; // disabled because it interferes with RTAS build on PC
  42. setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle));
  43. String appHeaders (CodeHelpers::createIncludeStatement (project.getAppIncludeFile(), filterCppFile));
  44. String filterCpp = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_cpp")
  45. .replace ("FILTERHEADERS", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile)
  46. + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false)
  47. .replace ("FILTERCLASSNAME", filterClassName, false)
  48. .replace ("EDITORCLASSNAME", editorClassName, false);
  49. String filterH = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_h")
  50. .replace ("APPHEADERS", appHeaders, false)
  51. .replace ("FILTERCLASSNAME", filterClassName, false)
  52. .replace ("HEADERGUARD", CodeHelpers::makeHeaderGuardName (filterHFile), false);
  53. String editorCpp = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_cpp")
  54. .replace ("EDITORCPPHEADERS", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile)
  55. + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false)
  56. .replace ("FILTERCLASSNAME", filterClassName, false)
  57. .replace ("EDITORCLASSNAME", editorClassName, false);
  58. String editorH = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_h")
  59. .replace ("EDITORHEADERS", appHeaders + newLine + CodeHelpers::createIncludeStatement (filterHFile, filterCppFile), false)
  60. .replace ("FILTERCLASSNAME", filterClassName, false)
  61. .replace ("EDITORCLASSNAME", editorClassName, false)
  62. .replace ("HEADERGUARD", CodeHelpers::makeHeaderGuardName (editorHFile), false);
  63. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp))
  64. failedFiles.add (filterCppFile.getFullPathName());
  65. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (filterHFile, filterH))
  66. failedFiles.add (filterHFile.getFullPathName());
  67. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (editorCppFile, editorCpp))
  68. failedFiles.add (editorCppFile.getFullPathName());
  69. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (editorHFile, editorH))
  70. failedFiles.add (editorHFile.getFullPathName());
  71. sourceGroup.addFileAtIndex (filterCppFile, -1, true);
  72. sourceGroup.addFileAtIndex (filterHFile, -1, false);
  73. sourceGroup.addFileAtIndex (editorCppFile, -1, true);
  74. sourceGroup.addFileAtIndex (editorHFile, -1, false);
  75. return true;
  76. }
  77. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAppWizard)
  78. };