sebpiq / WAAClock

A comprehensive event scheduling tool for Web Audio API.
MIT License
244 stars 32 forks source link

Events will be scheduled if deadline is set to 0 and clock has not been started #14

Closed zya closed 9 years ago

zya commented 9 years ago
clock.callbackAtTime(function () {
    //do stuff
  }, 0).repeat(2);

and I have not event called clock.start().

The event will be scheduled and will run only once before stopping.

zya commented 9 years ago

I didn't have permission to push my changes but changing the line below fixed it for me.

https://github.com/sebpiq/WAAClock/blob/master/lib/WAAClock.js#L71

to

  if (this.clock.context.currentTime >= this._earliestTime && this.clock._started) {
    this._execute()

  } else if (this.clock._hasEvent(this)) {
    this.clock._removeEvent(this)
    this.clock._insertEvent(this)

  } else this.clock._insertEvent(this)
sebpiq commented 9 years ago

Ok, this should be fixed now :) thanks for reporting!

zya commented 9 years ago

@sebpiq I'd like to contribute if you could add me as a collaborator btw.

sebpiq commented 9 years ago

@zya that would be great! The standard way of contributing though is that you would fork the library, make your changes, push them to github and then create a pull request. That allows me to control what comes in, possibly edit the changes, in order to make sure that the code stays clean, the style consistent, etc ... If you have questions about this process, don't hesitate to contact me on my email!