Audio

com.cupkekgames.audio — backend-agnostic audio contracts (interfaces) and ScriptableObject base classes. Pair with a bridge package (e.g. com.cupkekgames.audio.sonity) for a concrete implementation.

Kind-driven playback

A single entry point dispatches every audio call:

csharp
audioBackend.Play(AudioChannels.Music, levelMusicCue); audioBackend.Play(AudioChannels.SFX, hitCue, new AudioPlaybackContext { Source = transform }); audioBackend.StopAll(AudioChannels.Ambient);

Channels are open string keys. Reserved ones (Music, Ambient, UI, SFX, SFX2D) live in AudioChannels; domain games add new channels (Voice, Cinematic, Stinger, …) by registering routing in the bridge adapter and calling Play(myChannel, …). The interface never grows.

Per-call extras go through IAudioPlaybackContext. The standard AudioPlaybackContext covers positional Source, music fade-out, and stop-all-others — bridges pattern-match to the contexts they understand and ignore the rest.

What's inside

  • IAudioBackend — kind-driven dispatch contract. Play(channel, cue, context) / Stop(channel, cue, context) / StopAll(channel, context).
  • IAudioCue — marker interface for playable assets. Concrete adapters carry backend-specific references (e.g. SonityAudioCueSO wraps a Sonity SoundEvent).
  • IAudioPlaybackContext + AudioPlaybackContext — per-call extras (positional source, fade options).
  • AudioChannels — reserved channel constants (open catalog).
  • ISFXPlayer + SFXPlayerSO — abstract base for designer-authored SFX players that integrate with CupkekGames.TimeSystem. Subclass SFXPlayerSO in your bridge package to add concrete behavior; it gives you [CreateAssetMenu]-ready ScriptableObject playback.

Asmdef + namespace

CupkekGames.Audio (runtime).

Dependencies

  • com.cupkekgames.timesystem (for TimeBundle on ISFXPlayer)

Bridge implementations

Repository

Cupkek-Games/CupkekGames-Audio

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL