Well without using global variables, I found that when I toggled sound off, I got errors trying to turn it back on because it was not yet defined in that scene. So then I would define it but it would run into race conditions and cause other errors (like already streaming errors). However, as global variables, I found that I still don’t know when to dispose of them because they become undefined. Doing local variables allowed me to dispose of them between scenes but redefine them in the next.
And while the tutorials are handy (wish I found it before I reworked my variables to global and before I put in about 80 “if sound on, play sound”), they don’t specifically address streaming sounds. It mentions disposing of sounds, but not streams, so it still doesn’t really answer my question of when to dispose of streams (if ever…or simply when you close out of the app or no longer need the song again, like if you beat level 1 and no longer need level 1’s song).
I will say that global variables have simplified my code and caused my errors/warnings to go away. With locally defined variables I got 1 of 4 errors when I began turning sounds on or off or switched scenes. Now the only problem is toggling sound sometimes plays the wrong song.