Files
src/share/examples/Makefile
T
Goran Mekić 3524d4ebbe 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
2026-04-14 12:59:14 +02:00

429 lines
5.9 KiB
Makefile

#
# Doing a make install builds /usr/share/examples
.include <src.opts.mk>
PACKAGE=examples
FILESDIR= ${SHAREDIR}/examples
LDIRS= BSD_daemon \
FreeBSD_version \
bootforth \
csh \
etc \
find_interface \
flua \
indent \
inotify \
ipfw \
jails \
kld \
libvgl \
mdoc \
netgraph \
oci \
perfmon \
ppi \
ppp \
ses \
scsi_target \
sound \
sunrpc \
ypldap
SE_DIRS+= BSD_daemon
SE_BSD_DAEMON= \
FreeBSD.pfa \
README \
beastie.eps \
beastie.fig \
eps.patch \
poster.sh
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "aarch64"
.if ${MK_BHYVE} != "no"
LDIRS+= bhyve
SE_DIRS+= bhyve
SE_BHYVEPACKAGE=bhyve
SE_BHYVE= vmrun.sh
PACKAGE_bhyve/vmrun.sh= bhyve
.endif
.endif
SE_DIRS+= FreeBSD_version
SE_FREEBSD_VERSION= \
FreeBSD_version.c \
Makefile \
README
SE_DIRS+= bootforth
SE_BOOTFORTH_PACKAGE=bootloader
SE_BOOTFORTH= \
README \
boot.4th \
frames.4th \
loader.rc \
menu.4th \
menuconf.4th \
screen.4th
SE_DIRS+= csh
SE_CSHPACKAGE= csh
SE_CSH= dot.cshrc
SE_DIRS+= etc
SE_ETC= \
README.examples \
bsd-style-copyright \
make.conf
SE_DIRS+= find_interface
SE_FIND_INTERFACE= \
Makefile \
README \
find_interface.c
SE_DIRS+= flua
SE_FLUA= libjail.lua
SE_DIRS+= indent
SE_INDENT= indent.pro
SE_DIRS+= inotify
SE_INOTIFY= inotify.c \
Makefile
.if ${MK_IPFILTER} != "no"
SUBDIR+= ipfilter
.endif
SE_DIRS+= ipfw
SE_IPFWPACKAGE= ipfw
SE_IPFW= change_rules.sh
SE_DIRS+= jails
SE_JAILPACKAGE= jail
SE_JAILS= \
README \
VIMAGE \
jail.xxx.conf \
jib \
jng \
rc.conf.jails \
rcjail.xxx.conf
SE_DIRS+= kld
SE_KLD= Makefile
SE_DIRS+= kld/cdev
SE_KLD_CDEV= \
Makefile \
README \
SE_DIRS+= kld/cdev/module
SE_KLD_CDEV_MODULE= \
Makefile \
cdev.c \
cdev.h \
cdevmod.c
SE_DIRS+= kld/cdev/test
SE_KLD_CDEV_TEST= \
Makefile \
testcdev.c
SE_DIRS+= kld/dyn_sysctl
SE_KLD_DYN_SYSCTL= \
Makefile \
README \
dyn_sysctl.c
SE_DIRS+= kld/firmware
SE_KLD_FIRMWARE= \
Makefile \
README
SE_DIRS+= kld/firmware/fwconsumer
SE_KLD_FIRMWARE_FWCONSUMER= \
Makefile \
fw_consumer.c
SE_DIRS+= kld/firmware/fwimage
SE_KLD_FIRMWARE_FWIMAGE= \
Makefile \
firmware.img.uu
SE_DIRS+= kld/khelp
SE_KLD_KHELP= \
Makefile \
README \
h_example.c
SE_DIRS+= kld/syscall
SE_KLD_SYSCALL= Makefile
SE_DIRS+= kld/syscall/module
SE_KLD_SYSCALL_MODULE= \
Makefile \
syscall.c
SE_DIRS+= kld/syscall/test
SE_KLD_SYSCALL_TEST= \
Makefile \
call.c
SE_DIRS+= libvgl
SE_LIBVGL= \
Makefile \
demo.c
SE_DIRS+= mdoc
SE_MDOC= \
POSIX-copyright \
deshallify.sh \
example.1 \
example.3 \
example.4 \
example.9
SE_DIRS+= netgraph
SE_NETGRAPH= \
ether.bridge \
frame_relay \
ngctl \
raw \
udp.tunnel \
virtual.chain \
virtual.lan \
SE_DIRS+= oci
SE_OCI= \
README \
Containerfile.pkg
SE_DIRS+= perfmon
SE_PERFMON= \
Makefile \
README \
perfmon.c \
.if ${MK_PF} != "no"
SE_DIRS+= pf
.if ${MK_STAGING} == "no"
SE_PFPACKAGE= pf
SE_PF= \
ackpri \
faq-example1 \
faq-example2 \
faq-example3 \
pf.conf \
queue1 \
queue2 \
queue3 \
queue4 \
spamd
.endif
.endif
SE_DIRS+= ppi
SE_PPI= \
Makefile \
ppilcd.c
SE_DIRS+= ppp
SE_PPPPACKAGE= ppp
SE_PPP= \
chap-auth \
login-auth \
ppp.conf.sample \
ppp.conf.span-isp \
ppp.conf.span-isp.working \
ppp.linkdown.sample \
ppp.linkdown.span-isp \
ppp.linkdown.span-isp.working \
ppp.linkup.sample \
ppp.linkup.span-isp \
ppp.linkup.span-isp.working \
ppp.secret.sample \
ppp.secret.span-isp \
ppp.secret.span-isp.working
.if ${MK_LPR} != "no"
LDIRS+= printing
SE_DIRS+= printing
SE_PRINTINGPACKAGE=lp
SE_PRINTING= \
diablo-if-net \
hpdf \
hpif \
hpof \
hprf \
hpvf \
if-simple \
if-simpleX \
ifhp \
make-ps-header \
netprint \
psdf \
psdfX \
psif \
pstf \
pstfX
.endif
SE_DIRS+= ses
SE_SES= \
Makefile \
Makefile.inc
SE_DIRS+= ses/getencstat
SE_SES_GETENCSTAT= \
Makefile \
getencstat.0
SE_DIRS+= ses/sesd
SE_SES_SESD= \
Makefile \
sesd.0
SE_DIRS+= ses/setencstat
SE_SES_SETENCSTAT= \
Makefile \
setencstat.0
SE_DIRS+= ses/setobjstat
SE_SES_SETOBJSTAT= \
Makefile \
setobjstat.0
SE_DIRS+= ses/srcs
SE_SES_SRCS= \
chpmon.c \
eltsub.c \
eltsub.h \
getencstat.c \
getnobj.c \
getobjmap.c \
getobjstat.c \
inienc.c \
sesd.c \
setencstat.c \
setobjstat.c
SE_DIRS+= scsi_target
SE_SCSI_TARGET= \
Makefile \
scsi_target.c \
scsi_target.h \
scsi_target.8 \
scsi_cmds.c
SE_DIRS+= sound
SE_SOUND= \
kqueue.c \
midi.c \
mmap.c \
oss.h \
poll.c \
select.c \
simple.c \
sndstat_nv.c
SE_DIRS+= sunrpc
SE_SUNRPC= Makefile
SE_DIRS+= sunrpc/dir
SE_SUNRPC_DIR= \
Makefile \
dir.x \
dir_proc.c \
rls.c
SE_DIRS+= sunrpc/msg
SE_SUNRPC_MSG= \
Makefile \
msg.x \
msg_proc.c \
printmsg.c \
rprintmsg.c
SE_DIRS+= sunrpc/sort
SE_SUNRPC_SORT= \
Makefile \
rsort.c \
sort.x \
sort_proc.c
.if ${MK_EFI} != "no"
LDIRS+= uefisign
SE_DIRS+= uefisign
SE_UEFISIGN= uefikeys
SE_UEFISIGNPACKAGE=efi-tools
.endif
SE_DIRS+= ypldap
SE_YPLDAP= ypldap.conf
SE_YPLDAPPACKAGE=yp
.if ${MK_HAST} != "no"
LDIRS+= hast
SE_HASTPACKAGE= hast
SE_DIRS+= hast
SE_HAST= ucarp.sh \
ucarp_down.sh \
ucarp_up.sh \
vip-down.sh \
vip-up.sh
.endif
.if ${MK_USB} != "no"
LDIRS+= libusb20
SE_DIRS+= libusb20
SE_LIBUSB20= \
Makefile \
README \
util.c \
util.h \
bulk.c \
control.c
.endif
# Setup the FILES_GROUPS for all DIRS variables above.
# The variables are prefixed by 'SE_' to prevent variable collision in
# other parts of the system
.for d in ${SE_DIRS}
.for f in ${SE_${d:tu:C/\//_/g}}
SER_${d:tu:C/\//_/g}+= ${d}/${f}
.endfor
FILESGROUPS+= SER_${d:tu:C/\//_/g}
SER_${d:tu:C/\//_/g}DIR+= ${SHAREDIR}/examples/${d}
.if ${SE_${d:tu:C/\//_/g}PACKAGE:U} != ""
SER_${d:tu:C/\//_/g}PACKAGE= ${SE_${d:tu:C/\//_/g}PACKAGE}
.else
SER_${d:tu:C/\//_/g}PACKAGE= examples
.endif
.endfor
BINDIR= ${SHAREDIR}/examples
beforeinstall: copies
META_TARGETS+= copies
copies:
.for i in ${LDIRS}
if [ -L ${DESTDIR}${BINDIR}/$i ]; then \
rm -f ${DESTDIR}${BINDIR}/$i; \
fi
.endfor
SUBDIR+= smbfs
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
SUBDIR_PARALLEL=
.include <bsd.prog.mk>