View Single Post
Old 05-10-2021, 05:14 PM   #23
gxray
Human being with feelings
 
Join Date: Dec 2020
Location: Miami, FL USA
Posts: 396
Default

Okay, a fellow named Ben Vining on the JUCE Discord helped me out with making the file global var thing less hacky using "static" + thread-local variables.

I think it's pretty much ready to submit now =)

PHP Code:
struct AudioProcessorInitializerHelper
{  
    
inline static juce::ThreadLocalValue<juce::AudioProcessor*> lastProcessorCreated;

    static 
void JUCE_CALLTYPE setLastCreatedAudioProcessor(juce::AudioProcessorp) {
        
lastProcessorCreated =  p;
    }
    
    static 
juce::AudioProcessorJUCE_CALLTYPE getLastCreatedAudioProcessor() {
        return 
lastProcessorCreated.get();
    }
}; 
__________________
Seasoned codemonkey
Dunno a thing about making music (here to learn!)
gxray is offline   Reply With Quote