Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1386)

Unified Diff: src/site/samples/webaudio/example/filter_sample.dart

Issue 30853002: Added several more HTML5 samples (Closed) Base URL: https://github.com/dart-lang/dartlang.org.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/site/samples/webaudio/example/filter_sample.dart
diff --git a/src/site/samples/webaudio/example/filter_sample.dart b/src/site/samples/webaudio/example/filter_sample.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d32b875974b839d45e5283eedddbffc9e3131397
--- /dev/null
+++ b/src/site/samples/webaudio/example/filter_sample.dart
@@ -0,0 +1 @@
+import "dart:web_audio" as m;import "dart:html" as o;import "dart:math" as EB;class FB{static const GB="Chrome";static const HB="Firefox";static const IB="Internet Explorer";static const JB="Safari";final BB;final minimumVersion;const FB(this.BB,[this.minimumVersion]);}class KB{const KB();}class LB{final name;const LB(this.name);}class MB{const MB();}class NB{const NB();}typedef v( bufferList);class OB{var i;var n;var u;var QB=0;var RB;OB(this.i,this.n,this.u){RB=new List<m.AudioBuffer>(n.length);} load(){for(var g=0;g<n.length;g++ ){SB(n[g],g);}} SB( h, j){var g=new o.HttpRequest();g.open("GET",h,async:true);g.responseType="arraybuffer";g.onLoad.listen((l)=>TB(g,h,j));g.onError.listen((l)=>o.window.alert("BufferLoader: XHR error"));g.send();} TB( h, l, j){i.decodeAudioData(h.response).then(( g){if(g==null){o.window.alert("Error decoding file data: ${l}");return;}RB[j]=g;if( ++QB==n.length)u(RB);});}}class AB{var q;var i;static const t=const{"example":"sounds/example.ogg"};AB(){q=new Map<String,m.AudioBuffer>();i=new m.AudioContext();UB();} UB(){var j=t.keys.toList();var CB=t.values.toList();var s=new OB(i,CB,( h){for(var g=0;g<h.length;g++ ){var DB=h[g];var l=j[g];q[l]=DB;}});s.load();}}class PB{final VB=5000;final WB=7000;final XB=30;var YB=false;var k;var ZB;var aB;PB(this.k){o.query("#play-pause-button").onClick.listen(( g){bB();});o.query("#enable-filter-checkbox").onChange.listen(( g){var j=(g.currentTarget as o.InputElement).checked;cB(j);});o.query("#frequency-range").onChange.listen(( g){var h=double.parse((g.currentTarget as o.InputElement).value);dB(h);});o.query("#quality-range").onChange.listen(( g){var h=double.parse((g.currentTarget as o.InputElement).value);eB(h);});} fB(){ZB=k.i.createBufferSource();ZB.buffer=k.q['example'];aB=k.i.createBiquadFilter();aB.type="lowpass";aB.frequency.value=VB;ZB.connectNode(aB,0,0);aB.connectNode(k.i.destination,0,0);ZB.start(0);ZB.loop=true;} gB(){ZB.stop(0);} bB(){YB?gB():fB();YB=!YB;} cB( g){ZB.disconnect(0);aB.disconnect(0);if(g){ZB.connectNode(aB,0,0);aB.connectNode(k.i.destination,0,0);}else{ZB.connectNode(k.i.destination,0,0);}} dB( l){var h=40;var g=k.i.sampleRate/2;var j=EB.log(g/h)/EB.LN2;var s=EB.pow(2,j*(l-1.0));aB.frequency.value=g*s;} eB( g){aB.Q.value=g*XB;}} main(){new PB(new AB());}
« no previous file with comments | « src/site/samples/video/example/video.dart.js ('k') | src/site/samples/webaudio/example/filter_sample.dart.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698