Determine the gain on first use
This commit is contained in:
@@ -100,6 +100,17 @@ var enableAudio = function() {
|
||||
var toggleDemo = function(text, gain) {
|
||||
var handler = function(e) {
|
||||
enableAudio();
|
||||
if (!gain) {
|
||||
if (text === "White Noise") {
|
||||
gain = whiteGain;
|
||||
}
|
||||
if (text === "Pink Noise") {
|
||||
gain = pinkGain;
|
||||
}
|
||||
if (text === "Brown Noise") {
|
||||
gain = brownGain;
|
||||
}
|
||||
}
|
||||
if (gain.gain.value == 0.0) {
|
||||
$(e.target).text("Stop");
|
||||
gain.gain.value = 0.03;
|
||||
|
||||
Reference in New Issue
Block a user