Class createjs.Sound
Extends
.
Defined in: sound.js.
Constructor Attributes | Constructor Name and Description |
---|---|
A class that plays sound.
|
Field Attributes | Field Name and Description |
---|---|
<static> |
createjs.Sound.DELIMITER
The character (or characters) that are used to split multiple paths from an
audio source.
|
<static> |
createjs.Sound.exports
A table of exported functions.
|
<static> |
createjs.Sound.INTERRUPT_ANY
The interrupt value to interrupt any currently playing instance with the same
source, if the maximum number of instances of the sound are already playing.
|
<static> |
createjs.Sound.INTERRUPT_EARLY
The interrupt value to interrupt the earliest currently playing instance with
the same source that progressed the least distance in the audio track, if the
maximum number of instances of the sound are already playing.
|
<static> |
createjs.Sound.INTERRUPT_LATE
The interrupt value to interrupt the currently playing instance with the same
source that progressed the most distance in the audio track, if the maximum
number of instances of the sound are already playing.
|
<static> |
createjs.Sound.INTERRUPT_NONE
The interrupt value to not interrupt any currently playing instances with the
same source, if the maximum number of instances of the sound are already
playing.
|
<static> |
createjs.Sound.PLAY_FAILED
Defines the playState of an instance that failed to play.
|
<static> |
createjs.Sound.PLAY_FINISHED
Defines the playState of an instance that completed playback.
|
<static> |
createjs.Sound.PLAY_INITED
Defines the playState of an instance that is still initializing.
|
<static> |
createjs.Sound.PLAY_INTERRUPTED
Defines the playState of an instance that was interrupted by another instance.
|
<static> |
createjs.Sound.PLAY_SUCCEEDED
Defines the playState of an instance that is currently playing or paused.
|
Method Attributes | Method Name and Description |
---|---|
<static> |
createjs.Sound.addListener(type, listener, opt_useCapture)
Adds an event listener.
|
<static> |
createjs.Sound.createInstance(source)
Creates a new sound instance.
|
<static> |
createjs.Sound.dispatch(event, opt_target)
Dispatches the specified event to all listeners.
|
<static> |
createjs.Sound.getActivePlugin()
Returns whether there is at least one listener for the specified event type.
|
getCapability_(key)
Returns a specific capability of the active plugin.
|
|
<static> |
createjs.Sound.getInstance_()
Returns the global instance of the createjs.Sound object.
|
<static> |
createjs.Sound.getMute()
Returns the mute status.
|
<static> |
createjs.Sound.getVolume()
Returns the master volume.
|
<static> |
createjs.Sound.hasListener(type)
Returns whether there is at least one listener for the specified event type.
|
<static> |
createjs.Sound.initializeDefaultPlugins()
Initializes the default plug-ins.
|
<static> |
createjs.Sound.isReady()
Returns whether this module can play sound.
|
loadComplete(source)
Returns whether a source has been loaded.
|
|
<static> |
createjs.Sound.play(source, value, opt_delay, opt_offset, opt_loop, opt_volume, opt_pan)
Plays a sound.
|
<static> |
createjs.Sound.Plugin()
An inner interface that provides methods for the original SoundJS plug-ins.
|
<static> |
createjs.Sound.registerManifest(manifest, basePath)
Registers a manifest of audio files for loading.
|
<static> |
createjs.Sound.registerPlugin(plugin)
Registers a plug-in.
|
<static> |
createjs.Sound.registerPlugins(plugins)
Registers plug-ins.
|
<static> |
createjs.Sound.registerSound(source, opt_id, opt_data, opt_preload, opt_basePath)
Creates audio sprites from an audio file and registers them.
|
<static> |
createjs.Sound.registerSounds(sources, opt_basePath)
Creates audio sprites from audio files and registers them.
|
<static> |
createjs.Sound.removeAllListeners(opt_type)
Removes all listeners for the specified type, or all listeners of all types.
|
<static> |
createjs.Sound.removeAllSounds()
Removes all sounds registered to this object.
|
<static> |
createjs.Sound.removeListener(type, listener, opt_useCapture)
Removes the specified event listener.
|
<static> |
createjs.Sound.removeManifest(manifest, basePath)
Removes all sound files in a manifest.
|
<static> |
createjs.Sound.removeSound(src, basePath)
Removes a sound.
|
<static> |
createjs.Sound.reset(opt_destroy)
Resets the global variables used by this class and the inner classes in this
file.
|
<static> |
createjs.Sound.setMute(value)
Mutes/Unmutes all audio.
|
<static> |
createjs.Sound.setVolume(value)
Sets the master volume.
|
<static> |
createjs.Sound.stop()
Stops all audio (global stop)
|
Field Detail
<static>
createjs.Sound.DELIMITER
The character (or characters) that are used to split multiple paths from an
audio source.
<static>
createjs.Sound.exports
A table of exported functions.
<static>
createjs.Sound.INTERRUPT_ANY
The interrupt value to interrupt any currently playing instance with the same
source, if the maximum number of instances of the sound are already playing.
<static>
createjs.Sound.INTERRUPT_EARLY
The interrupt value to interrupt the earliest currently playing instance with
the same source that progressed the least distance in the audio track, if the
maximum number of instances of the sound are already playing.
<static>
createjs.Sound.INTERRUPT_LATE
The interrupt value to interrupt the currently playing instance with the same
source that progressed the most distance in the audio track, if the maximum
number of instances of the sound are already playing.
<static>
createjs.Sound.INTERRUPT_NONE
The interrupt value to not interrupt any currently playing instances with the
same source, if the maximum number of instances of the sound are already
playing.
<static>
createjs.Sound.PLAY_FAILED
Defines the playState of an instance that failed to play.
<static>
createjs.Sound.PLAY_FINISHED
Defines the playState of an instance that completed playback.
<static>
createjs.Sound.PLAY_INITED
Defines the playState of an instance that is still initializing.
<static>
createjs.Sound.PLAY_INTERRUPTED
Defines the playState of an instance that was interrupted by another instance.
<static>
createjs.Sound.PLAY_SUCCEEDED
Defines the playState of an instance that is currently playing or paused.
Method Detail
<static>
{Function|Object}
createjs.Sound.addListener(type, listener, opt_useCapture)
Adds an event listener.
- Parameters:
- {string} type
- {Function|Object} listener
- {boolean=} opt_useCapture
- Returns:
- {Function|Object}
<static>
{createjs.Sound.Player}
createjs.Sound.createInstance(source)
Creates a new sound instance.
- Parameters:
- {string} source
- Returns:
- {createjs.Sound.Player}
<static>
{boolean}
createjs.Sound.dispatch(event, opt_target)
Dispatches the specified event to all listeners.
- Parameters:
- {Object|string|Event} event
- {Object=} opt_target
- Returns:
- {boolean}
<static>
{createjs.Sound.Plugin}
createjs.Sound.getActivePlugin()
Returns whether there is at least one listener for the specified event type.
- Returns:
- {createjs.Sound.Plugin}
{number}
getCapability_(key)
Returns a specific capability of the active plugin.
- Parameters:
- {string} key
- Returns:
- {number}
<static>
{createjs.Sound}
createjs.Sound.getInstance_()
Returns the global instance of the createjs.Sound object.
- Returns:
- {createjs.Sound}
<static>
{boolean}
createjs.Sound.getMute()
Returns the mute status.
- Returns:
- {boolean}
<static>
{number}
createjs.Sound.getVolume()
Returns the master volume.
- Returns:
- {number}
<static>
{boolean}
createjs.Sound.hasListener(type)
Returns whether there is at least one listener for the specified event type.
- Parameters:
- {string} type
- Returns:
- {boolean}
<static>
{boolean}
createjs.Sound.initializeDefaultPlugins()
Initializes the default plug-ins.
- Returns:
- {boolean}
<static>
{boolean}
createjs.Sound.isReady()
Returns whether this module can play sound.
- Returns:
- {boolean}
{boolean}
loadComplete(source)
Returns whether a source has been loaded.
- Parameters:
- {string} source
- Returns:
- {boolean}
<static>
createjs.Sound.play(source, value, opt_delay, opt_offset, opt_loop, opt_volume, opt_pan)
Plays a sound.
- Parameters:
- {string} source
- {string|Object} value
- {number=} opt_delay
- {number=} opt_offset
- {number=} opt_loop
- {number=} opt_volume
- {number=} opt_pan
<static>
createjs.Sound.Plugin()
An inner interface that provides methods for the original SoundJS plug-ins.
<static>
{Array.
createjs.Sound.registerManifest(manifest, basePath)
Registers a manifest of audio files for loading.
- Parameters:
- {Array} manifest
- {string} basePath
- Returns:
- {Array.
<static>
{boolean}
createjs.Sound.registerPlugin(plugin)
Registers a plug-in.
- Parameters:
- {Object} plugin
- Returns:
- {boolean}
<static>
{boolean}
createjs.Sound.registerPlugins(plugins)
Registers plug-ins.
- Parameters:
- {Array} plugins
- Returns:
- {boolean}
<static>
createjs.Sound.registerSound(source, opt_id, opt_data, opt_preload, opt_basePath)
Creates audio sprites from an audio file and registers them. This method
creates audio sprites from an audio file (loaded by a LoadQueue object) so
a game can play a part of the audio file as listed in the following snippet.
var queue = new createjs.LoadQueue();
queue.on('complete', function() {
createjs.Sound.registerSound('http://server/audio.m4a', '', {
audioSprite: [
{ id: 'sound1', startTime: 0, duration: 500 },
{ id: 'sound2', startTime: 1000, duration: 400 },
{ id: 'sound3', startTime: 1700, duration: 1000 }
}
);
});
queue.loadFile({ src: 'http://server/audio.m4a' });
- Parameters:
- {string|Object} source
- {string=} opt_id
- {number|Object=} opt_data
- {boolean=} opt_preload
- {string=} opt_basePath
<static>
createjs.Sound.registerSounds(sources, opt_basePath)
Creates audio sprites from audio files and registers them.
createjs.Sound.registerSounds([{
src: 'http://server/audio.m4a',
data: {
audioSprite: [
{ id: 'sound1', startTime: 0, duration: 500 },
{ id: 'sound2', startTime: 1000, duration: 400 },
{ id: 'sound3', startTime: 1700, duration: 1000 }
]
}
}]);
- Parameters:
- {Array. sources
- {string=} opt_basePath
<static>
createjs.Sound.removeAllListeners(opt_type)
Removes all listeners for the specified type, or all listeners of all types.
- Parameters:
- {string=} opt_type
<static>
createjs.Sound.removeAllSounds()
Removes all sounds registered to this object.
<static>
createjs.Sound.removeListener(type, listener, opt_useCapture)
Removes the specified event listener.
- Parameters:
- {string} type
- {Function|Object} listener
- {boolean=} opt_useCapture
<static>
{Array.}
createjs.Sound.removeManifest(manifest, basePath)
Removes all sound files in a manifest.
- Parameters:
- {Array. manifest
- {string} basePath
- Returns:
- {Array.
}
<static>
{boolean}
createjs.Sound.removeSound(src, basePath)
Removes a sound.
- Parameters:
- {string|Object} src
- {string} basePath
- Returns:
- {boolean}
<static>
createjs.Sound.reset(opt_destroy)
Resets the global variables used by this class and the inner classes in this
file.
- Parameters:
- {number=} opt_destroy
<static>
{boolean}
createjs.Sound.setMute(value)
Mutes/Unmutes all audio.
- Parameters:
- {boolean} value
- Returns:
- {boolean}
<static>
createjs.Sound.setVolume(value)
Sets the master volume.
- Parameters:
- {number} value
<static>
createjs.Sound.stop()
Stops all audio (global stop)