Constructor
new PlayControl(scheduler, engine)
Parameters:
Name | Type | Description |
---|---|---|
scheduler |
Object | instance of Scheduler |
engine |
TimeEngine | engine to control |
- Source:
Example
import masters from 'waves-masters';
const getTimeFunction = () => {
const now = process.hrtime();
return now[0] + now[1] * 1e-9;
}
const scheduler = new masters.Scheduler(getTimeFunction);
const playerEngine = new MyTimeEngine();
const playControl = new masters.PlayControl(scheduler, playerEngine);
playControl.start();
Extends
Members
(readonly) audioTime :Number
Get current master time.
Type:
- Number
- Overrides:
- Source:
(readonly) currentPosition :Number
Get current master position. This function will be replaced when the play-control is added to a master.
Type:
- Number
- Overrides:
- Source:
(readonly) currentTime :Number
Get current master time.
Type:
- Number
- Overrides:
- Source:
loop :Boolean
Sets the play control loop behavior.
Type:
- Boolean
- Source:
loopEnd :Number
Sets loop end value
Type:
- Number
- Source:
loopStart :Number
Sets loop start value
Type:
- Number
- Source:
(readonly) running :Boolean
Returns if the play control is running.
Type:
- Boolean
- Source:
speed :Number
If speed if provided, sets the playback speed. The speed value should be non-zero between -16 and -1/16 or between 1/16 and 16.
Type:
- Number
- Source:
Methods
pause()
Pauses playback and stays at the same position.
- Source:
seek(position)
Set (jump to) playing position.
Parameters:
Name | Type | Description |
---|---|---|
position |
Number | target position |
- Source:
setLoopBoundaries(loopStart, loopEnd)
Sets loop start and end time.
Parameters:
Name | Type | Description |
---|---|---|
loopStart |
Number | loop start value. |
loopEnd |
Number | loop end value. |
- Source:
start()
Starts playback
- Source:
stop()
Stops playback and seeks to initial (0) position.
- Source: