Audio Preroll
Run Audio Preroll 0.2.0 examples
In a trusted workspace, choose Blyx: Run Installed Framework Example with Blyx Language 1.5.0 or later. Select Audio Preroll, then the starter or batch example. The general Blyx CLI executes a temporary copy and compares stdout with the shipped expected output. A mismatch identifies the first differing line and column. Language editor
The task snippet Run bundled Audio Preroll batch example (one task) also runs vendor/audio_preroll/batch_example.blyx. Compare its terminal output against batch_example.expected.txt in the same directory.
Check Audio Preroll in VS Code
This editor includes the exact Blyx framework source and its installation checks. Open a trusted desktop workspace with the general Blyx CLI, its native toolchain and a host linker available. The command below uses the general CLI's native-run command. CLI installation
- Create an empty
.vscode/tasks.json. Choose Snippets: Fill File with Snippet and select Verify Audio Preroll (workspace tasks). If you have a tasks array already, insert the Verify bundled Audio Preroll (one task) snippet there.
- Choose Tasks: Run Task → Blyx: Verify bundled Audio Preroll. On success the terminal prints
audio_preroll: installation checks passed. On failure the command reports the failed check and exits with code 1.
- To check a project copy, run
nest add audio_preroll@0.2.0 and choose the installed-package task matching your project's vendor or src/vendor directory.
The extension's starter directory is also a complete project. Copy it to a writable folder, open that folder in VS Code, and choose Tasks: Run Task → Blyx: Run supplied example. Compare the terminal output with expected.txt.
blyxc native-run vendor/audio_preroll/verify_install.blyx
In a Blyx test, import vendor::audio_preroll::verification and call audio_preroll_verify_install(). The result is zero on success or the number of the first failed check. Package and source files

Prime a playback buffer and recover from underrun without emitting premature play commands.
Audio, images and video · framework · 0.1.2
Framework bird: Greater racket-tailed drongo.
Drive the workflow
Start with audio_preroll_start(). For each event call audio_preroll_step(snapshot, event, value), persist the returned snapshot, and dispatch audio_preroll_command(snapshot) to your application’s adapter. The host owns I/O, event ordering, duplicate detection and durable command delivery. A matching event produces one command. Rejected events retain the phase and saved quantity. An invalid snapshot yields an empty vector.
The snapshot contains phase ID, saved quantity and last command ID. Event values are whole numbers from zero through one billion. In the table, x is the event value and r is the saved quantity. Rules match in listed order. To validate a whole history without running effects use audio_preroll_replay(events, values). It returns the final snapshot or an empty vector on rejection.
| Current phase |
Event |
Guard |
Next phase |
Command |
New quantity |
| idle |
prime |
x>0 |
priming |
request_frames |
x |
| priming |
fill |
x>0 and x<r |
priming |
accept_frames |
r-x |
| priming |
fill |
x>=r |
playing |
start_audio |
0 |
| playing |
underrun |
x>0 |
priming |
pause_and_refill |
x |
| playing |
stop |
always |
done |
release_device |
0 |
Phase IDs in order from zero: idle, priming, playing, done.
Replay your own events
After installing the demo, run the following from its directory. Supply alternating event names and integer values. The command prints each requested action and exits with status 1 at the first rejected transition, or 2 for malformed arguments.
blyxc native-run main.blyx -- prime 8 fill 3 fill 5 underrun 2 fill 4 stop 0
Run this checkout
Run blyxc native-run main.blyx to reproduce expected.txt. Run blyxc native-run checks.blyx and compare the complete output with checks-expected.txt.
Try the published project
nest demo audio_preroll@0.1.2
blyxc native-run audio_preroll-demo/main.blyx
Install with nest add audio_preroll@0.1.2 and import vendor::audio_preroll::audio_preroll.
Maintained by Rahul Chaube. Blyx · GitHub · LinkedIn · Sponsor
Editor snippets
Use this extension with the Blyx Language extension. In a .blyx file, type one of the following prefixes and invoke editor completion.
audio_preroll_start
audio_preroll_step
audio_preroll_command
audio_preroll_replay
use_audio_preroll