Audio plugin host https://kx.studio/carla
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.

73 lines
2.8KB

  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. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. namespace juce
  18. {
  19. //==============================================================================
  20. /**
  21. A message that invokes a callback method when it gets delivered.
  22. You can use this class to fire off actions that you want to be performed later
  23. on the message thread.
  24. To use it, create a subclass of CallbackMessage which implements the messageCallback()
  25. method, then call post() to dispatch it. The event thread will then invoke your
  26. messageCallback() method later on, and will automatically delete the message object
  27. afterwards.
  28. Always create a new instance of a CallbackMessage on the heap, as it will be
  29. deleted automatically after the message has been delivered.
  30. Note that this class was essential back in the days before C++11, but in modern
  31. times you may prefer to use MessageManager::callAsync() with a lambda.
  32. @see MessageManager::callAsync, MessageListener, ActionListener, ChangeListener
  33. */
  34. class JUCE_API CallbackMessage : public MessageManager::MessageBase
  35. {
  36. public:
  37. //==============================================================================
  38. CallbackMessage() noexcept {}
  39. /** Destructor. */
  40. ~CallbackMessage() {}
  41. //==============================================================================
  42. /** Called when the message is delivered.
  43. You should implement this method and make it do whatever action you want
  44. to perform.
  45. Note that like all other messages, this object will be deleted immediately
  46. after this method has been invoked.
  47. */
  48. virtual void messageCallback() = 0;
  49. private:
  50. // Avoid the leak-detector because for plugins, the host can unload our DLL with undelivered
  51. // messages still in the system event queue. These aren't harmful, but can cause annoying assertions.
  52. JUCE_DECLARE_NON_COPYABLE (CallbackMessage)
  53. };
  54. } // namespace juce