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.

81 lines
2.9KB

  1. /*
  2. ==============================================================================
  3. JUCE demo code - use at your own risk!
  4. ==============================================================================
  5. */
  6. #include "../JuceLibraryCode/JuceHeader.h"
  7. #include "SpectrogramComponent.h"
  8. //==============================================================================
  9. class SimpleFFTExampleApplication : public JUCEApplication
  10. {
  11. public:
  12. //==============================================================================
  13. SimpleFFTExampleApplication() {}
  14. const String getApplicationName() override { return ProjectInfo::projectName; }
  15. const String getApplicationVersion() override { return ProjectInfo::versionString; }
  16. bool moreThanOneInstanceAllowed() override { return true; }
  17. //==============================================================================
  18. void initialise (const String& /*commandLine*/) override
  19. {
  20. mainWindow = new MainWindow();
  21. }
  22. void shutdown() override
  23. {
  24. mainWindow = nullptr; // (deletes our window)
  25. }
  26. //==============================================================================
  27. void systemRequestedQuit() override
  28. {
  29. // This is called when the app is being asked to quit: you can ignore this
  30. // request and let the app carry on running, or call quit() to allow the app to close.
  31. quit();
  32. }
  33. //==============================================================================
  34. /*
  35. This class implements the desktop window that contains an instance of
  36. our MainContentComponent class.
  37. */
  38. class MainWindow : public DocumentWindow
  39. {
  40. public:
  41. MainWindow() : DocumentWindow (ProjectInfo::projectName,
  42. Colours::lightgrey,
  43. DocumentWindow::allButtons)
  44. {
  45. setUsingNativeTitleBar (true);
  46. setContentOwned (new SpectrogramComponent(), true);
  47. setResizable (true, true);
  48. centreWithSize (getWidth(), getHeight());
  49. setVisible (true);
  50. }
  51. void closeButtonPressed() override
  52. {
  53. // This is called when the user tries to close this window. Here, we'll just
  54. // ask the app to quit when this happens, but you can change this to do
  55. // whatever you need.
  56. JUCEApplication::getInstance()->systemRequestedQuit();
  57. }
  58. private:
  59. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainWindow)
  60. };
  61. private:
  62. ScopedPointer<MainWindow> mainWindow;
  63. };
  64. //==============================================================================
  65. // This macro generates the main() routine that launches the app.
  66. START_JUCE_APPLICATION (SimpleFFTExampleApplication)