new MusicManager()
MusicManager handles background music with crossfading.
- Source
Methods
addTrack(name, path, loop)
Register a music track.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
name | string | Track name. | |
path | string | Audio file path. | |
loop | boolean | true | Whether to loop. |
- Source
play(name, crossfade)
Play a track with optional crossfade.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
name | string | Track name. | |
crossfade | boolean | true | Enable crossfade. |
- Source
setVolume(vol)
Set master volume.
Parameters:
| Name | Type | Description |
|---|---|---|
vol | number | Volume (0 to 1). |
- Source
stop()
Stop current track.
- Source