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.

112 lines
3.7KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library - "Jules' Utility Class Extensions"
  4. Copyright 2004-9 by Raw Material Software Ltd.
  5. ------------------------------------------------------------------------------
  6. JUCE can be redistributed and/or modified under the terms of the GNU General
  7. Public License (Version 2), as published by the Free Software Foundation.
  8. A copy of the license is included in the JUCE distribution, or can be found
  9. online at www.gnu.org/licenses.
  10. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  11. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  13. ------------------------------------------------------------------------------
  14. To release a closed-source product which uses JUCE, commercial licenses are
  15. available: visit www.rawmaterialsoftware.com/juce for more information.
  16. ==============================================================================
  17. */
  18. #include "../JuceLibraryCode/JuceHeader.h"
  19. #include "MainHostWindow.h"
  20. #include "InternalFilters.h"
  21. #if ! (JUCE_PLUGINHOST_VST || JUCE_PLUGINHOST_AU)
  22. #error "If you're building the audio plugin host, you probably want to enable VST and/or AU support in juce_Config.h"
  23. #endif
  24. ApplicationCommandManager* commandManager = 0;
  25. //==============================================================================
  26. class PluginHostApp : public JUCEApplication
  27. {
  28. public:
  29. //==============================================================================
  30. PluginHostApp()
  31. {
  32. }
  33. ~PluginHostApp()
  34. {
  35. }
  36. void initialise (const String& commandLine)
  37. {
  38. // initialise our settings file..
  39. PropertiesFile::Options options;
  40. options.applicationName = "Juce Audio Plugin Host";
  41. options.filenameSuffix = "settings";
  42. options.osxLibrarySubFolder = "Preferences";
  43. ApplicationProperties::getInstance()->setStorageParameters (options);
  44. commandManager = new ApplicationCommandManager();
  45. AudioPluginFormatManager::getInstance()->addDefaultFormats();
  46. AudioPluginFormatManager::getInstance()->addFormat (new InternalPluginFormat());
  47. mainWindow = new MainHostWindow();
  48. //mainWindow->setUsingNativeTitleBar (true);
  49. commandManager->registerAllCommandsForTarget (this);
  50. commandManager->registerAllCommandsForTarget (mainWindow);
  51. mainWindow->menuItemsChanged();
  52. if (commandLine.isNotEmpty() && mainWindow->getGraphEditor() != 0)
  53. {
  54. #if JUCE_MAC
  55. if (! commandLine.trimStart().startsWith ("-psn"))
  56. #endif
  57. mainWindow->getGraphEditor()->graph.loadFrom (File::getCurrentWorkingDirectory()
  58. .getChildFile (commandLine), true);
  59. }
  60. }
  61. void shutdown()
  62. {
  63. mainWindow = 0;
  64. ApplicationProperties::getInstance()->closeFiles();
  65. deleteAndZero (commandManager);
  66. }
  67. void systemRequestedQuit()
  68. {
  69. if (mainWindow != 0)
  70. mainWindow->tryToQuitApplication();
  71. else
  72. JUCEApplication::quit();
  73. }
  74. const String getApplicationName() { return "Juce Plug-In Host"; }
  75. const String getApplicationVersion() { return ProjectInfo::versionString; }
  76. bool moreThanOneInstanceAllowed() { return true; }
  77. private:
  78. ScopedPointer <MainHostWindow> mainWindow;
  79. };
  80. // This kicks the whole thing off..
  81. START_JUCE_APPLICATION (PluginHostApp)