Class: Transport

Transport

Provides position-based scheduling of TimeEngine instances.

example

Constructor

new Transport(scheduler)

Parameters:
Name Type Description
scheduler Object

instance of Scheduler

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 transport = new masters.Transport(scheduler);
const playControl = new masters.PlayControl(scheduler, transport);
const myEngine = new MyEngine();
const yourEngine = new yourEngine();

transport.add(myEngine);
transport.add(yourEngine);

playControl.start();

Members

(readonly) currentPosition :Number

Get current master position. This getter will be replaced when the transport is added to a master (i.e. transport or play-control).

Type:
  • Number
Source:

(readonly) currentTime :Number

Get current master time.

Type:
  • Number
Source:

(readonly) currentTime :Number

Get master audio time.

Type:
  • Number
Source:

Methods

add(engine, position)

Add a time engine to the transport.

Parameters:
Name Type Description
engine Object

engine to be added to the transport

position Number

start position

Source:

advancePosition(time, position, speed)

Implementation of the transported time engine interface.

Parameters:
Name Type Description
time Number
position Number
speed Number
Source:

clear()

Remove all time engines from the transport.

Source:

remove(engineOrTransported)

Remove a time engine from the transport.

Parameters:
Name Type Description
engineOrTransported object

engine or transported to be removed from the transport

Source:

resetEnginePosition(transported, position)

Reset position of the given engine.

Parameters:
Name Type Description
transported TimeEngine

Engine to reset

position Number

New position

Source:

resetPosition(next)

Reset next transport position

Parameters:
Name Type Description
next Number

transport position

Source:

syncPosition(time, position, speed)

Implementation of the transported time engine interface.

Parameters:
Name Type Description
time Number
position Number
speed Number
Source:

syncSpeed(time, position, speed, seekopt)

Implementation of the transported time engine interface.

Parameters:
Name Type Attributes Default Description
time Number
position Number
speed Number
seek Boolean <optional>
false
Source: