1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-01 03:10:06 +00:00

Unity: Initialise JUCE GUI earlier to avoid hitting some assertions

This commit is contained in:
ed 2018-10-17 12:27:23 +01:00
parent aaad33ce57
commit 4e54953f01

View file

@ -505,9 +505,6 @@ namespace UnityCallbacks
{
int UNITY_INTERFACE_API createCallback (UnityAudioEffectState* state)
{
if (getWrapperMap().size() == 0)
initialiseJuce_GUI();
auto* pluginInstance = new AudioProcessorUnityWrapper (false);
pluginInstance->create (state);
@ -671,14 +668,16 @@ static void declareEffect (UnityAudioEffectDefinition& definition)
UNITY_INTERFACE_EXPORT int UnityGetAudioEffectDefinitions (UnityAudioEffectDefinition*** definitionsPtr)
{
static bool hasSetWrapperType = false;
static bool hasInitialised = false;
if (! hasSetWrapperType)
if (! hasInitialised)
{
juce::initialiseJuce_GUI();
juce::PluginHostType::jucePlugInClientCurrentWrapperType = juce::AudioProcessor::wrapperType_Unity;
juce::juce_createUnityPeerFn = juce::createUnityPeer;
hasSetWrapperType = true;
hasInitialised = true;
}
auto* definition = new UnityAudioEffectDefinition();