Skip to content

Audio

Generated

This page is auto-generated from psxsplash-main/src/luaapi.hh by scripts/py/gen_lua_api_docs.py. Edits won't survive the next build — fix the source comments instead.

15 entries, 3 with worked examples mined from godot-ps1/demo/scripts/ and the bundled templates.

Methods

Audio.Play(soundId, volume, pan) -> channelId

soundId can be a number (clip index) or string (clip name)

Example

Audio.Play(clip, 100, 64)

Source: godot-ps1/demo/scripts/test_logger.lua line 146.

Audio.Find(name) -> clipIndex or nil

Finds audio clip by name, returns its index for use with Play/Stop/etc.

Audio.Stop(channelId)

Stops the SFX voice on the given channel id (returned by Audio.Play). No-op if the channel finished already or was never used.

Audio.SetVolume(channelId, volume)

Adjusts the live volume of an SFX voice (channel id from Audio.Play). volume is 0..127 — same range Music.SetVolume uses.

Audio.StopAll()

Silences every SFX voice currently in flight. Doesn't stop music (use Music.Stop) or CDDA (use Audio.StopCDDA). Use for cutscene entry, pause-menu hush, etc.

Audio.GetClipDuration(nameOrIndex) -> frames

Length of a clip in 60 Hz frames. Returns 0 for clips authored as looped (no defined end) or for unknown names. Useful for sync'ing gameplay events to a one-shot SFX's tail (e.g. "wait for door creak to finish before playing dialogue line").

Example

local dur = Audio.GetClipDuration(line.clip)

Source: godot-ps1/demo/scripts/checkered_dialog.lua line 61.

Audio.PlaySfx(name, volume?, pan?) -> channelId

Plays SPU-routed clips. Logs a warning if name was authored as XA/CDDA — call PlayMusic for those instead.

Example

Audio.PlaySfx("fog_gate_whoosh")

Source: godot-ps1/demo/scripts/boss_smoke_fog_gate.lua line 13.

Audio.PlayMusic(name) -> 0 on success, -1 on failure

Resolves clip routing and dispatches: SPU plays via the SFX path, CDDA logs an error (use PlayCDDA(track) directly), XA logs "not implemented" (Phase 3 streaming work).

Audio.StopMusic()

Scaffold: stops the music sequencer + CDDA playback. XA path is a no-op until streaming lands.

Audio.PlayCDDA(trackNo)

Starts CDDA playback of the given track number (1-based). CDDA tracks are Red Book audio at the end of the disc — high quality but expensive seeks; reserve for title music and major scene transitions.

Audio.ResumeCDDA()

Resume a paused CDDA track at the position it stopped. No-op if nothing was paused.

Audio.PauseCDDA()

Pause CDDA playback at the current position. Audio.ResumeCDDA continues; Audio.StopCDDA discards position.

Audio.StopCDDA()

Stop CDDA playback. Position is lost — next Audio.PlayCDDA starts from track beginning.

Audio.TellCDDA() -> {min, sec, frame}

Current CDDA playback position as MSF (minute, second, frame) — CD-Audio's native time format. Use for syncing gameplay to track beats or showing playback time in UI.

Audio.SetCDDAVolume(volume)

CDDA-specific master volume (0..127). Independent from SFX volume and the music sequencer's own volume. Use for crossfade-on-pause or "duck the music" gameplay moments.