opnsense-src/share/examples
Goran Mekić c1df496f94 sound examples: Add mmap example
This example opens separate OSS capture and playback channels in mmap
mode, places them into a sync group, and starts them together so both
ring buffers advance on the same device timeline. It then monitors the
capture mmap pointer with SNDCTL_DSP_GETIPTR, converts that pointer into
monotonic absolute progress using the reported block count, and copies
newly recorded audio from the input ring to the matching region of the
output ring.

The main loop is driven by an absolute monotonic frame clock rather than
a fixed relative usleep delay. Wakeups are scheduled from the sample
rate using a small frame step similar to the SOSSO timing model, while
the audio path itself stays intentionally simple: just copy input to
output, with no explicit xrun recovery or processing beyond ring
wraparound handling.

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D53749

(cherry picked from commit 3524d4ebbe1f562dd76dc553c085386aadfd2682)
2026-04-21 11:37:57 +02:00
..
bhyve vmrun.sh: add option for sharing directory via p9fs to bhyve 2026-02-16 13:42:11 +00:00
bootforth Remove $FreeBSD$: one-line forth tag 2023-08-16 11:55:43 -06:00
BSD_daemon Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
csh examples/csh: Case insensitive search in pager 2025-04-19 12:41:40 -04:00
drivers share: Delete bitrotted make_*_driver.sh scripts 2025-07-10 20:36:08 +01:00
etc powerpc: Update CPUTYPE options in make.conf 2026-02-22 00:50:36 +00:00
find_interface Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
flua Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:16 -06:00
FreeBSD_version Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
hast Remove "All Rights Reserved" from FreeBSD Foundation copyrights 2024-07-30 12:16:36 -04:00
hwpmc Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
indent
inotify examples/inotify: Handle a zero-length name 2025-07-07 13:51:41 +00:00
ipfilter Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ipfw Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
jails jail: copy MTU settings to vnet interface 2025-05-09 11:42:07 +02:00
kld khelp: make the module compile again 2026-01-02 19:08:20 +00:00
libifconfig Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
libusb20 Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
libvgl Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
mdoc example.3: Show updated library macro usage 2026-01-01 13:08:51 -05:00
modules Fix up a mistake in the CFLAGS added. Pointed out by jrtc. 2024-05-01 13:21:59 -04:00
netgraph Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
oci share/examples/oci: Run 'pkg update' with IGNORE_OSVERSION set 2025-07-22 11:46:01 +01:00
perfmon Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
pf Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ppi Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ppp Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
printing Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
scsi_target Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
ses Remove $FreeBSD$: two-line nroff pattern 2023-08-16 11:55:10 -06:00
smbfs packages: move smbfs examples to the smbutils package 2025-05-28 02:16:30 +01:00
sound sound examples: Add mmap example 2026-04-21 11:37:57 +02:00
sunrpc Fix typo in share/examples/sunrpc/dir/rls.c 2024-02-13 12:36:58 +08:00
tests Remove residual blank line at start of Makefile 2024-07-15 16:43:39 -06:00
uefisign Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
witness Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
ypldap Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00
Makefile sound examples: Add mmap example 2026-04-21 11:37:57 +02:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00