# Prefixes

The **Sounds Good** API follows a clear semantic convention so you can **read** the code almost like a sentence:

<table><thead><tr><th width="147">Prefix</th><th width="275">Meaning</th><th width="238">Returns</th><th>Chainable</th></tr></thead><tbody><tr><td><strong><code>Set</code></strong></td><td>Configures or assigns a value before / during playback.</td><td>The same instance (<code>this</code>).</td><td>✔️</td></tr><tr><td><strong><code>On</code></strong></td><td>Declares a <strong>callback</strong> that fires on a lifecycle event.</td><td>The same instance (<code>this</code>).</td><td>✔️</td></tr><tr><td>Methods without prefix (<code>Play</code>, <code>Pause</code>, <code>Stop</code>, <code>Resume</code>)</td><td>Immediate action on the audio.</td><td><code>void</code></td><td>❌</td></tr></tbody></table>

***

### 🛠️ **`Set` prefix**

Every function that starts with `Set` **stores** parameters on the object and returns it so you can keep chaining:

```csharp
new Sound(SFX.Explosion)
    .SetVolume(0.55f)
    .SetRandomPitch()           // variation to avoid repetition
    .SetSpatialSound(true)      // 3D
    .SetFadeOut(0.8f)           // fade when it ends
    .Play();
```

> 💡 Create first, **set** afterwards, finish with **play**.

***

### 🔔 **`On` prefix**

`On…` methods let you **subscribe** to events without coroutines or repetitive Invokes:

```csharp
var loopingMusic = new Music(Track.ForestAmbience)
    .SetLoop(true)
    .OnPlay(()      => Debug.Log("Ambient started"))
    .OnPause(()     => Debug.Log("Ambient paused"))
    .OnResume(()    => Debug.Log("Ambient resumed"))
    .OnComplete(()  => Debug.Log("Ambient stopped"));

loopingMusic.Play();    // fires OnPlay

// Later…
loopingMusic.Pause();   // fires OnPause
loopingMusic.Resume();  // fires OnResume
loopingMusic.Stop();    // fires OnComplete
```
