Guidance / Manual
Appendix B: Quick Reference
Common Code Patterns
Play Sound:
myEvent.Post();
myEvent.Post(gameObject, transform.position);
Control Playback:
AudioHandle handle = myEvent.Post();
handle.SetVolumeScale(0.5f);
handle.SetPitchOffset(2f);
handle.Stop(fadeTime: 1f);
Bus Control:
AudioManager.Instance.SetBusVolume("Music", -6f, transitionTime: 1f); // the mix (the asset's Volume)
musicBus.PlayerVolumeDb = -6f; // a Settings page (runtime only)
Cars:
car.VolumeOffsetDb = 2f; // this car's trim, every sound on it
car.Post(impactEvent, localContactPoint, PostValues.Of(strength, 0.8f));
scrape.SetLocalOffset(localContactPoint); // a playing sound follows the contact
car.Post(whooshEvent, passDsp - 0.3, 0.2); // 0.2 s into the clip, timed to the pass
car.Teleport(); // after a reset: no Doppler spike
othersBus.MaxRealVoices = 12; // other cars can't crowd out your own
Split screen:
AudioManager.Instance.SpatialMode = AudioSpatialMode.Pepper; // at boot: Pepper pans, from every point
var p2 = AudioManager.Instance.AddListeningPoint(player2Camera);
p2.Weight = 1f; p2.PanWidth = 0f; // full weight, mono
AudioManager.Instance.SetPrimaryListeningPoint(player1Point); // where Unity's AudioListener goes
State Change:
AudioManager.Instance.SetState("Underwater", transitionTime: 1.5f);
Switch:
AudioManager.Instance.SetSwitch("Surface_Type", "Metal");
RTPC:
AudioManager.Instance.SetRTPC("CombatIntensity", 0.75f);
Multi-Position:
AudioMultiHandle multiHandle = event.PostMultiPosition(emitterParent); From the Pepper.SFX 3.1 guides (USER_GUIDE.md). Something wrong or unclear? Tell me.