BB.AudioBufferLoader
A module for creating audio buffers from audio files
Constructor
BB.AudioBufferLoader
(
-
config
-
[callback]
)
-
config
-
[callback]
Parameters:
-
config
ObjectA config object to initialize the buffer ( context:AudioContext, paths: Array of file paths, autoload:boolean)
-
[callback]
Function optionalA callback, with a buffer Object
Example:
BB.Audio.init();
// one way to do it
var loader = new BB.AudioBufferLoader({
paths: ['audio/katy.ogg','audio/entro.ogg']
}, function(buffers){
console.log('loaded:', buffers )
});
// another way to do it
loader = new BB.AudioBufferLoader({
context:BB.Audio.context,
paths:['katy.ogg','entro.ogg'],
autoload:false
});
loader.load(); // call load later, ex under some other condition
view basic BB.AudioBufferLoader example
Properties
Methods
load
()
creates buffers from url paths set in the constructor, automatically runs in constructor unless autoload is set to false ( in the config )
loadbuffer
(
-
path
-
index
)
protected
-
path
-
index
private function used by load() to load a buffer
Parameters:
-
path
Stringto audio file
-
index
Numberof buffer