charton API / @chart-on/core / index / Sonifier
Interface: Sonifier
Defined in: packages/core/src/sonify.ts:160
A sonifier attached to one chart (see createSonifier).
Properties
options
readonlyoptions:Readonly<SonifierOptions>
Defined in: packages/core/src/sonify.ts:164
position
readonlyposition:number|null
Defined in: packages/core/src/sonify.ts:163
Index into the series' data of the bar played last, or null before the first.
state
readonlystate:SonifierState
Defined in: packages/core/src/sonify.ts:161
Methods
applyOptions()
applyOptions(
patch):void
Defined in: packages/core/src/sonify.ts:184
Parameters
patch
Returns
void
destroy()
destroy():
void
Defined in: packages/core/src/sonify.ts:188
Stop, close the audio context and detach from the chart. The chart's own destroy does this too.
Returns
void
on()
on(
event,listener): () =>void
Defined in: packages/core/src/sonify.ts:186
Subscribe to state changes; returns an unsubscribe function.
Parameters
event
"state:change"
listener
(event) => void
Returns
() => void
pause()
pause():
void
Defined in: packages/core/src/sonify.ts:172
Stop the sound and keep the position, so play goes on from there.
Returns
void
play()
play():
boolean
Defined in: packages/core/src/sonify.ts:170
Play the visible range, oldest bar first, or go on from where pause stopped. Call it from a user gesture. False when there is nothing to play or no audio.
Returns
boolean
step()
step(
direction):boolean
Defined in: packages/core/src/sonify.ts:183
Sound the next (1) or previous (-1) bar on its own, move the crosshair to it and announce its values. The first step starts on the newest bar in view. Call it from a user gesture. False when there is nothing to play or no audio.
Parameters
direction
-1 | 1
Returns
boolean
stop()
stop():
void
Defined in: packages/core/src/sonify.ts:174
Stop the sound and forget the position.
Returns
void
toggle()
toggle():
boolean
Defined in: packages/core/src/sonify.ts:176
Pause while playing, else play. Returns whether it plays now.
Returns
boolean