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' hide deprecated; | 5 import 'dart:_collection-dev' hide deprecated; |
6 import 'dart:html'; | 6 import 'dart:html'; |
7 import 'dart:html_common'; | 7 import 'dart:html_common'; |
8 import 'dart:nativewrappers'; | 8 import 'dart:nativewrappers'; |
9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
10 // DO NOT EDIT | 10 // DO NOT EDIT |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void noteGrainOn(num when, num grainOffset, num grainDuration) native "AudioBu
fferSourceNode_noteGrainOn_Callback"; | 223 void noteGrainOn(num when, num grainOffset, num grainDuration) native "AudioBu
fferSourceNode_noteGrainOn_Callback"; |
224 | 224 |
225 @DomName('AudioBufferSourceNode.noteOff') | 225 @DomName('AudioBufferSourceNode.noteOff') |
226 @DocsEditable() | 226 @DocsEditable() |
227 void noteOff(num when) native "AudioBufferSourceNode_noteOff_Callback"; | 227 void noteOff(num when) native "AudioBufferSourceNode_noteOff_Callback"; |
228 | 228 |
229 @DomName('AudioBufferSourceNode.noteOn') | 229 @DomName('AudioBufferSourceNode.noteOn') |
230 @DocsEditable() | 230 @DocsEditable() |
231 void noteOn(num when) native "AudioBufferSourceNode_noteOn_Callback"; | 231 void noteOn(num when) native "AudioBufferSourceNode_noteOn_Callback"; |
232 | 232 |
233 void start(num when, [num grainOffset, num grainDuration]) { | 233 void start([num when, num grainOffset, num grainDuration]) { |
234 if ((when is num || when == null) && grainOffset == null && grainDuration ==
null) { | 234 if (grainDuration != null) { |
235 _start_1(when); | 235 _start_1(when, grainOffset, grainDuration); |
236 return; | 236 return; |
237 } | 237 } |
238 if ((grainOffset is num || grainOffset == null) && (when is num || when == n
ull) && grainDuration == null) { | 238 if (grainOffset != null) { |
239 _start_2(when, grainOffset); | 239 _start_2(when, grainOffset); |
240 return; | 240 return; |
241 } | 241 } |
242 if ((grainDuration is num || grainDuration == null) && (grainOffset is num |
| grainOffset == null) && (when is num || when == null)) { | 242 if (when != null) { |
243 _start_3(when, grainOffset, grainDuration); | 243 _start_3(when); |
244 return; | 244 return; |
245 } | 245 } |
246 throw new ArgumentError("Incorrect number or type of arguments"); | 246 _start_4(); |
| 247 return; |
247 } | 248 } |
248 | 249 |
249 void _start_1(when) native "AudioBufferSourceNode__start_1_Callback"; | 250 void _start_1(when, grainOffset, grainDuration) native "AudioBufferSourceNode_
_start_1_Callback"; |
250 | 251 |
251 void _start_2(when, grainOffset) native "AudioBufferSourceNode__start_2_Callba
ck"; | 252 void _start_2(when, grainOffset) native "AudioBufferSourceNode__start_2_Callba
ck"; |
252 | 253 |
253 void _start_3(when, grainOffset, grainDuration) native "AudioBufferSourceNode_
_start_3_Callback"; | 254 void _start_3(when) native "AudioBufferSourceNode__start_3_Callback"; |
254 | 255 |
255 @DomName('AudioBufferSourceNode.stop') | 256 void _start_4() native "AudioBufferSourceNode__start_4_Callback"; |
256 @DocsEditable() | 257 |
257 void stop(num when) native "AudioBufferSourceNode_stop_Callback"; | 258 void stop([num when]) { |
| 259 if (when != null) { |
| 260 _stop_1(when); |
| 261 return; |
| 262 } |
| 263 _stop_2(); |
| 264 return; |
| 265 } |
| 266 |
| 267 void _stop_1(when) native "AudioBufferSourceNode__stop_1_Callback"; |
| 268 |
| 269 void _stop_2() native "AudioBufferSourceNode__stop_2_Callback"; |
258 | 270 |
259 /// Stream of `ended` events handled by this [AudioBufferSourceNode]. | 271 /// Stream of `ended` events handled by this [AudioBufferSourceNode]. |
260 @DomName('AudioBufferSourceNode.onended') | 272 @DomName('AudioBufferSourceNode.onended') |
261 @DocsEditable() | 273 @DocsEditable() |
262 @Experimental() // untriaged | 274 @Experimental() // untriaged |
263 Stream<Event> get onEnded => endedEvent.forTarget(this); | 275 Stream<Event> get onEnded => endedEvent.forTarget(this); |
264 | 276 |
265 } | 277 } |
266 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 278 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
267 // for details. All rights reserved. Use of this source code is governed by a | 279 // for details. All rights reserved. Use of this source code is governed by a |
(...skipping 12 matching lines...) Expand all Loading... |
280 * handlers that are not necessarily instances of [AudioContext]. | 292 * handlers that are not necessarily instances of [AudioContext]. |
281 * | 293 * |
282 * See [EventStreamProvider] for usage information. | 294 * See [EventStreamProvider] for usage information. |
283 */ | 295 */ |
284 @DomName('AudioContext.completeEvent') | 296 @DomName('AudioContext.completeEvent') |
285 @DocsEditable() | 297 @DocsEditable() |
286 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); | 298 static const EventStreamProvider<Event> completeEvent = const EventStreamProvi
der<Event>('complete'); |
287 | 299 |
288 @DomName('AudioContext.AudioContext') | 300 @DomName('AudioContext.AudioContext') |
289 @DocsEditable() | 301 @DocsEditable() |
290 factory AudioContext() => _create(); | 302 factory AudioContext() { |
| 303 return AudioContext._create_1(); |
| 304 } |
291 | 305 |
292 @DocsEditable() | 306 @DocsEditable() |
293 static AudioContext _create() native "AudioContext_constructorCallback"; | 307 static AudioContext _create_1() native "AudioContext__create_1constructorCallb
ack"; |
294 | 308 |
295 /// Checks if this type is supported on the current platform. | 309 /// Checks if this type is supported on the current platform. |
296 static bool get supported => true; | 310 static bool get supported => true; |
297 | 311 |
298 @DomName('AudioContext.activeSourceCount') | 312 @DomName('AudioContext.activeSourceCount') |
299 @DocsEditable() | 313 @DocsEditable() |
300 int get activeSourceCount native "AudioContext_activeSourceCount_Getter"; | 314 int get activeSourceCount native "AudioContext_activeSourceCount_Getter"; |
301 | 315 |
302 @DomName('AudioContext.currentTime') | 316 @DomName('AudioContext.currentTime') |
303 @DocsEditable() | 317 @DocsEditable() |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 443 |
430 @DomName('AudioContext.createPanner') | 444 @DomName('AudioContext.createPanner') |
431 @DocsEditable() | 445 @DocsEditable() |
432 PannerNode createPanner() native "AudioContext_createPanner_Callback"; | 446 PannerNode createPanner() native "AudioContext_createPanner_Callback"; |
433 | 447 |
434 @DomName('AudioContext.createPeriodicWave') | 448 @DomName('AudioContext.createPeriodicWave') |
435 @DocsEditable() | 449 @DocsEditable() |
436 @Experimental() // untriaged | 450 @Experimental() // untriaged |
437 PeriodicWave createPeriodicWave(Float32List real, Float32List imag) native "Au
dioContext_createPeriodicWave_Callback"; | 451 PeriodicWave createPeriodicWave(Float32List real, Float32List imag) native "Au
dioContext_createPeriodicWave_Callback"; |
438 | 452 |
439 ScriptProcessorNode createScriptProcessor(int bufferSize, [int numberOfInputCh
annels, int numberOfOutputChannels]) { | 453 ScriptProcessorNode createScriptProcessor([int bufferSize, int numberOfInputCh
annels, int numberOfOutputChannels]) { |
440 if (numberOfOutputChannels != null) { | 454 if (numberOfOutputChannels != null) { |
441 return _createScriptProcessor_1(bufferSize, numberOfInputChannels, numberO
fOutputChannels); | 455 return _createScriptProcessor_1(bufferSize, numberOfInputChannels, numberO
fOutputChannels); |
442 } | 456 } |
443 if (numberOfInputChannels != null) { | 457 if (numberOfInputChannels != null) { |
444 return _createScriptProcessor_2(bufferSize, numberOfInputChannels); | 458 return _createScriptProcessor_2(bufferSize, numberOfInputChannels); |
445 } | 459 } |
446 return _createScriptProcessor_3(bufferSize); | 460 if (bufferSize != null) { |
| 461 return _createScriptProcessor_3(bufferSize); |
| 462 } |
| 463 return _createScriptProcessor_4(); |
447 } | 464 } |
448 | 465 |
449 ScriptProcessorNode _createScriptProcessor_1(bufferSize, numberOfInputChannels
, numberOfOutputChannels) native "AudioContext__createScriptProcessor_1_Callback
"; | 466 ScriptProcessorNode _createScriptProcessor_1(bufferSize, numberOfInputChannels
, numberOfOutputChannels) native "AudioContext__createScriptProcessor_1_Callback
"; |
450 | 467 |
451 ScriptProcessorNode _createScriptProcessor_2(bufferSize, numberOfInputChannels
) native "AudioContext__createScriptProcessor_2_Callback"; | 468 ScriptProcessorNode _createScriptProcessor_2(bufferSize, numberOfInputChannels
) native "AudioContext__createScriptProcessor_2_Callback"; |
452 | 469 |
453 ScriptProcessorNode _createScriptProcessor_3(bufferSize) native "AudioContext_
_createScriptProcessor_3_Callback"; | 470 ScriptProcessorNode _createScriptProcessor_3(bufferSize) native "AudioContext_
_createScriptProcessor_3_Callback"; |
454 | 471 |
| 472 ScriptProcessorNode _createScriptProcessor_4() native "AudioContext__createScr
iptProcessor_4_Callback"; |
| 473 |
455 @DomName('AudioContext.createWaveShaper') | 474 @DomName('AudioContext.createWaveShaper') |
456 @DocsEditable() | 475 @DocsEditable() |
457 WaveShaperNode createWaveShaper() native "AudioContext_createWaveShaper_Callba
ck"; | 476 WaveShaperNode createWaveShaper() native "AudioContext_createWaveShaper_Callba
ck"; |
458 | 477 |
459 @DomName('AudioContext.decodeAudioData') | 478 @DomName('AudioContext.decodeAudioData') |
460 @DocsEditable() | 479 @DocsEditable() |
461 void _decodeAudioData(ByteBuffer audioData, AudioBufferCallback successCallbac
k, [AudioBufferCallback errorCallback]) native "AudioContext_decodeAudioData_Cal
lback"; | 480 void _decodeAudioData(ByteBuffer audioData, AudioBufferCallback successCallbac
k, [AudioBufferCallback errorCallback]) native "AudioContext_decodeAudioData_Cal
lback"; |
462 | 481 |
463 Future<AudioBuffer> decodeAudioData(ByteBuffer audioData) { | 482 Future<AudioBuffer> decodeAudioData(ByteBuffer audioData) { |
464 var completer = new Completer<AudioBuffer>(); | 483 var completer = new Completer<AudioBuffer>(); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 | 1170 |
1152 @DomName('OscillatorNode.noteOn') | 1171 @DomName('OscillatorNode.noteOn') |
1153 @DocsEditable() | 1172 @DocsEditable() |
1154 void noteOn(num when) native "OscillatorNode_noteOn_Callback"; | 1173 void noteOn(num when) native "OscillatorNode_noteOn_Callback"; |
1155 | 1174 |
1156 @DomName('OscillatorNode.setPeriodicWave') | 1175 @DomName('OscillatorNode.setPeriodicWave') |
1157 @DocsEditable() | 1176 @DocsEditable() |
1158 @Experimental() // untriaged | 1177 @Experimental() // untriaged |
1159 void setPeriodicWave(PeriodicWave periodicWave) native "OscillatorNode_setPeri
odicWave_Callback"; | 1178 void setPeriodicWave(PeriodicWave periodicWave) native "OscillatorNode_setPeri
odicWave_Callback"; |
1160 | 1179 |
1161 @DomName('OscillatorNode.start') | 1180 void start([num when]) { |
1162 @DocsEditable() | 1181 if (when != null) { |
1163 void start(num when) native "OscillatorNode_start_Callback"; | 1182 _start_1(when); |
| 1183 return; |
| 1184 } |
| 1185 _start_2(); |
| 1186 return; |
| 1187 } |
1164 | 1188 |
1165 @DomName('OscillatorNode.stop') | 1189 void _start_1(when) native "OscillatorNode__start_1_Callback"; |
1166 @DocsEditable() | 1190 |
1167 void stop(num when) native "OscillatorNode_stop_Callback"; | 1191 void _start_2() native "OscillatorNode__start_2_Callback"; |
| 1192 |
| 1193 void stop([num when]) { |
| 1194 if (when != null) { |
| 1195 _stop_1(when); |
| 1196 return; |
| 1197 } |
| 1198 _stop_2(); |
| 1199 return; |
| 1200 } |
| 1201 |
| 1202 void _stop_1(when) native "OscillatorNode__stop_1_Callback"; |
| 1203 |
| 1204 void _stop_2() native "OscillatorNode__stop_2_Callback"; |
1168 | 1205 |
1169 /// Stream of `ended` events handled by this [OscillatorNode]. | 1206 /// Stream of `ended` events handled by this [OscillatorNode]. |
1170 @DomName('OscillatorNode.onended') | 1207 @DomName('OscillatorNode.onended') |
1171 @DocsEditable() | 1208 @DocsEditable() |
1172 @Experimental() // untriaged | 1209 @Experimental() // untriaged |
1173 Stream<Event> get onEnded => endedEvent.forTarget(this); | 1210 Stream<Event> get onEnded => endedEvent.forTarget(this); |
1174 | 1211 |
1175 } | 1212 } |
1176 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1213 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
1177 // for details. All rights reserved. Use of this source code is governed by a | 1214 // for details. All rights reserved. Use of this source code is governed by a |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1354 | 1391 |
1355 @DomName('WaveShaperNode.oversample') | 1392 @DomName('WaveShaperNode.oversample') |
1356 @DocsEditable() | 1393 @DocsEditable() |
1357 String get oversample native "WaveShaperNode_oversample_Getter"; | 1394 String get oversample native "WaveShaperNode_oversample_Getter"; |
1358 | 1395 |
1359 @DomName('WaveShaperNode.oversample') | 1396 @DomName('WaveShaperNode.oversample') |
1360 @DocsEditable() | 1397 @DocsEditable() |
1361 void set oversample(String value) native "WaveShaperNode_oversample_Setter"; | 1398 void set oversample(String value) native "WaveShaperNode_oversample_Setter"; |
1362 | 1399 |
1363 } | 1400 } |
OLD | NEW |