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.

116 lines
5.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. #pragma once
  20. //==============================================================================
  21. struct AudioPluginAppWizard : public NewProjectWizard
  22. {
  23. AudioPluginAppWizard() {}
  24. String getName() const override { return TRANS("Audio Plug-In"); }
  25. 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."); }
  26. const char* getIcon() const override { return BinaryData::wizard_AudioPlugin_svg; }
  27. StringArray getDefaultModules() override
  28. {
  29. StringArray s (NewProjectWizard::getDefaultModules());
  30. s.add ("juce_audio_plugin_client");
  31. s.add ("juce_audio_utils");
  32. return s;
  33. }
  34. bool initialiseProject (Project& project) override
  35. {
  36. createSourceFolder();
  37. String filterClassName = CodeHelpers::makeValidIdentifier (appTitle, true, true, false) + "AudioProcessor";
  38. filterClassName = filterClassName.substring (0, 1).toUpperCase() + filterClassName.substring (1);
  39. String editorClassName = filterClassName + "Editor";
  40. File filterCppFile = getSourceFilesFolder().getChildFile ("PluginProcessor.cpp");
  41. File filterHFile = filterCppFile.withFileExtension (".h");
  42. File editorCppFile = getSourceFilesFolder().getChildFile ("PluginEditor.cpp");
  43. File editorHFile = editorCppFile.withFileExtension (".h");
  44. project.getProjectTypeValue() = ProjectType_AudioPlugin::getTypeName();
  45. project.getShouldBuildStandalonePluginAsValue().setValue (true);
  46. Project::Item sourceGroup (createSourceGroup (project));
  47. project.getConfigFlag ("JUCE_QUICKTIME") = Project::configFlagDisabled; // disabled because it interferes with RTAS build on PC
  48. setExecutableNameForAllTargets (project, File::createLegalFileName (appTitle));
  49. String appHeaders (CodeHelpers::createIncludeStatement (project.getAppIncludeFile(), filterCppFile));
  50. String filterCpp = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_cpp")
  51. .replace ("FILTERHEADERS", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile)
  52. + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false)
  53. .replace ("FILTERCLASSNAME", filterClassName, false)
  54. .replace ("EDITORCLASSNAME", editorClassName, false);
  55. String filterH = project.getFileTemplate ("jucer_AudioPluginFilterTemplate_h")
  56. .replace ("APPHEADERS", appHeaders, false)
  57. .replace ("FILTERCLASSNAME", filterClassName, false)
  58. .replace ("HEADERGUARD", CodeHelpers::makeHeaderGuardName (filterHFile), false);
  59. String editorCpp = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_cpp")
  60. .replace ("EDITORCPPHEADERS", CodeHelpers::createIncludeStatement (filterHFile, filterCppFile)
  61. + newLine + CodeHelpers::createIncludeStatement (editorHFile, filterCppFile), false)
  62. .replace ("FILTERCLASSNAME", filterClassName, false)
  63. .replace ("EDITORCLASSNAME", editorClassName, false);
  64. String editorH = project.getFileTemplate ("jucer_AudioPluginEditorTemplate_h")
  65. .replace ("EDITORHEADERS", appHeaders + newLine + CodeHelpers::createIncludeStatement (filterHFile, filterCppFile), false)
  66. .replace ("FILTERCLASSNAME", filterClassName, false)
  67. .replace ("EDITORCLASSNAME", editorClassName, false)
  68. .replace ("HEADERGUARD", CodeHelpers::makeHeaderGuardName (editorHFile), false);
  69. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (filterCppFile, filterCpp))
  70. failedFiles.add (filterCppFile.getFullPathName());
  71. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (filterHFile, filterH))
  72. failedFiles.add (filterHFile.getFullPathName());
  73. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (editorCppFile, editorCpp))
  74. failedFiles.add (editorCppFile.getFullPathName());
  75. if (! FileHelpers::overwriteFileWithNewDataIfDifferent (editorHFile, editorH))
  76. failedFiles.add (editorHFile.getFullPathName());
  77. sourceGroup.addFileAtIndex (filterCppFile, -1, true);
  78. sourceGroup.addFileAtIndex (filterHFile, -1, false);
  79. sourceGroup.addFileAtIndex (editorCppFile, -1, true);
  80. sourceGroup.addFileAtIndex (editorHFile, -1, false);
  81. return true;
  82. }
  83. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAppWizard)
  84. };