Re: Memory mapped OSS device

From: Christos Margiolis <christos_at_freebsd.org>
Date: Thu, 10 Apr 2025 19:32:19 UTC
Hello Meka,

Goran Mekić wrote:
> Hello,
> 
> I am trying to learn about mmap mode of OSS and so far I have this:
> https://github.com/mekanix/freebsd-src/blob/audio-mmap/share/examples/sound/oss/audio.c.
> So the device is initialized properly and my code doesn't break trying
> to write something past the length of the buffer, but I do get strange
> sound. I am using
> http://manuals.opensound.com/developer/mmap_test.c.html as reference
> and the difference that I implemented is that I'm trying to "guess"
> how long I have to sleep so that when I wake up (and maybe wait a
> little bit more), I can write the whole buffer. If anybody knows what
> I'm doing wrong here, please help me.

First of all, sorry for the late reply.

I would guess Florian is probably the most knowledgable in this field.
His sosso library [1] deals with this problem, but the approach is more
sophisticated that just sleeping and waking up. That being said, do you
get the expected result if you do exactly what the sample code does?

Christos

[1] https://github.com/0EVSG/sosso