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

Side by Side Diff: sdk/lib/web_audio/dart2js/web_audio_dart2js.dart

Issue 12892007: Support for callbacks on ScriptProcessNode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/web_audio/dartium/web_audio_dartium.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library dart.dom.web_audio; 1 library dart.dom.web_audio;
2 2
3 import 'dart:async'; 3 import 'dart:async';
4 import 'dart:collection'; 4 import 'dart:collection';
5 import 'dart:html'; 5 import 'dart:html';
6 import 'dart:html_common'; 6 import 'dart:html_common';
7 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS; 7 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS;
8 import 'dart:_foreign_helper' show JS; 8 import 'dart:_foreign_helper' show JS;
9 // DO NOT EDIT - unless you are editing documentation as per: 9 // DO NOT EDIT - unless you are editing documentation as per:
10 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation 10 // https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 var controller = new StreamController(); 837 var controller = new StreamController();
838 var callback = (audioData) { 838 var callback = (audioData) {
839 if (controller.hasSubscribers) { 839 if (controller.hasSubscribers) {
840 // This stream is a strange combination of broadcast and single 840 // This stream is a strange combination of broadcast and single
841 // subscriber streams. We only allow one listener, but if there is 841 // subscriber streams. We only allow one listener, but if there is
842 // no listener, we don't queue up events, we just drop them on the 842 // no listener, we don't queue up events, we just drop them on the
843 // floor. 843 // floor.
844 controller.add(audioData); 844 controller.add(audioData);
845 } 845 }
846 }; 846 };
847 JS('void', '#.onaudioprocess = #', this, 847 _setEventListener(callback);
848 convertDartClosureToJS(callback, 1));
849
850 _eventStream = controller.stream; 848 _eventStream = controller.stream;
851 } 849 }
852 return _eventStream; 850 return _eventStream;
853 } 851 }
854 852
853 _setEventListener(callback) {
854 JS('void', '#.onaudioprocess = #', this,
855 convertDartClosureToJS(callback, 1));
856 }
857
858
855 @DomName('ScriptProcessorNode.bufferSize') 859 @DomName('ScriptProcessorNode.bufferSize')
856 @DocsEditable 860 @DocsEditable
857 final int bufferSize; 861 final int bufferSize;
858 862
859 } 863 }
860 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 864 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
861 // for details. All rights reserved. Use of this source code is governed by a 865 // for details. All rights reserved. Use of this source code is governed by a
862 // BSD-style license that can be found in the LICENSE file. 866 // BSD-style license that can be found in the LICENSE file.
863 867
864 868
865 @DocsEditable 869 @DocsEditable
866 @DomName('WaveShaperNode') 870 @DomName('WaveShaperNode')
867 class WaveShaperNode extends AudioNode native "*WaveShaperNode" { 871 class WaveShaperNode extends AudioNode native "*WaveShaperNode" {
868 872
869 @DomName('WaveShaperNode.curve') 873 @DomName('WaveShaperNode.curve')
870 @DocsEditable 874 @DocsEditable
871 @Returns('Float32Array') 875 @Returns('Float32Array')
872 @Creates('Float32Array') 876 @Creates('Float32Array')
873 List<double> curve; 877 List<double> curve;
874 } 878 }
875 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 879 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
876 // for details. All rights reserved. Use of this source code is governed by a 880 // for details. All rights reserved. Use of this source code is governed by a
877 // BSD-style license that can be found in the LICENSE file. 881 // BSD-style license that can be found in the LICENSE file.
878 882
879 883
880 @DocsEditable 884 @DocsEditable
881 @DomName('WaveTable') 885 @DomName('WaveTable')
882 class WaveTable native "*WaveTable" { 886 class WaveTable native "*WaveTable" {
883 } 887 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/web_audio/dartium/web_audio_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698