lichen-community-systems / Flocking

Flocking - Creative audio synthesis for the Web
GNU General Public License v2.0
697 stars 60 forks source link

flock.enviro.play() is confusing for users, and doesn't guard against multiple invocations #109

Closed colinbdclark closed 9 years ago

colinbdclark commented 9 years ago

The Flocking Environment exposes a method called play() that is used to start the sample generation process. Based on verbal reports and posts on the mailing list, I think it's confusing for users, since it's easy for a newcomer to assume they need to call enviro.play() each time they want to trigger a sound. In reality, only one Environment instance should be created per application, and play() should be called only once at the beginning of the sound-generation process.

In order to address this issue, we should rename this method to start(), which is symmetrical with the Environment's existing stop() method, and matches the description of this function in all the documentation. The play() method should be deprecated and removed in Flocking 0.3.0.

In addition, multiple calls to enviro.play() will cause portions of the audio system to be reinstantiated unnecessarily. If the Environment is already playing, subsequent calls to play() should do nothing.