start method

void start (num when, [ num grainOffset, num grainDuration ])

Implementation

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);
    }
  }
}