Navigation Menu

Skip to content

Commit

Permalink
Fixes oscillator types for Gain LFO and LFO Filter, removing warning …
Browse files Browse the repository at this point in the history
…"The provided value <int> is not a valid enum value of type OscillatorType."
  • Loading branch information
alemangui committed Aug 26, 2015
1 parent 6db321d commit 4edd852
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions index.html
Expand Up @@ -105,11 +105,11 @@
<div id="gainLFOControls">This effect chops up the sound by using a low-frequency oscillator (LFO) to control the
gain.<br>
LFO type:
<select id="lfotype" onchange="if (lfotype) lfotype.type = parseInt(event.target.value);">
<option selected="selected" value="0">SIN</option>
<option value="1">SQUARE</option>
<option value="2">SAWTOOTH</option>
<option value="3">TRIANGLE</option>
<select id="lfotype" onchange="if (lfotype) lfotype.type = event.target.value;">
<option selected="selected" value="sine">SINE</option>
<option value="square">SQUARE</option>
<option value="sawtooth">SAWTOOTH</option>
<option value="triangle">TRIANGLE</option>
</select><br>
LFO speed: <input id="lfo" type="range" min="0.25" max="20" step="0.25" value="3" style="height: 20px; width: 200px;" onInput="if (lfo) lfo.frequency.value = event.target.value;"><br>
LFO depth: <input id="lfodepth" type="range" min="0.0" max="1.0" step="0.1" value="1.0" style="height: 20px; width: 200px;" onInput="if (lfodepth) lfodepth.gain.value = event.target.value;">
Expand Down Expand Up @@ -155,11 +155,11 @@
</div>
<div id="lfowahControls">An LFO-controlled low-pass filter.<br>
LFO type:
<select id="lplfotype" onchange="if (lplfo) lplfo.type = parseInt(event.target.value);">
<option selected="selected" value="0">SIN</option>
<option value="1">SQUARE</option>
<option value="2">SAWTOOTH</option>
<option value="3">TRIANGLE</option>
<select id="lplfotype" onchange="if (lplfo) lplfo.type = event.target.value;">
<option selected="selected" value="sine">SINE</option>
<option value="square">SQUARE</option>
<option value="sawtooth">SAWTOOTH</option>
<option value="triangle">TRIANGLE</option>
</select><br>
LFO speed: <input id="lplfo" type="range" min="0.25" max="20" step="0.25" value="3" style="height: 20px; width: 200px;" onInput="if (lplfo) lplfo.frequency.value = event.target.value;"><br>
LFO depth: <input id="lplfodepth" type="range" min="0.0" max="1.0" step="0.1" value="1.0" style="height: 20px; width: 200px;" onInput="if (lplfodepth) lplfodepth.gain.value = 2500 * event.target.value;">
Expand Down
2 changes: 1 addition & 1 deletion js/effects.js
Expand Up @@ -461,7 +461,7 @@ function createGainLFO() {
var gain = audioContext.createGain();
var depth = audioContext.createGain();

osc.type = parseInt(document.getElementById("lfotype").value);
osc.type = document.getElementById("lfotype").value;
osc.frequency.value = parseFloat( document.getElementById("lfo").value );

gain.gain.value = 1.0; // to offset
Expand Down

0 comments on commit 4edd852

Please sign in to comment.