mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
documenting distinction between Time and TimelinePosition
Fixes #104 [skip ci]
This commit is contained in:
parent
2285e6feb4
commit
272ad66873
5 changed files with 23 additions and 15 deletions
|
@ -237,7 +237,7 @@ function(Tone){
|
|||
/**
|
||||
* Schedule an event along the timeline.
|
||||
* @param {Function} callback The callback to be invoked at the time.
|
||||
* @param {Time} time The time to invoke the callback at.
|
||||
* @param {TimelinePosition} time The time to invoke the callback at.
|
||||
* @return {Number} The id of the event which can be used for canceling the event.
|
||||
* @example
|
||||
* //trigger the callback when the Transport reaches the desired time
|
||||
|
@ -266,7 +266,7 @@ function(Tone){
|
|||
* @param {Function} callback The callback to invoke.
|
||||
* @param {Time} interval The duration between successive
|
||||
* callbacks.
|
||||
* @param {Time=} startTime When along the timeline the events should
|
||||
* @param {TimelinePosition=} startTime When along the timeline the events should
|
||||
* start being invoked.
|
||||
* @param {Time} [duration=Infinity] How long the event should repeat.
|
||||
* @return {Number} The ID of the scheduled event. Use this to cancel
|
||||
|
@ -299,7 +299,7 @@ function(Tone){
|
|||
* Note that if the given time is less than the current transport time,
|
||||
* the event will be invoked immediately.
|
||||
* @param {Function} callback The callback to invoke once.
|
||||
* @param {Time} time The time the callback should be invoked.
|
||||
* @param {TimelinePosition} time The time the callback should be invoked.
|
||||
* @returns {Number} The ID of the scheduled event.
|
||||
*/
|
||||
Tone.Transport.prototype.scheduleOnce = function(callback, time){
|
||||
|
@ -334,7 +334,7 @@ function(Tone){
|
|||
* Remove scheduled events from the timeline after
|
||||
* the given time. Repeated events will be removed
|
||||
* if their startTime is after the given time
|
||||
* @param {Time} [after=0] Clear all events after
|
||||
* @param {TimelinePosition} [after=0] Clear all events after
|
||||
* this time.
|
||||
* @returns {Tone.Transport} this
|
||||
*/
|
||||
|
@ -505,8 +505,8 @@ function(Tone){
|
|||
|
||||
/**
|
||||
* Set the loop start and stop at the same time.
|
||||
* @param {Time} startPosition
|
||||
* @param {Time} endPosition
|
||||
* @param {TimelinePosition} startPosition
|
||||
* @param {TimelinePosition} endPosition
|
||||
* @returns {Tone.Transport} this
|
||||
* @example
|
||||
* //loop over the first measure
|
||||
|
|
|
@ -35,6 +35,14 @@ define(["Tone/core/Tone"], function (Tone) {
|
|||
* @typedef {Time}
|
||||
*/
|
||||
Time : "time",
|
||||
/**
|
||||
* TimelinePosition describes a position along the Transport's timeline. It is
|
||||
* similar to Time in that it uses all the same encodings, but TimelinePosition specifically
|
||||
* pertains to the Transport's timeline, which is startable, stoppable, loopable, and seekable.
|
||||
* [Read more](https://github.com/Tonejs/Tone.js/wiki/TimelinePosition)
|
||||
* @typedef {TimelinePosition}
|
||||
*/
|
||||
TimelinePosition : "timelinePosition",
|
||||
/**
|
||||
* Frequency can be described similar to time, except ultimately the
|
||||
* values are converted to frequency instead of seconds. A number
|
||||
|
|
|
@ -203,7 +203,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Type", "Tone/core/Ti
|
|||
|
||||
/**
|
||||
* Start the note at the given time.
|
||||
* @param {Time} time When the note should start.
|
||||
* @param {TimelinePosition} time When the note should start.
|
||||
* @return {Tone.Event} this
|
||||
*/
|
||||
Tone.Event.prototype.start = function(time){
|
||||
|
@ -221,7 +221,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Type", "Tone/core/Ti
|
|||
|
||||
/**
|
||||
* Stop the Event at the given time.
|
||||
* @param {Time} time When the note should stop.
|
||||
* @param {TimelinePosition} time When the note should stop.
|
||||
* @return {Tone.Event} this
|
||||
*/
|
||||
Tone.Event.prototype.stop = function(time){
|
||||
|
@ -241,7 +241,7 @@ define(["Tone/core/Tone", "Tone/core/Transport", "Tone/core/Type", "Tone/core/Ti
|
|||
|
||||
/**
|
||||
* Cancel all scheduled events greater than or equal to the given time
|
||||
* @param {Time} [time=0] The time after which events will be cancel.
|
||||
* @param {TimelinePosition} [time=0] The time after which events will be cancel.
|
||||
* @return {Tone.Event} this
|
||||
*/
|
||||
Tone.Event.prototype.cancel = function(time){
|
||||
|
|
|
@ -59,7 +59,7 @@ define(["Tone/core/Tone", "Tone/event/Event"], function (Tone) {
|
|||
/**
|
||||
* Start the loop at the specified time along the Transport's
|
||||
* timeline.
|
||||
* @param {Time=} time When to start the Loop.
|
||||
* @param {TimelinePosition=} time When to start the Loop.
|
||||
* @return {Tone.Loop} this
|
||||
*/
|
||||
Tone.Loop.prototype.start = function(time){
|
||||
|
@ -69,7 +69,7 @@ define(["Tone/core/Tone", "Tone/event/Event"], function (Tone) {
|
|||
|
||||
/**
|
||||
* Stop the loop at the given time.
|
||||
* @param {Time=} time When to stop the Arpeggio
|
||||
* @param {TimelinePosition=} time When to stop the Arpeggio
|
||||
* @return {Tone.Loop} this
|
||||
*/
|
||||
Tone.Loop.prototype.stop = function(time){
|
||||
|
@ -79,7 +79,7 @@ define(["Tone/core/Tone", "Tone/event/Event"], function (Tone) {
|
|||
|
||||
/**
|
||||
* Cancel all scheduled events greater than or equal to the given time
|
||||
* @param {Time} [time=0] The time after which events will be cancel.
|
||||
* @param {TimelinePosition} [time=0] The time after which events will be cancel.
|
||||
* @return {Tone.Loop} this
|
||||
*/
|
||||
Tone.Loop.prototype.cancel = function(time){
|
||||
|
|
|
@ -138,7 +138,7 @@ define(["Tone/core/Tone", "Tone/event/Event", "Tone/core/Type", "Tone/core/Trans
|
|||
|
||||
/**
|
||||
* Start the part at the given time.
|
||||
* @param {Time} time When to start the part.
|
||||
* @param {TimelinePosition} time When to start the part.
|
||||
* @param {Time=} offset The offset from the start of the part
|
||||
* to begin playing at.
|
||||
* @return {Tone.Part} this
|
||||
|
@ -213,7 +213,7 @@ define(["Tone/core/Tone", "Tone/event/Event", "Tone/core/Type", "Tone/core/Trans
|
|||
|
||||
/**
|
||||
* Stop the part at the given time.
|
||||
* @param {Time} time When to stop the part.
|
||||
* @param {TimelinePosition} time When to stop the part.
|
||||
* @return {Tone.Part} this
|
||||
*/
|
||||
Tone.Part.prototype.stop = function(time){
|
||||
|
@ -369,7 +369,7 @@ define(["Tone/core/Tone", "Tone/event/Event", "Tone/core/Type", "Tone/core/Trans
|
|||
|
||||
/**
|
||||
* Cancel scheduled state change events: i.e. "start" and "stop".
|
||||
* @param {Time} after The time after which to cancel the scheduled events.
|
||||
* @param {TimelinePosition} after The time after which to cancel the scheduled events.
|
||||
* @return {Tone.Part} this
|
||||
*/
|
||||
Tone.Part.prototype.cancel = function(after){
|
||||
|
|
Loading…
Reference in a new issue