open(
opts) ->dev,err
Open a PCM playback device
Opens /dev/snd/pcmC<card>D<device>p, negotiates hardware/software
parameters, and prepares the stream.
Playback auto-starts once the ring buffer fills. While the device is open it is held exclusively — there is no dmix, so other programs cannot play through it.
| opts field | default | description |
|---|---|---|
card | 0 | ALSA card number |
device | 0 | PCM device number |
rate | 48000 | sample rate, Hz |
channels | 2 | channel count |
period | 1024 | frames per period (latency granularity) |
periods | 4 | periods in the ring buffer |
format | "auto" | "auto" picks float if the card accepts it, else s16; or force "f32"/"s16" |
The device object has the following methods:
| Method | Description |
|---|---|
dev:fd() | TBD... |
dev:period() | |
dev:channels() | |
dev:rate() | |
dev:format() | |
dev:avail() | |
dev:write(buf) | |
dev:recover() | |
dev:start() | |
dev:drop() | |
dev:close() |