| OLD | NEW |
| 1 /** | 1 /** |
| 2 * High-fidelity audio programming in the browser. | 2 * High-fidelity audio programming in the browser. |
| 3 */ | 3 */ |
| 4 library dart.dom.web_audio; | 4 library dart.dom.web_audio; |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:_collection-dev' hide deprecated; | 8 import 'dart:_collection-dev' hide deprecated; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 import 'dart:html_common'; | 10 import 'dart:html_common'; |
| (...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1067 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1068 // for details. All rights reserved. Use of this source code is governed by a | 1068 // for details. All rights reserved. Use of this source code is governed by a |
| 1069 // BSD-style license that can be found in the LICENSE file. | 1069 // BSD-style license that can be found in the LICENSE file. |
| 1070 | 1070 |
| 1071 | 1071 |
| 1072 @DocsEditable() | 1072 @DocsEditable() |
| 1073 @DomName('PeriodicWave') | 1073 @DomName('PeriodicWave') |
| 1074 @Experimental() // untriaged | 1074 @Experimental() // untriaged |
| 1075 class PeriodicWave extends Interceptor native "PeriodicWave" { | 1075 class PeriodicWave extends Interceptor native "PeriodicWave" { |
| 1076 } | 1076 } |
| 1077 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1077 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1078 // for details. All rights reserved. Use of this source code is governed by a | 1078 // for details. All rights reserved. Use of this source code is governed by a |
| 1079 // BSD-style license that can be found in the LICENSE file. | 1079 // BSD-style license that can be found in the LICENSE file. |
| 1080 | 1080 |
| 1081 | 1081 |
| 1082 @DocsEditable() |
| 1082 @DomName('ScriptProcessorNode') | 1083 @DomName('ScriptProcessorNode') |
| 1083 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ScriptP
rocessorNode | 1084 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#ScriptP
rocessorNode |
| 1084 @Experimental() | 1085 @Experimental() |
| 1085 class ScriptProcessorNode extends AudioNode native "ScriptProcessorNode,JavaScri
ptAudioNode" { | 1086 class ScriptProcessorNode extends AudioNode native "ScriptProcessorNode,JavaScri
ptAudioNode" { |
| 1086 Stream<AudioProcessingEvent> _eventStream; | 1087 // To suppress missing implicit constructor warnings. |
| 1088 factory ScriptProcessorNode._() { throw new UnsupportedError("Not supported");
} |
| 1089 |
| 1090 @DomName('ScriptProcessorNode.audioprocessEvent') |
| 1091 @DocsEditable() |
| 1092 @Experimental() // untriaged |
| 1093 static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent = con
st EventStreamProvider<AudioProcessingEvent>('audioprocess'); |
| 1094 |
| 1095 @DomName('ScriptProcessorNode.bufferSize') |
| 1096 @DocsEditable() |
| 1097 final int bufferSize; |
| 1087 | 1098 |
| 1088 /** | 1099 /** |
| 1089 * Get a Stream that fires events when AudioProcessingEvents occur. | 1100 * Get a Stream that fires events when AudioProcessingEvents occur. |
| 1090 * This particular stream is special in that it only allows one listener to a | 1101 * This particular stream is special in that it only allows one listener to a |
| 1091 * given stream. Converting the returned Stream [asBroadcast] will likely ruin | 1102 * given stream. Converting the returned Stream [asBroadcast] will likely ruin |
| 1092 * the soft-real-time properties which which these events are fired and can | 1103 * the soft-real-time properties which which these events are fired and can |
| 1093 * be processed. | 1104 * be processed. |
| 1094 */ | 1105 */ |
| 1095 Stream<AudioProcessingEvent> get onAudioProcess { | 1106 @DomName('ScriptProcessorNode.onaudioprocess') |
| 1096 if (_eventStream == null) { | |
| 1097 var controller = new StreamController(sync: true); | |
| 1098 var callback = (audioData) { | |
| 1099 if (controller.hasListener) { | |
| 1100 // This stream is a strange combination of broadcast and single | |
| 1101 // subscriber streams. We only allow one listener, but if there is | |
| 1102 // no listener, we don't queue up events, we just drop them on the | |
| 1103 // floor. | |
| 1104 controller.add(audioData); | |
| 1105 } | |
| 1106 }; | |
| 1107 _setEventListener(callback); | |
| 1108 _eventStream = controller.stream; | |
| 1109 } | |
| 1110 return _eventStream; | |
| 1111 } | |
| 1112 | |
| 1113 _setEventListener(callback) { | |
| 1114 JS('void', '#.onaudioprocess = #', this, | |
| 1115 convertDartClosureToJS(callback, 1)); | |
| 1116 } | |
| 1117 | |
| 1118 // To suppress missing implicit constructor warnings. | |
| 1119 factory ScriptProcessorNode._() { throw new UnsupportedError("Not supported");
} | |
| 1120 | |
| 1121 @DomName('ScriptProcessorNode.bufferSize') | |
| 1122 @DocsEditable() | 1107 @DocsEditable() |
| 1123 final int bufferSize; | 1108 @Experimental() // untriaged |
| 1124 | 1109 Stream<AudioProcessingEvent> get onAudioProcess => audioProcessEvent.forTarget
(this); |
| 1125 } | 1110 } |
| 1126 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1111 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 1127 // for details. All rights reserved. Use of this source code is governed by a | 1112 // for details. All rights reserved. Use of this source code is governed by a |
| 1128 // BSD-style license that can be found in the LICENSE file. | 1113 // BSD-style license that can be found in the LICENSE file. |
| 1129 | 1114 |
| 1130 | 1115 |
| 1131 @DocsEditable() | 1116 @DocsEditable() |
| 1132 @DomName('WaveShaperNode') | 1117 @DomName('WaveShaperNode') |
| 1133 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#dfn-Wav
eShaperNode | 1118 // https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#dfn-Wav
eShaperNode |
| 1134 @Experimental() | 1119 @Experimental() |
| 1135 class WaveShaperNode extends AudioNode native "WaveShaperNode" { | 1120 class WaveShaperNode extends AudioNode native "WaveShaperNode" { |
| 1136 // To suppress missing implicit constructor warnings. | 1121 // To suppress missing implicit constructor warnings. |
| 1137 factory WaveShaperNode._() { throw new UnsupportedError("Not supported"); } | 1122 factory WaveShaperNode._() { throw new UnsupportedError("Not supported"); } |
| 1138 | 1123 |
| 1139 @DomName('WaveShaperNode.curve') | 1124 @DomName('WaveShaperNode.curve') |
| 1140 @DocsEditable() | 1125 @DocsEditable() |
| 1141 Float32List curve; | 1126 Float32List curve; |
| 1142 | 1127 |
| 1143 @DomName('WaveShaperNode.oversample') | 1128 @DomName('WaveShaperNode.oversample') |
| 1144 @DocsEditable() | 1129 @DocsEditable() |
| 1145 String oversample; | 1130 String oversample; |
| 1146 } | 1131 } |
| OLD | NEW |