Class: Player

(private) Player(duration, data, pitchMapper, sounder, visualCallback)

Orchestrates the audible (and visual cursor) rendering of the chart

Constructor

(private) new Player(duration, data, pitchMapper, sounder, visualCallback)

Parameters:
Name Type Description
duration integer the length of the rendering in milliseconds
data DataWrapper the underlying data (wrapped in interface)
pitchMapper PitchMapper maps data to pitches
sounder Sounder the sounder object
visualCallback VisualCallback the callback function that highlights the current datum
Source:

Methods

_pause()

Temporarily pause the rendering of the chart. This inherently keeps the sound going at the frequency it was at when the pause was triggered.
Source:
To Do:
  • feature/object to stop/fade the sound after n seconds?

_play()

Resets play state and sets up a recurring function to update the sound (and, optionally, visual callback) at an interval dependant on the number of data.
Source:

_playLoop()

Update state and set _playOne() to run regularly, to render the sound (and optional visual cursor movement).
Source:

_playOne()

This is where the sound is actually played. If a visual callback was specified, this also coordinates the visual highlighting of the current datum as the playback occurs.
Source:

playPause()

Main entry point; manages state.
Source: