From: Jag Talon Subject: Re: emulators/minivmac: add sndio for sound To: George Koehler , Alexandre Ratchov Cc: ports@openbsd.org Date: Tue, 23 Jul 2024 17:35:21 -0400 Thank you gkoehler! It's so nice to see audio working on OpenBSD. On Tue, 2024-07-23 at 17:17 -0400, George Koehler wrote: > I committed my sndio diff together with Jag's README diff. > > On Tue, 23 Jul 2024 11:24:46 +0200 > Alexandre Ratchov wrote: > > > For non-blocking writes to work, the caller must call poll(2) or an > > equivalent to wake up when the device can accept data. I couldn't > > find > > any poll(2) calls in the ALSA backend so I don't understand how > > writes > > are triggered. Does it retry periodically? If so, you need to call > > sio_pollfd(), poll(), sio_revents() before the non-blocking > > sio_write(). > > The write trigger is MySound_EndWrite0 in OSGLUXWN.c, which returns > true when the emulator has filled 1 buffer (with kOneBuffLen > samples). > The ALSA backend might do a partial write, leave the leftover samples > in the ring of 16 buffers, wait for the next trigger, then try to > write the leftover sound plus the new buffer. > > When I tried the non-blocking sio_write, the leftover samples seemed > to grow longer than the ring ("sound buffer over flow" in > OSGLUXWN.c). > I heard 3 seconds of audio, because it stopped calling sio_write > after > 3 seconds.  I did use sio_pollfd, poll, sio_revents; but might have > made some other mistake. > > I switched to the blocking sio_write because I didn't want the > leftover samples to grow. > > On Tue, 23 Jul 2024 07:53:14 -0400 > Jag Talon wrote: > > > Ok to add the following diff to the README to remove the note about > > missing audio? > > I forgot to update the README.  Thank you for doing it. > --gkoehler > -- he/him jagtalon.net weirder.earth/@jag