How can I change JUCE_MODAL_LOOPS_PERMITTED=1 to use Tracktion Engine

I just updated JUCE to Version 6.1.2 and the Tracktion engine to Version 1.1.

I’m getting this build error:

#if ! JUCE_MODAL_LOOPS_PERMITTED
#error "You must define JUCE_MODAL_LOOPS_PERMITTED=1 to use Tracktion Engine"
#endif

(JUCE Modules/tracktion_engine/traction_engine.h)

I found a entry here and changed it but i didn’t help…

> 
> #if JUCE_ANDROID && ! defined (DOXYGEN)
>  #define JUCE_MODAL_LOOPS_PERMITTED 0
> #elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
>  /** Some operating environments don't provide a modal loop mechanism, so this flag can be
>      used to disable any functions that try to run a modal loop. */
>  #define JUCE_MODAL_LOOPS_PERMITTED 1
> #endif

(modules/juce_core/system/juce_PlatformDefs.h)

Can someone give me a hint, please?

Thanks!

1 Like

How have you set up your project? Using the Projucer or CMake?
Basically you need to add a JUCE_MODAL_LOOPS_PERMITTED=1 in your preprocessor definitions.

4 Likes

I’m using Projucer and found the right place in project settings. It successfully builds the code again.
Thanks!

Hi, where did you set JUCE_MODAL_LOOPS_PERMITTED=1?
I am new to JUCE and have no idea, where to find the right place to set it.

Hi Paula,
you can find it here in the Projucer app:

3 Likes

Thank you very much. It was right in front of. :slight_smile:

was the same with me :wink:

I can’t seem to make this work on Android, I believe it’s due to juce_PlatformDefs.h where, the following is defined and probably overrides the jucer settings:

//==============================================================================
#if JUCE_ANDROID && ! defined (DOXYGEN)
 #define JUCE_MODAL_LOOPS_PERMITTED 0
#elif ! defined (JUCE_MODAL_LOOPS_PERMITTED)
 /** Some operating environments don't provide a modal loop mechanism, so this flag can be
     used to disable any functions that try to run a modal loop. */
 #define JUCE_MODAL_LOOPS_PERMITTED 0
#endif

AFAIK android is one of those mentioned “operating environments [that] don’t provide a modal loop mechanism”.
Even if you manage to override that setting, it won’t work properly. You need to implement your project in an asynchronous way.

Yes, that’s a good point. You can’t use modal loops on Android.
I thought for that very reason the engine could build without modal loops enabled… I’ll have to see if that’s still the case or one has snuck in accidentally.

Ok, I’ve just checked and the engine module should still compile without modal loops (I think they’re needed for some of the examples).

If you just comment out the lines below in tracktion_engine.h does it work as expected?

#if ! JUCE_MODAL_LOOPS_PERMITTED
#error "You must define JUCE_MODAL_LOOPS_PERMITTED=1 to use Tracktion Engine"
#endif

We’re trying to get Traction Engine running on Android. We’ve confirmed that it builds and works as expected with that #error commented out.

Would it be possible to get it removed so we don’t have to patch it ourselves?

What branch are you on? It’s already gone on develop which will be merged in to master in the not too distant future.

1 Like

ok great we’ll switch to develop then :slight_smile: