Closed samreid closed 5 years ago
@samreid and I discussed, and we are currently thinking that we should have a single static property in the Sound class that can be used to enable/disable all sound production. If we ever need finer granularity, we can add the individual 2nd parameter described in the first comment.
In the above commit, I Added an axon Property audioEnabledProperty which is used as a global audio on/off flag. I tested a few sims that it is working properly. Once sims are using this flag, then GameAudioPlayer could be rewritten.
See https://github.com/phetsims/vibe/issues/12. I'm not convinced that having a global soundEnabledProperty is a good idea.
Vibe is not going to be used as our main sound library moving forward, and global on/off of sound has been implemented in tambo, which is the new sound library. Eventually, vibe will be deprecated and, with that in mind, it's not worth spending any effort on a four-year-old GitHub issue. Closing.
I think it will clean up several usage sites if we can add a second parameter to the Sound constructor, which is a Property for soundEnabledProperty. This will be an optional parameter, and when the sound is played, if this parameter was provided the sound will only be played if the sound was enabled.
An alternative would be to add a Static method on Sound that turns all sound on/off. Let's discuss.