Audio Service
Channel/one-shot/music service over asset keys. Client-only.
Unity services you inject 1
Crossplay binds these in the client context. Inject and call them from your own MonoBehaviours and presenters.
IAudioService
The modular audio service: channel volumes, pooled one-shots (2D or positional), crossfading music — every clip resolved through IAssetService by Addressables key. The game decides WHAT plays and WHEN (usually by mapping Crossplay events — emotes, abilities, mail arrivals — onto keys); this service owns the HOW.
-
UniTask PlayOneShotAsync(string clipKey, byte channelId, Vector3? position = null, float volumeScale = 1f)Plays a clip once on a channel; positional when position is set.
-
UniTask PlayMusicAsync(string clipKey, float fadeSeconds = -1f)Crossfades to a music clip (loops). Negative fade = the configured default.
-
UniTask StopMusicAsync(float fadeSeconds = -1f)Fades the music out.
-
void SetChannelVolume(byte channelId, float volume)Sets a channel's volume [0..1].
-
float GetChannelVolume(byte channelId)A channel's current volume (1 when unknown).
-
float MasterVolumeMaster volume [0..1] applied on top of every channel.