FlixelSoundSource
View sourceclass
org.flixelgdx.audio.FlixelSoundSource
Cached sound "source" (asset) that can spawn fresh FlixelSound instances on demand.
Do not cache FlixelSound playback objects directly: a playback object has mutable state (volume/pan/time/playing) and cannot be safely shared across callers or overlapping plays.
Constructors
FlixelSoundSource(String)
Creates a sound source with the given asset key.
Parameters:
| Name | Description |
|---|---|
assetKey | The path or key identifying the audio asset. |
FlixelSoundSource(String, boolean)
Creates a sound source with the given asset key and external flag.
Parameters:
| Name | Description |
|---|---|
assetKey | The path or key identifying the audio asset. |
external | true if the path is an absolute external path. |
Methods
getAssetKey()
Returns the asset key (path) for this sound source.
Returns: The asset key; never null.
isExternal()
Returns whether this source uses an external (absolute) path.
Returns: true if external.
getExternal()
Returns whether this source uses an external (absolute) path.
create(Object)
Creates a new playable FlixelSound instance using the provided group (or the default SFX group if null).
Parameters:
| Name | Description |
|---|---|
group | Group handle from the backend factory, or null. |
Returns: A new sound instance.
create()
Convenience overload using the default SFX group.
Returns: A new sound instance.
fromFile(FileHandle)
Convenience constructor from a libGDX file handle (uses handle.path() as key).
Parameters:
| Name | Description |
|---|---|
handle | The file handle to the audio file. |
Returns: A new sound source.