DEVICE
 
Lists, selects, and queries sfxlib output devices.

Syntax


Device List
result = Device Select(device)
Device Info
Device Info()
Device Info device
Device Info(device)


Description

DEVICE is the command family for the audio output path. In sfxlib, a device usually means a compiled backend such as PulseAudio, ALSA, WASAPI, CoreAudio, WebAudio, or the null driver, depending on the platform.

Device List prints the available output choices. Device Select asks sfxlib to use one of those choices by index. Device Info prints diagnostic information about either the current device or a specific device.

Most programs can let sfxlib pick the default device automatically. DEVICE is mainly useful for setup screens, diagnostics, tests, and situations where the default backend fails but another backend might work.

For automated tests, servers, and systems without speakers, the null driver is useful because it lets sound commands run without producing audible output.


Example

device list

if device select(0) < 0 then
print "could not select device"
end if

device info


Notes

  • Set SFXLIB_DRIVER=null before program startup to force the null output driver when available.
  • Device numbers are backend-list indexes, not operating-system device ids.


See also