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_android_Messaging.cpp 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2013 - Raw Material Software 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. void MessageManager::doPlatformSpecificInitialisation() {}
  18. void MessageManager::doPlatformSpecificShutdown() {}
  19. //==============================================================================
  20. bool MessageManager::dispatchNextMessageOnSystemQueue (const bool returnIfNoPendingMessages)
  21. {
  22. Logger::outputDebugString ("*** Modal loops are not possible in Android!! Exiting...");
  23. exit (1);
  24. return true;
  25. }
  26. //==============================================================================
  27. bool MessageManager::postMessageToSystemQueue (MessageManager::MessageBase* const message)
  28. {
  29. message->incReferenceCount();
  30. android.activity.callVoidMethod (JuceAppActivity.postMessage, (jlong) (pointer_sized_uint) message);
  31. return true;
  32. }
  33. JUCE_JNI_CALLBACK (JUCE_ANDROID_ACTIVITY_CLASSNAME, deliverMessage, void, (jobject activity, jlong value))
  34. {
  35. JUCE_TRY
  36. {
  37. MessageManager::MessageBase* const message = (MessageManager::MessageBase*) (pointer_sized_uint) value;
  38. message->messageCallback();
  39. message->decReferenceCount();
  40. }
  41. JUCE_CATCH_EXCEPTION
  42. }
  43. //==============================================================================
  44. void MessageManager::broadcastMessage (const String&)
  45. {
  46. }
  47. void MessageManager::runDispatchLoop()
  48. {
  49. }
  50. void MessageManager::stopDispatchLoop()
  51. {
  52. struct QuitCallback : public CallbackMessage
  53. {
  54. QuitCallback() {}
  55. void messageCallback() override
  56. {
  57. android.activity.callVoidMethod (JuceAppActivity.finish);
  58. }
  59. };
  60. (new QuitCallback())->post();
  61. quitMessagePosted = true;
  62. }