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.4KB

  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. MainHostWindow* mainWindow;
  29. public:
  30. //==============================================================================
  31. PluginHostApp()
  32. : mainWindow (0)
  33. {
  34. }
  35. ~PluginHostApp()
  36. {
  37. }
  38. void initialise (const String& /*commandLine*/)
  39. {
  40. // initialise our settings file..
  41. ApplicationProperties::getInstance()
  42. ->setStorageParameters (T("Juce Audio Plugin Host"),
  43. T("settings"), String::empty, 1000,
  44. PropertiesFile::storeAsXML);
  45. commandManager = new ApplicationCommandManager();
  46. AudioPluginFormatManager::getInstance()->addDefaultFormats();
  47. AudioPluginFormatManager::getInstance()->addFormat (new InternalPluginFormat());
  48. mainWindow = new MainHostWindow();
  49. //mainWindow->setUsingNativeTitleBar (true);
  50. commandManager->registerAllCommandsForTarget (this);
  51. commandManager->registerAllCommandsForTarget (mainWindow);
  52. mainWindow->menuItemsChanged();
  53. }
  54. void shutdown()
  55. {
  56. deleteAndZero (mainWindow);
  57. ApplicationProperties::getInstance()->closeFiles();
  58. deleteAndZero (commandManager);
  59. }
  60. const String getApplicationName()
  61. {
  62. return T("Juce Plug-In Host");
  63. }
  64. const String getApplicationVersion()
  65. {
  66. return ProjectInfo::versionString;
  67. }
  68. void systemRequestedQuit()
  69. {
  70. if (mainWindow->isValidComponent())
  71. mainWindow->tryToQuitApplication();
  72. else
  73. JUCEApplication::quit();
  74. }
  75. bool moreThanOneInstanceAllowed()
  76. {
  77. return true;
  78. }
  79. };
  80. // This kicks the whole thing off..
  81. START_JUCE_APPLICATION (PluginHostApp)