Skip to main content

AudioSource

AudioSource controls a resident VAG clip assigned to an Audio Source component on the target GameObject.

MethodReturnsDescription
AudioSource.Play(gameObjectId)booleanStarts or restarts tracked playback.
AudioSource.PlayOneShot(gameObjectId)booleanStarts an independent one-shot voice.
AudioSource.Stop(gameObjectId)booleanStops tracked playback.
AudioSource.SetVolume(gameObjectId, volume)booleanSets normalized volume.
AudioSource.SetPan(gameObjectId, pan)booleanSets stereo pan in -1.0..1.0.
AudioSource.IsPlaying(gameObjectId)booleanReads tracked playback state.
function Start(gameObjectId)
AudioSource.SetVolume(gameObjectId, 0.8)
AudioSource.SetPan(gameObjectId, 0.0)
end

function Impact(gameObjectId)
if not AudioSource.PlayOneShot(gameObjectId) then
Log.Print("Impact voice unavailable")
end
end

Resident clips consume SPU RAM and runtime voices. Use Music for long CD-XA streams and Audio Import for conversion and budget rules.