javascript - JQuery knob, input slider and web audio oscillator connecting but not working -
i have web audio api , jquery knob library kind of working... not quite. knob slider controls input slider value doesn't seem passed param want affect.
for simple example see here:
code:
<input id="gain1" type="range" class="dial" > <script> document.getelementbyid('gain1').addeventlistener('change', function() { gainnode.gain.value = this.value; }); $(function() { var value = document.getelementbyid("gain1").value; $(".dial").knob({ change : function (value) { } }) }); context = new webkitaudiocontext(); //create oscillator object & params oscillator = context.createoscillator(), oscillator.type = 2; oscillator.frequency.value = 200; //create gain object & params gainnode = context.creategainnode(); gainnode.gain.value = 1; //connect devices oscillator.connect(gainnode); gainnode.connect(context.destination); oscillator.start(0); </script>
$(".dial").knob({ change : function (value) { gainnode.gain.value = value; } })
Comments
Post a Comment