-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
web_audio_dart2js.dart
1370 lines (1089 loc) · 45.7 KB
/
web_audio_dart2js.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/// High-fidelity audio programming in the browser.
///
/// > [!Note]
/// > New projects should prefer to use
/// > [package:web](https://pub.dev/packages/web). For existing projects, see
/// > our [migration guide](https://dart.dev/go/package-web).
///
/// {@category Web (Legacy)}
library dart.dom.web_audio;
import 'dart:async';
import 'dart:collection' hide LinkedList, LinkedListEntry;
import 'dart:_internal' show FixedLengthListMixin;
import 'dart:html';
import 'dart:html_common';
import 'dart:_native_typed_data';
import 'dart:typed_data';
import 'dart:_foreign_helper' show JS;
import 'dart:_interceptors' show JavaScriptObject;
// DO NOT EDIT - unless you are editing documentation as per:
// https://code.google.com/p/dart/wiki/ContributingHTMLDocumentation
// Auto-generated dart:audio library.
import 'dart:_js_helper'
show
Creates,
JavaScriptIndexingBehavior,
JSName,
Native,
Returns,
convertDartClosureToJS;
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AnalyserNode,RealtimeAnalyserNode")
class AnalyserNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory AnalyserNode._() {
throw new UnsupportedError("Not supported");
}
factory AnalyserNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return AnalyserNode._create_1(context, options_1);
}
return AnalyserNode._create_2(context);
}
static AnalyserNode _create_1(context, options) =>
JS('AnalyserNode', 'new AnalyserNode(#,#)', context, options);
static AnalyserNode _create_2(context) =>
JS('AnalyserNode', 'new AnalyserNode(#)', context);
int? get fftSize native;
set fftSize(int? value) native;
int? get frequencyBinCount native;
num? get maxDecibels native;
set maxDecibels(num? value) native;
num? get minDecibels native;
set minDecibels(num? value) native;
num? get smoothingTimeConstant native;
set smoothingTimeConstant(num? value) native;
void getByteFrequencyData(Uint8List array) native;
void getByteTimeDomainData(Uint8List array) native;
void getFloatFrequencyData(Float32List array) native;
void getFloatTimeDomainData(Float32List array) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioBuffer")
class AudioBuffer extends JavaScriptObject {
// To suppress missing implicit constructor warnings.
factory AudioBuffer._() {
throw new UnsupportedError("Not supported");
}
factory AudioBuffer(Map options) {
var options_1 = convertDartToNative_Dictionary(options);
return AudioBuffer._create_1(options_1);
}
static AudioBuffer _create_1(options) =>
JS('AudioBuffer', 'new AudioBuffer(#)', options);
num? get duration native;
int? get length native;
int? get numberOfChannels native;
num? get sampleRate native;
void copyFromChannel(Float32List destination, int channelNumber,
[int? startInChannel]) native;
void copyToChannel(Float32List source, int channelNumber,
[int? startInChannel]) native;
Float32List getChannelData(int channelIndex) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@Native("AudioBufferSourceNode")
class AudioBufferSourceNode extends AudioScheduledSourceNode {
// To suppress missing implicit constructor warnings.
factory AudioBufferSourceNode._() {
throw new UnsupportedError("Not supported");
}
factory AudioBufferSourceNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return AudioBufferSourceNode._create_1(context, options_1);
}
return AudioBufferSourceNode._create_2(context);
}
static AudioBufferSourceNode _create_1(context, options) => JS(
'AudioBufferSourceNode',
'new AudioBufferSourceNode(#,#)',
context,
options);
static AudioBufferSourceNode _create_2(context) =>
JS('AudioBufferSourceNode', 'new AudioBufferSourceNode(#)', context);
AudioBuffer? get buffer native;
set buffer(AudioBuffer? value) native;
AudioParam? get detune native;
bool? get loop native;
set loop(bool? value) native;
num? get loopEnd native;
set loopEnd(num? value) native;
num? get loopStart native;
set loopStart(num? value) native;
AudioParam? get playbackRate native;
void start([num? when, num? grainOffset, num? grainDuration]) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@SupportedBrowser(SupportedBrowser.CHROME)
@SupportedBrowser(SupportedBrowser.FIREFOX)
@Native("AudioContext,webkitAudioContext")
class AudioContext extends BaseAudioContext {
// To suppress missing implicit constructor warnings.
factory AudioContext._() {
throw new UnsupportedError("Not supported");
}
/// Checks if this type is supported on the current platform.
static bool get supported =>
JS('bool', '!!(window.AudioContext || window.webkitAudioContext)');
num? get baseLatency native;
Future close() => promiseToFuture(JS("", "#.close()", this));
Map getOutputTimestamp() {
return convertNativeToDart_Dictionary(_getOutputTimestamp_1())!;
}
@JSName('getOutputTimestamp')
_getOutputTimestamp_1() native;
Future suspend() => promiseToFuture(JS("", "#.suspend()", this));
factory AudioContext() => JS('AudioContext',
'new (window.AudioContext || window.webkitAudioContext)()');
GainNode createGain() {
if (JS('bool', '#.createGain !== undefined', this)) {
return JS('GainNode', '#.createGain()', this);
} else {
return JS('GainNode', '#.createGainNode()', this);
}
}
ScriptProcessorNode createScriptProcessor(
[int? bufferSize,
int? numberOfInputChannels,
int? numberOfOutputChannels]) {
var function = JS(
'=Object',
'#.createScriptProcessor || '
'#.createJavaScriptNode',
this,
this);
if (numberOfOutputChannels != null) {
return JS('ScriptProcessorNode', '#.call(#, #, #, #)', function, this,
bufferSize, numberOfInputChannels, numberOfOutputChannels);
} else if (numberOfInputChannels != null) {
return JS('ScriptProcessorNode', '#.call(#, #, #)', function, this,
bufferSize, numberOfInputChannels);
} else if (bufferSize != null) {
return JS(
'ScriptProcessorNode', '#.call(#, #)', function, this, bufferSize);
} else {
return JS('ScriptProcessorNode', '#.call(#)', function, this);
}
}
Future<AudioBuffer> decodeAudioData(ByteBuffer audioData,
[DecodeSuccessCallback? successCallback,
DecodeErrorCallback? errorCallback]) {
// Both callbacks need to be provided if they're being used.
assert((successCallback == null) == (errorCallback == null));
// `decodeAudioData` can exist either in the older callback syntax or the
// newer `Promise`-based syntax that also accepts callbacks. In the former,
// we synthesize a `Future` to be consistent.
// For more details:
// https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/decodeAudioData
// https://www.w3.org/TR/webaudio/#dom-baseaudiocontext-decodeaudiodata
final completer = Completer<Object>();
var errorInCallbackIsNull = false;
void success(AudioBuffer decodedData) {
completer.complete(decodedData);
successCallback!.call(decodedData);
}
final nullErrorString =
'[AudioContext.decodeAudioData] completed with a null error.';
void error(DomException? error) {
// Safari has a bug where it may return null for the error callback. In
// the case where the Safari version still returns a `Promise` and the
// error is not null after the `Promise` is finished, the error callback
// is called instead in the `Promise`'s `catch` block. Otherwise, and in
// the case where a `Promise` is not returned by the API at all, the
// callback never gets called (for backwards compatibility, it can not
// accept null). Instead, the `Future` completes with a custom string,
// indicating that null was given.
// https://github.com/mdn/webaudio-examples/issues/5
if (error != null) {
// Note that we `complete` and not `completeError`. This is to make sure
// that errors in the `Completer` are not thrown if the call gets back
// a `Promise`.
completer.complete(error);
errorCallback!.call(error);
} else {
completer.complete(nullErrorString);
errorInCallbackIsNull = true;
}
}
var decodeResult;
if (successCallback == null) {
decodeResult =
JS("creates:AudioBuffer;", "#.decodeAudioData(#)", this, audioData);
} else {
decodeResult = JS(
"creates:AudioBuffer;",
"#.decodeAudioData(#, #, #)",
this,
audioData,
convertDartClosureToJS(success, 1),
convertDartClosureToJS(error, 1));
}
if (decodeResult != null) {
// Promise-based syntax.
return promiseToFuture<AudioBuffer>(decodeResult).catchError((error) {
// If the error was null in the callback, but no longer is now that the
// `Promise` is finished, call the error callback. If it's still null,
// throw the error string. This is to handle the aforementioned bug in
// Safari.
if (errorInCallbackIsNull) {
if (error != null) {
errorCallback?.call(error);
} else {
throw nullErrorString;
}
}
throw error;
});
}
// Callback-based syntax. We use the above completer to synthesize a
// `Future` from the callback values. Since we don't use `completeError`
// above, `then` is used to simulate an error.
return completer.future.then((value) {
if (value is AudioBuffer) return value;
throw value;
});
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioDestinationNode")
class AudioDestinationNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory AudioDestinationNode._() {
throw new UnsupportedError("Not supported");
}
int? get maxChannelCount native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioListener")
class AudioListener extends JavaScriptObject {
// To suppress missing implicit constructor warnings.
factory AudioListener._() {
throw new UnsupportedError("Not supported");
}
AudioParam? get forwardX native;
AudioParam? get forwardY native;
AudioParam? get forwardZ native;
AudioParam? get positionX native;
AudioParam? get positionY native;
AudioParam? get positionZ native;
AudioParam? get upX native;
AudioParam? get upY native;
AudioParam? get upZ native;
void setOrientation(num x, num y, num z, num xUp, num yUp, num zUp) native;
void setPosition(num x, num y, num z) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioNode")
class AudioNode extends EventTarget {
// To suppress missing implicit constructor warnings.
factory AudioNode._() {
throw new UnsupportedError("Not supported");
}
int? get channelCount native;
set channelCount(int? value) native;
String? get channelCountMode native;
set channelCountMode(String? value) native;
String? get channelInterpretation native;
set channelInterpretation(String? value) native;
BaseAudioContext? get context native;
int? get numberOfInputs native;
int? get numberOfOutputs native;
@JSName('connect')
AudioNode? _connect(destination, [int? output, int? input]) native;
void disconnect([destination_OR_output, int? output, int? input]) native;
void connectNode(AudioNode destination, [int output = 0, int input = 0]) {
_connect(destination, output, input);
}
void connectParam(AudioParam destination, [int output = 0]) {
_connect(destination, output);
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioParam")
class AudioParam extends JavaScriptObject {
// To suppress missing implicit constructor warnings.
factory AudioParam._() {
throw new UnsupportedError("Not supported");
}
num? get defaultValue native;
num? get maxValue native;
num? get minValue native;
num? get value native;
set value(num? value) native;
AudioParam cancelAndHoldAtTime(num startTime) native;
AudioParam cancelScheduledValues(num startTime) native;
AudioParam exponentialRampToValueAtTime(num value, num time) native;
AudioParam linearRampToValueAtTime(num value, num time) native;
AudioParam setTargetAtTime(num target, num time, num timeConstant) native;
AudioParam setValueAtTime(num value, num time) native;
AudioParam setValueCurveAtTime(List<num> values, num time, num duration)
native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioParamMap")
class AudioParamMap extends JavaScriptObject with MapMixin<String, dynamic> {
// To suppress missing implicit constructor warnings.
factory AudioParamMap._() {
throw new UnsupportedError("Not supported");
}
Map? _getItem(String key) =>
convertNativeToDart_Dictionary(JS('', '#.get(#)', this, key));
void addAll(Map<String, dynamic> other) {
throw new UnsupportedError("Not supported");
}
bool containsValue(dynamic value) => values.any((e) => e == value);
bool containsKey(dynamic key) => _getItem(key) != null;
Map? operator [](dynamic key) => _getItem(key);
void forEach(void f(String key, dynamic value)) {
var entries = JS('', '#.entries()', this);
while (true) {
var entry = JS('', '#.next()', entries);
if (JS('bool', '#.done', entry)) return;
f(JS('String', '#.value[0]', entry),
convertNativeToDart_Dictionary(JS('', '#.value[1]', entry)));
}
}
Iterable<String> get keys {
final keys = <String>[];
forEach((k, v) => keys.add(k));
return keys;
}
Iterable<Map> get values {
final values = <Map>[];
forEach((k, v) => values.add(v));
return values;
}
int get length => JS('int', '#.size', this);
bool get isEmpty => length == 0;
bool get isNotEmpty => !isEmpty;
void operator []=(String key, dynamic value) {
throw new UnsupportedError("Not supported");
}
dynamic putIfAbsent(String key, dynamic ifAbsent()) {
throw new UnsupportedError("Not supported");
}
String remove(dynamic key) {
throw new UnsupportedError("Not supported");
}
void clear() {
throw new UnsupportedError("Not supported");
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioProcessingEvent")
class AudioProcessingEvent extends Event {
// To suppress missing implicit constructor warnings.
factory AudioProcessingEvent._() {
throw new UnsupportedError("Not supported");
}
factory AudioProcessingEvent(String type, Map eventInitDict) {
var eventInitDict_1 = convertDartToNative_Dictionary(eventInitDict);
return AudioProcessingEvent._create_1(type, eventInitDict_1);
}
static AudioProcessingEvent _create_1(type, eventInitDict) => JS(
'AudioProcessingEvent',
'new AudioProcessingEvent(#,#)',
type,
eventInitDict);
AudioBuffer? get inputBuffer native;
AudioBuffer? get outputBuffer native;
num? get playbackTime native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioScheduledSourceNode")
class AudioScheduledSourceNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory AudioScheduledSourceNode._() {
throw new UnsupportedError("Not supported");
}
static const EventStreamProvider<Event> endedEvent =
const EventStreamProvider<Event>('ended');
@JSName('start')
void start2([num? when]) native;
void stop([num? when]) native;
Stream<Event> get onEnded => endedEvent.forTarget(this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioTrack")
class AudioTrack extends JavaScriptObject {
// To suppress missing implicit constructor warnings.
factory AudioTrack._() {
throw new UnsupportedError("Not supported");
}
bool? get enabled native;
set enabled(bool? value) native;
String? get id native;
String? get kind native;
String? get label native;
String? get language native;
SourceBuffer? get sourceBuffer native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioTrackList")
class AudioTrackList extends EventTarget {
// To suppress missing implicit constructor warnings.
factory AudioTrackList._() {
throw new UnsupportedError("Not supported");
}
static const EventStreamProvider<Event> changeEvent =
const EventStreamProvider<Event>('change');
int? get length native;
AudioTrack __getter__(int index) native;
AudioTrack? getTrackById(String id) native;
Stream<Event> get onChange => changeEvent.forTarget(this);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioWorkletGlobalScope")
class AudioWorkletGlobalScope extends WorkletGlobalScope {
// To suppress missing implicit constructor warnings.
factory AudioWorkletGlobalScope._() {
throw new UnsupportedError("Not supported");
}
num? get currentTime native;
num? get sampleRate native;
void registerProcessor(String name, Object processorConstructor) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioWorkletNode")
class AudioWorkletNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory AudioWorkletNode._() {
throw new UnsupportedError("Not supported");
}
factory AudioWorkletNode(BaseAudioContext context, String name,
[Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return AudioWorkletNode._create_1(context, name, options_1);
}
return AudioWorkletNode._create_2(context, name);
}
static AudioWorkletNode _create_1(context, name, options) => JS(
'AudioWorkletNode',
'new AudioWorkletNode(#,#,#)',
context,
name,
options);
static AudioWorkletNode _create_2(context, name) =>
JS('AudioWorkletNode', 'new AudioWorkletNode(#,#)', context, name);
AudioParamMap? get parameters native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("AudioWorkletProcessor")
class AudioWorkletProcessor extends JavaScriptObject {
// To suppress missing implicit constructor warnings.
factory AudioWorkletProcessor._() {
throw new UnsupportedError("Not supported");
}
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("BaseAudioContext")
class BaseAudioContext extends EventTarget {
// To suppress missing implicit constructor warnings.
factory BaseAudioContext._() {
throw new UnsupportedError("Not supported");
}
num? get currentTime native;
AudioDestinationNode? get destination native;
AudioListener? get listener native;
num? get sampleRate native;
String? get state native;
AnalyserNode createAnalyser() native;
BiquadFilterNode createBiquadFilter() native;
AudioBuffer createBuffer(
int numberOfChannels, int numberOfFrames, num sampleRate) native;
AudioBufferSourceNode createBufferSource() native;
ChannelMergerNode createChannelMerger([int? numberOfInputs]) native;
ChannelSplitterNode createChannelSplitter([int? numberOfOutputs]) native;
ConstantSourceNode createConstantSource() native;
ConvolverNode createConvolver() native;
DelayNode createDelay([num? maxDelayTime]) native;
DynamicsCompressorNode createDynamicsCompressor() native;
GainNode createGain() native;
@JSName('createIIRFilter')
IirFilterNode createIirFilter(List<num> feedForward, List<num> feedBack)
native;
MediaElementAudioSourceNode createMediaElementSource(
MediaElement mediaElement) native;
MediaStreamAudioDestinationNode createMediaStreamDestination() native;
MediaStreamAudioSourceNode createMediaStreamSource(MediaStream mediaStream)
native;
OscillatorNode createOscillator() native;
PannerNode createPanner() native;
PeriodicWave createPeriodicWave(List<num> real, List<num> imag,
[Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return _createPeriodicWave_1(real, imag, options_1);
}
return _createPeriodicWave_2(real, imag);
}
@JSName('createPeriodicWave')
PeriodicWave _createPeriodicWave_1(List<num> real, List<num> imag, options)
native;
@JSName('createPeriodicWave')
PeriodicWave _createPeriodicWave_2(List<num> real, List<num> imag) native;
ScriptProcessorNode createScriptProcessor(
[int? bufferSize,
int? numberOfInputChannels,
int? numberOfOutputChannels]) native;
StereoPannerNode createStereoPanner() native;
WaveShaperNode createWaveShaper() native;
Future<AudioBuffer> decodeAudioData(ByteBuffer audioData,
[DecodeSuccessCallback? successCallback,
DecodeErrorCallback? errorCallback]) =>
promiseToFuture<AudioBuffer>(JS(
"creates:AudioBuffer;",
"#.decodeAudioData(#, #, #)",
this,
audioData,
successCallback,
errorCallback));
Future resume() => promiseToFuture(JS("", "#.resume()", this));
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("BiquadFilterNode")
class BiquadFilterNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory BiquadFilterNode._() {
throw new UnsupportedError("Not supported");
}
factory BiquadFilterNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return BiquadFilterNode._create_1(context, options_1);
}
return BiquadFilterNode._create_2(context);
}
static BiquadFilterNode _create_1(context, options) =>
JS('BiquadFilterNode', 'new BiquadFilterNode(#,#)', context, options);
static BiquadFilterNode _create_2(context) =>
JS('BiquadFilterNode', 'new BiquadFilterNode(#)', context);
AudioParam? get Q native;
AudioParam? get detune native;
AudioParam? get frequency native;
AudioParam? get gain native;
String? get type native;
set type(String? value) native;
void getFrequencyResponse(Float32List frequencyHz, Float32List magResponse,
Float32List phaseResponse) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("ChannelMergerNode,AudioChannelMerger")
class ChannelMergerNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory ChannelMergerNode._() {
throw new UnsupportedError("Not supported");
}
factory ChannelMergerNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return ChannelMergerNode._create_1(context, options_1);
}
return ChannelMergerNode._create_2(context);
}
static ChannelMergerNode _create_1(context, options) =>
JS('ChannelMergerNode', 'new ChannelMergerNode(#,#)', context, options);
static ChannelMergerNode _create_2(context) =>
JS('ChannelMergerNode', 'new ChannelMergerNode(#)', context);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("ChannelSplitterNode,AudioChannelSplitter")
class ChannelSplitterNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory ChannelSplitterNode._() {
throw new UnsupportedError("Not supported");
}
factory ChannelSplitterNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return ChannelSplitterNode._create_1(context, options_1);
}
return ChannelSplitterNode._create_2(context);
}
static ChannelSplitterNode _create_1(context, options) => JS(
'ChannelSplitterNode', 'new ChannelSplitterNode(#,#)', context, options);
static ChannelSplitterNode _create_2(context) =>
JS('ChannelSplitterNode', 'new ChannelSplitterNode(#)', context);
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("ConstantSourceNode")
class ConstantSourceNode extends AudioScheduledSourceNode {
// To suppress missing implicit constructor warnings.
factory ConstantSourceNode._() {
throw new UnsupportedError("Not supported");
}
factory ConstantSourceNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return ConstantSourceNode._create_1(context, options_1);
}
return ConstantSourceNode._create_2(context);
}
static ConstantSourceNode _create_1(context, options) =>
JS('ConstantSourceNode', 'new ConstantSourceNode(#,#)', context, options);
static ConstantSourceNode _create_2(context) =>
JS('ConstantSourceNode', 'new ConstantSourceNode(#)', context);
AudioParam? get offset native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("ConvolverNode")
class ConvolverNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory ConvolverNode._() {
throw new UnsupportedError("Not supported");
}
factory ConvolverNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return ConvolverNode._create_1(context, options_1);
}
return ConvolverNode._create_2(context);
}
static ConvolverNode _create_1(context, options) =>
JS('ConvolverNode', 'new ConvolverNode(#,#)', context, options);
static ConvolverNode _create_2(context) =>
JS('ConvolverNode', 'new ConvolverNode(#)', context);
AudioBuffer? get buffer native;
set buffer(AudioBuffer? value) native;
bool? get normalize native;
set normalize(bool? value) native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("DelayNode")
class DelayNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory DelayNode._() {
throw new UnsupportedError("Not supported");
}
factory DelayNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return DelayNode._create_1(context, options_1);
}
return DelayNode._create_2(context);
}
static DelayNode _create_1(context, options) =>
JS('DelayNode', 'new DelayNode(#,#)', context, options);
static DelayNode _create_2(context) =>
JS('DelayNode', 'new DelayNode(#)', context);
AudioParam? get delayTime native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("DynamicsCompressorNode")
class DynamicsCompressorNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory DynamicsCompressorNode._() {
throw new UnsupportedError("Not supported");
}
factory DynamicsCompressorNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return DynamicsCompressorNode._create_1(context, options_1);
}
return DynamicsCompressorNode._create_2(context);
}
static DynamicsCompressorNode _create_1(context, options) => JS(
'DynamicsCompressorNode',
'new DynamicsCompressorNode(#,#)',
context,
options);
static DynamicsCompressorNode _create_2(context) =>
JS('DynamicsCompressorNode', 'new DynamicsCompressorNode(#)', context);
AudioParam? get attack native;
AudioParam? get knee native;
AudioParam? get ratio native;
num? get reduction native;
AudioParam? get release native;
AudioParam? get threshold native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("GainNode,AudioGainNode")
class GainNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory GainNode._() {
throw new UnsupportedError("Not supported");
}
factory GainNode(BaseAudioContext context, [Map? options]) {
if (options != null) {
var options_1 = convertDartToNative_Dictionary(options);
return GainNode._create_1(context, options_1);
}
return GainNode._create_2(context);
}
static GainNode _create_1(context, options) =>
JS('GainNode', 'new GainNode(#,#)', context, options);
static GainNode _create_2(context) =>
JS('GainNode', 'new GainNode(#)', context);
AudioParam? get gain native;
}
// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@Native("IIRFilterNode")
class IirFilterNode extends AudioNode {
// To suppress missing implicit constructor warnings.
factory IirFilterNode._() {
throw new UnsupportedError("Not supported");
}
factory IirFilterNode(BaseAudioContext context, Map options) {
var options_1 = convertDartToNative_Dictionary(options);
return IirFilterNode._create_1(context, options_1);
}