Class: WebAudioVoiceSink
Voices through Web Audio: each speaker has a gain, a low-pass for walls and a panner, and all of them meet in one volume control.
Implements
Constructors
constructor
• new WebAudioVoiceSink(context, options?): WebAudioVoiceSink
Parameters
| Name | Type |
|---|---|
context | AudioContext |
options | WebAudioVoiceSinkOptions |
Returns
Methods
dispose
▸ dispose(): void
Returns
void
Implementation of
now
▸ now(): number
The output clock, in seconds.
Returns
number
Implementation of
place
▸ place(speakerId, placement): void
Parameters
| Name | Type |
|---|---|
speakerId | string |
placement | VoicePlacement |
Returns
void
Implementation of
play
▸ play(speakerId, samples, sampleRate, when): void
Queue samples of one speaker to start at when on the clock.
Parameters
| Name | Type |
|---|---|
speakerId | string |
samples | Float32Array<ArrayBufferLike> |
sampleRate | number |
when | number |
Returns
void
Implementation of
remove
▸ remove(speakerId): void
Free everything kept for a speaker who went quiet.
Parameters
| Name | Type |
|---|---|
speakerId | string |
Returns
void
Implementation of
resume
▸ resume(): void
Start the output if the browser is holding it (a context made before the page's first click starts suspended). Call from a click or a key.
Returns
void
Implementation of
setListener
▸ setListener(«destructured»): void
Parameters
| Name | Type |
|---|---|
«destructured» | VoiceListener |
Returns
void
Implementation of
setVolume
▸ setVolume(volume): void
The volume of all voices together; 1 is as spoken, above it is a boost.
Parameters
| Name | Type |
|---|---|
volume | number |
Returns
void