lichen-community-systems / Flocking

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

The flock.ugen.envGen unit tests cause Chrome to crash on Windows #178

Closed colinbdclark closed 7 years ago

colinbdclark commented 8 years ago

For whatever historical reason, the flock.ugen.envGen unit tests initialize the Flocking environment each time they construct a new Synth instance. This was presumably in order to control the sample rate of the synth instances within the unit tests, however this can more effectively be performed simply by setting the audioSettings member of a synth now.

The result of the "envelope curve start and end points" test continually creating synths, which in this faulty implementation was calling flock.init() each time is that the Chrome process on Windows just flat out crashes with its "Oops..." error message.

Tracking this down, I found that removing any single entry from the flock.test.envGen.customADSREnvelopeTestSpec specification was enough to work around the issue. There are nine entries in the list. I don't have a simplified test to prove it, but it seems likely that Chrome on Windows will simply crash if one attempts to instantiate more than 8 AudioContext instances, which is done as part of the process of initializing Flocking.

The implementation of flock.test.envGen.makeSynth should be refactored so that it avoids calling flock.init() at all.