BaseSound Class
Pseudo AudioNode class the encapsulates basic functionality of an Audio Node. To be extended by all other Sound Models
Constructor
BaseSound
-
[context]
Parameters:
-
[context]
AudioContext optionalAudioContext in which this Sound is defined.
Item Index
Methods
connect
-
destination
-
[output]
-
[input]
If the parameter output
is an AudioNode, it connects to the releaseGainNode.
If the output is a BaseSound, it will connect BaseSound's releaseGainNode to the output's inputNode.
disconnect
-
[outputIndex]
Disconnects the Sound from the AudioNode Chain.
Parameters:
-
[outputIndex]
Number optionalIndex describing which output of the AudioNode to disconnect.
listParams
-
[paramArray]
List all SPAudioParams this Sound exposes
Parameters:
-
[paramArray]
Array optionalArray of all the SPAudioParams this Sound exposes.
pause
()
Pause sound. Abstract method. Override this method when a Node is defined.
play
()
Play sound. Abstract method. Override this method when a Node is defined.
release
-
[when]
-
[fadeTime]
-
[resetOnRelease]
Linearly ramp down the gain of the audio in time (seconds) to 0.
setOutputEffect
-
effect
Adds an sound effect to the output of this model, and connects the output of the effect to the Audio Destination
Parameters:
-
effect
ObjectAn Sound Effect of type BaseEffect to be appended to the output of this Sound.
setSources
-
sources
-
[onLoadProgress]
-
[onLoadComplete]
Reinitializes the model and sets it's sources.
Parameters:
start
-
when
-
[offset]
-
[duration]
-
[attackDuration]
Start the AudioNode. Abstract method. Override this method when a Node is defined.
Parameters:
stop
-
[when]
Stop the AudioNode. Abstract method. Override this method when a Node is defined.
Parameters:
-
[when]
Number optionalTime (in seconds) the sound should stop playing
Properties
audioContext
AudioContext
Web Audio API's AudioContext. If the context passed to the constructor is an AudioContext, a new one is created here.
inputNode
Object
The input node that the output node will be connected to.
Set this value to null if no connection can be made on the input node
Default: null
onLoadComplete
Function
Callback for when loading of audio files is done and the the model is initalized.
Default: null
onLoadProgress
Function
Callback for handling progress events thrown during loading of audio files.
Default: null
releaseGainNode
GainNode
final
Release Gain Node
Default: Internal GainNode