I had a class inside a class inside a class (all private members) whose variable I wanted to access easily for debugging reasons, with minimal modification to the code.
I found a really easy way to access the variable from my main function simply by using a preprocessor declaration that turns all privates public
Then from main I was able to access it with class.class.class.variable
There are probably better ways to debug than hacking private members to be accessible from an outer scope. Like using the debugger or putting jasserts or logging in the inner classes implementationsā¦
Lol. I appreciate the concern everyone but relax, no one is suggesting this go into any release build.
I just wanted to know what it would sound like If I modulated a certain variable and before doing it the ārightā way I wanted to test it out quick and dirty.
I have removed the the preprocessor directive already. Balance has been restored to the universe
Hijacking the post (but with some correlation to the class calls):
Iāve a FileLoader class that uses itās own thread to load a file and then giving a pointer to the AudioBuffer itās stored. Since Iāll be using that AudioBuffer to be read in an oscillator in a Synth with multiple voices, Iād like to call it only once in the AudioProcessor and pass it to the Oscillator (AudioProcessor->Synth->Voice->Oscillator), otherwise loading the file in the Osc itself (which would avoid a lot of passing mess) is really inefficient since it will create a background thread + load the same file for each voice.
But making setters from the processor to the oscillator seems kinda dirty somehow.
Which would be the neatest way to pass the buffer pointer to the Osc? Or Iām just overcomplicating this and can be made in a simpler way?