local-audio-context
v0.1.0
Published
LocalAudioContext is able to dispose collectively of audio nodes
Downloads
2
Readme
local-audio-context
LocalAudioContext is able to dispose collectively of audio nodes.
Installation
bower:
bower install local-audio-context
npm:
npm install local-audio-context
downloads:
API
LocalAudioContext
constructor(audioContext: AudioContext)
Instance Attributes
Inherits properties from its parent, AudioContext.
Instance Methods
Inherits methods from its parent, AudioContext.
dispose(): void
- call
disconnect
andstop
method of each audio nodes.
- call
Usage
var audioContext = new AudioContext();
var localContext = new LocalAudioContext(audioContext);
var osc = localContext.createOscillator();
var amp = localContext.createGain();
osc.start(audioContext.currentTime);
osc.connect(amp);
amp.connect(audioContext.destination);
// AudioNodes are connected to the destination.
// osc(PLAYING) -> amp -> destination
localContext.dispose();
// AudioNodes are disconnected, and stop osc.
// osc(FINISHED) -//-> amp -//-> destination
License
MIT