OLD | NEW |
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:_collection-dev'; | 5 import 'dart:_collection-dev'; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'dart:html_common'; | 7 import 'dart:html_common'; |
8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
9 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS; | 9 import 'dart:_js_helper' show Creates, Returns, convertDartClosureToJS; |
10 import 'dart:_foreign_helper' show JS; | 10 import 'dart:_foreign_helper' show JS; |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 | 994 |
995 /** | 995 /** |
996 * Get a Stream that fires events when AudioProcessingEvents occur. | 996 * Get a Stream that fires events when AudioProcessingEvents occur. |
997 * This particular stream is special in that it only allows one listener to a | 997 * This particular stream is special in that it only allows one listener to a |
998 * given stream. Converting the returned Stream [asBroadcast] will likely ruin | 998 * given stream. Converting the returned Stream [asBroadcast] will likely ruin |
999 * the soft-real-time properties which which these events are fired and can | 999 * the soft-real-time properties which which these events are fired and can |
1000 * be processed. | 1000 * be processed. |
1001 */ | 1001 */ |
1002 Stream<AudioProcessingEvent> get onAudioProcess { | 1002 Stream<AudioProcessingEvent> get onAudioProcess { |
1003 if (_eventStream == null) { | 1003 if (_eventStream == null) { |
1004 var controller = new StreamController(); | 1004 var controller = new StreamController(sync: true); |
1005 var callback = (audioData) { | 1005 var callback = (audioData) { |
1006 if (controller.hasListener) { | 1006 if (controller.hasListener) { |
1007 // This stream is a strange combination of broadcast and single | 1007 // This stream is a strange combination of broadcast and single |
1008 // subscriber streams. We only allow one listener, but if there is | 1008 // subscriber streams. We only allow one listener, but if there is |
1009 // no listener, we don't queue up events, we just drop them on the | 1009 // no listener, we don't queue up events, we just drop them on the |
1010 // floor. | 1010 // floor. |
1011 controller.add(audioData); | 1011 controller.add(audioData); |
1012 } | 1012 } |
1013 }; | 1013 }; |
1014 _setEventListener(callback); | 1014 _setEventListener(callback); |
1015 _eventStream = controller.stream; | 1015 _eventStream = controller.stream; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1047 // for details. All rights reserved. Use of this source code is governed by a | 1047 // for details. All rights reserved. Use of this source code is governed by a |
1048 // BSD-style license that can be found in the LICENSE file. | 1048 // BSD-style license that can be found in the LICENSE file. |
1049 | 1049 |
1050 | 1050 |
1051 @DocsEditable | 1051 @DocsEditable |
1052 @DomName('WaveTable') | 1052 @DomName('WaveTable') |
1053 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#WaveTab
le-section | 1053 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#WaveTab
le-section |
1054 @Experimental | 1054 @Experimental |
1055 class WaveTable native "WaveTable" { | 1055 class WaveTable native "WaveTable" { |
1056 } | 1056 } |
OLD | NEW |