Re: Memory mapped OSS device

From: Christos Margiolis <christos_at_freebsd.org>
Date: Mon, 05 May 2025 18:55:15 UTC
Hello again 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.

Pulseaudio seems to be doing mmap, so you could get some inspiration
from there as well:

https://github.com/pulseaudio/pulseaudio/tree/master/src/modules/oss

Christos