diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 02:36:42 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | a3085da09e222238071c4948f6893b21542ac695 (patch) | |
| tree | 77d98cd2c8959699cb9cdba161bf1e48438e4d42 /src/host/Console.zig | |
| parent | 5553b933f7c243b2706eb2a7989d8e33d2f6042b (diff) | |
| download | sketchbook-a3085da09e222238071c4948f6893b21542ac695.tar.gz sketchbook-a3085da09e222238071c4948f6893b21542ac695.zip | |
host: a sketch may ask for the sound device's pull, audio_pull
Sound a sketch makes leaves for the device about one pull after draw, and
SDL opens 1024-sample pulls at 48 kHz (21 ms); 256 leaves in about 6.5 ms,
but the audio server then runs every client at that size, and drops out
under load. The only way to ask was SDL_AUDIO_DEVICE_SAMPLE_FRAMES in the
environment. Now an app declares `pub const audio_pull = 256;` beside its
name; abi.Info carries it (0, SDL's own, when it is not declared), and the
host sets it as SDL's hint just before it opens the device, at normal
priority, so the environment variable still wins. It is read once, at
start; the web host has no device to open and ignores it. The sound
overlay's header says what the device took: OUTPUT ch1 / ... / pull 256.
Test: audio, on SDL's dummy driver: the device opened with nothing asked
takes 1024 at once, asked 256 takes 256, and with 512 in SDL's copy of the
environment takes 512 though 256 was asked. test-audio: 48/48 steps, 9/9
tests. README: the app table's row, and a paragraph in sound with the
trade-off.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/host/Console.zig')
0 files changed, 0 insertions, 0 deletions
