blob: 7773f8f34ad337a8eb9d558a4c6c7de64b5f6727 [file] [log] [blame]
// 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.
part of $LIBRARYNAME;
$(ANNOTATIONS)$(NATIVESPEC)class $CLASSNAME$EXTENDS$IMPLEMENTS {
// TODO(efortuna): Remove these methods when Chrome stable also uses start
// instead of noteOn.
void start(num when, [num grainOffset, num grainDuration]) {
if (JS('bool', '!!#.start', this)) {
if (grainDuration != null) {
JS('void', '#.start(#, #, #)', this, when, grainOffset, grainDuration);
} else if (grainOffset != null) {
JS('void', '#.start(#, #)', this, when, grainOffset);
} else {
JS('void', '#.start(#)', this, when);
}
} else {
if (grainDuration != null) {
JS('void', '#.noteOn(#, #, #)', this, when, grainOffset, grainDuration);
} else if (grainOffset != null) {
JS('void', '#.noteOn(#, #)', this, when, grainOffset);
} else {
JS('void', '#.noteOn(#)', this, when);
}
}
}
void stop(num when) {
if (JS('bool', '!!#.stop', this)) {
JS('void', '#.stop(#)', this, when);
} else {
JS('void', '#.noteOff(#)', this, when);
}
}
$!MEMBERS
}