ludic/ns-audio.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Audio — Ludic</title>
<meta name="description" content="Sound effects and music.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">Audio</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Audio</h1></div>
<p class="ns-blurb">Sound effects and music. A sound is loaded once with <a href="audio-load.html"><code>Audio.load</code></a> into a handle; <a href="audio-play.html"><code>Audio.play</code></a> fires it one-shot and <a href="audio-play_music.html"><code>Audio.play_music</code></a> loops it on a single music channel. Playback is <strong>out-of-band</strong> — the audio device is real-time, not part of the deterministic simulation — but every trigger here is an ordinary frame-driven call, so a recorded run replays the same sounds at the same frames. Headless builds carry the whole API as no-ops (no audio device needed), so the same game code runs under the test harness.</p>
<div class="ns-methods"><a class="ns-method" href="audio-load.html"><code class="nm-sig">Audio.load(path) -&gt; int</code><span class="nm-tip">Load a sound file into a handle.</span></a><a class="ns-method" href="audio-play.html"><code class="nm-sig">Audio.play(id) -&gt; void</code><span class="nm-tip">Fire a one-shot sound.</span></a><a class="ns-method" href="audio-play_at.html"><code class="nm-sig">Audio.play_at(id, gain, pitch, pan) -&gt; void</code><span class="nm-tip">Fire a one-shot with its own gain, pitch and stereo position.</span></a><a class="ns-method" href="audio-play_sound.html"><code class="nm-sig">Audio.play_sound(id) -&gt; void</code><span class="nm-tip">Fire a one-shot sound (alias of play).</span></a><a class="ns-method" href="audio-play_music.html"><code class="nm-sig">Audio.play_music(id) -&gt; void</code><span class="nm-tip">Loop a sound as background music.</span></a><a class="ns-method" href="audio-stop.html"><code class="nm-sig">Audio.stop(id) -&gt; void</code><span class="nm-tip">Stop one sound.</span></a><a class="ns-method" href="audio-stop_music.html"><code class="nm-sig">Audio.stop_music() -&gt; void</code><span class="nm-tip">Stop the music channel.</span></a><a class="ns-method" href="audio-stop_all.html"><code class="nm-sig">Audio.stop_all() -&gt; void</code><span class="nm-tip">Stop every sound.</span></a><a class="ns-method" href="audio-volume.html"><code class="nm-sig">Audio.volume(v) -&gt; void</code><span class="nm-tip">Set the master volume.</span></a><a class="ns-method" href="audio-pitch.html"><code class="nm-sig">Audio.pitch(v) -&gt; void</code><span class="nm-tip">Set the playback rate / pitch.</span></a><a class="ns-method" href="audio-is_playing.html"><code class="nm-sig">Audio.is_playing(id) -&gt; bool</code><span class="nm-tip">Is this sound playing?</span></a><a class="ns-method" href="audio-define.html"><code class="nm-sig">Audio.define(name: s, path: p) -&gt; int</code><span class="nm-tip">Load a sound into the bank under a name.</span></a><a class="ns-method" href="audio-named.html"><code class="nm-sig">Audio.named(name: s) -&gt; int</code><span class="nm-tip">The handle registered under a name, or 0.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>