https://man.openbsd.org/sio_open

I am plodding thru playing a wav file using sndio on OpenBSD ...

#sndio #openbsd

I can call sio_open successfully so I think my next steps is
to attempt to read bytes from the wav file and write them
to the sndio decvice.

I assume that won't "just work" but it's something I can do
as I poke around in the dark with a candle :P


sio_open(3) - OpenBSD manual pages

$ ldd main.exe
main.exe:
Start End Type Open Ref GrpRef Name
00000a173e86e000 00000a173e873000 exe 1 0 0 main.exe
00000a1972664000 00000a1972677000 rlib 0 1 0 /usr/lib/libsndio.so.9.0
00000a1987079000 00000a1987181000 rlib 0 1 0 /usr/lib/libc.so.103.0
00000a19f8fc9000 00000a19f8fc9000 ld.so 0 1 0 /usr/libexec/ld.so
My posse's gettin big, my posse's gettin bigger:


$ ldd main.exe
main.exe:
Start End Type Open Ref GrpRef Name
000001811e3cd000 000001811e3d2000 exe 2 0 0 main.exe
00000183fdd13000 00000183fdd26000 rlib 0 1 0 /usr/lib/libsndio.so.9.0
0000018349522000 00000183495c1000 rlib 0 1 0 /usr/local/lib/libsndfile.so.7.0
000001832589c000 00000183259a4000 rlib 0 1 0 /usr/lib/libc.so.103.0
0000018358254000 0000018358285000 rlib 0 7 0 /usr/lib/libm.so.10.1
000001833f04f000 000001833f05a000 rlib 0 4 0 /usr/local/lib/libogg.so.6.2
000001835e639000 000001835e6e0000 rlib 0 1 0 /usr/local/lib/libvorbisenc.so.3.1
000001835c3d2000 000001835c432000 rlib 0 1 0 /usr/local/lib/libFLAC.so.14.0
00000183deac2000 00000183def93000 rlib 0 1 0 /usr/local/lib/libopus.so.1.6
00000183c197f000 00000183c19d4000 rlib 0 2 0 /usr/local/lib/libmpg123.so.7.4
0000018394cbc000 0000018394d18000 rlib 0 1 0 /usr/local/lib/libmp3lame.so.2.2
00000183a618b000 00000183a61c4000 rlib 0 2 0 /usr/local/lib/libvorbis.so.9.0
00000183dfdd4000 00000183dfde1000 rlib 0 1 0 /usr/lib/libpthread.so.28.1
00000183d9895000 00000183d9895000 ld.so 0 1 0 /usr/libexec/ld.so


Funnily enough I did this exact thing a few days ago! Only tricky part I found was dealing with different integer sizes (my OpenBSD uses 24-bit sndio audio, which is rounded up to a 4-byte integer, but some of the wav files I found use 16-bit shorts)

I ended up just doing a switch statement which will do an appropriate cast depending on the bits-per-sample of the wav

The specification actually has some nice examples: https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html
Wave File Specifications