classTransport
Source: waax.
new Transport(BPM)
Transport abstraction. Singleton and instantiated by default.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
BPM |
Number |
|
Beat per minute. |
Methods
staticgetBPM() → Number
Returns current BPM.
- Returns
-
Number
staticgetLoopEnd() → Number
Returns loop end by tick.
- Returns
-
Number
staticgetLoopStart() → Number
Returns loop start by tick.
- Returns
-
Number
staticgetNow() → Number
Returns playhead position by tick.
- Returns
-
Number
staticisRunning() → Boolean
Returns current running status of transport.
- Returns
-
Boolean
staticpause()
Pauses current playback.
staticrewind()
Rewinds playhead to the beginning.
staticsec2tick(sec) → Number
Converts second to tick based on transport tempo.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
sec |
Number |
|
Second |
- Returns
-
Number
staticsetBPM(BPM)
Sets transport BPM.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
BPM |
Number |
|
Beat per minute. |
staticsetLoopEnd(tick)
Sets loop end position by tick.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
tick |
Number |
|
Loop end in tick. |
staticsetLoopStart(tick)
Sets loop start position by tick.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
tick |
Number |
|
Loop start in tick. |
staticsetNow(tick)
Sets playhead position by tick.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
tick |
Number |
|
Playhead position in ticks. |
staticstart()
Starts playback.
statictick2sec(tick) → Number
Converts tick to second based on transport tempo.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
tick |
Number |
|
Tick (atomic musical time unit) |
- Returns
-
Number
statictoggleLoop(bool)
Toggles or sets loop status.
Parameter
Name | Type | Optional | Description |
---|---|---|---|
bool |
(Boolean or undefined) |
|
Loop state. If undefined, it toggles the current state. |