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.

juce_CallbackMessage.h 2.7KB

9 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. #ifndef JUCE_CALLBACKMESSAGE_H_INCLUDED
  18. #define JUCE_CALLBACKMESSAGE_H_INCLUDED
  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. @see MessageManager, MessageListener, ActionListener, ChangeListener
  31. */
  32. class JUCE_API CallbackMessage : public MessageManager::MessageBase
  33. {
  34. public:
  35. //==============================================================================
  36. CallbackMessage() noexcept {}
  37. /** Destructor. */
  38. ~CallbackMessage() {}
  39. //==============================================================================
  40. /** Called when the message is delivered.
  41. You should implement this method and make it do whatever action you want
  42. to perform.
  43. Note that like all other messages, this object will be deleted immediately
  44. after this method has been invoked.
  45. */
  46. virtual void messageCallback() = 0;
  47. private:
  48. // Avoid the leak-detector because for plugins, the host can unload our DLL with undelivered
  49. // messages still in the system event queue. These aren't harmful, but can cause annoying assertions.
  50. JUCE_DECLARE_NON_COPYABLE (CallbackMessage)
  51. };
  52. #endif // JUCE_CALLBACKMESSAGE_H_INCLUDED