Hi! I am building an iOS app that uses tracktion_engine. Tracktion needs a JUCEApplication to run. My problems are:
I can’t create the JUCEApplication with START_JUCE_APPLICATION (or START_JUCE_APPLICATION_WITH_CUSTOM_DELEGATE) because it creates a main function separate from my app’s main;
Can’t call JUCEApplicationBase::main() directly because the main execution stops in MessageManager::getInstance()->runDispatchLoop();.
Can’t run JUCEApplicationBase::main() in a background thread because tracktion_engine makes calls to the UI API that have to run in the main thread;
I don’t know what is the correct approach. Maybe it has something to do with the delegate, or running the MessageManager loop without a JUCEApplication.
I tried running the MessageManager loop in a separate thread, but then it keeps bumping into JUCE_ASSERT_MESSAGE_MANAGER_IS_LOCKED and JUCE_ASSERT_MESSAGE_THREAD checks. It makes sense… I just don’t know how I could work.
Don’t use START_JUCE_APPLICATION or START_JUCE_APPLICATION_WITH_CUSTOM_DELEGATE. Just call juce::MessageManager::getInstance(); before creating the tracktion_engine. This is my Objective-C++ wrapper (uses the PIMPL pattern):
That is awesome job!
Do you a sample repo that demonstrates this setup? I always found it hard to wrap my head around different ways iOS + Juce project can be configured. Running trackrion_engine on Web just sounds intriguing!
Would be awesome to see it on GitHub!
Oh man that’s cool. I’m building an ReactNative app that uses a custom delegate & bridging headers but will be needing a good arrangement view inside my react component, I wonder if I should try this…