Recently Written · git

sad

sad (2f30.org simple audio daemon) with a Cygwin/OSS port on branch cygwin

git clone https://github.com/equwal/sad

Log | Files | Refs


commit 500a0d1416deece8db1fe9bcc06efdc24f3bda1f
equwal <13551856+equwal@users.noreply.github.com>
2026-10-04 04:56:16 -0700

Add Cygwin install target, sacc client and Windows wrappers

make install-cygwin builds with the OSS backend and installs sad
and sacc to /usr/local/bin. sacc sends one command over the socket
with socat and converts Windows paths for "add". sad.cmd and
sacc.cmd run both from PowerShell or cmd. SAD_SOCK picks the
socket; default /tmp/sad-sock. Docs in cygwin/CYGWIN.

.gitignore keeps objects, the binary and config.h out of git.

 .gitignore      |  4 ++++
 Makefile        |  7 ++++++-
 cygwin/CYGWIN   | 25 +++++++++++++++++++++++++
 cygwin/sacc     | 12 ++++++++++++
 cygwin/sacc.cmd |  2 ++
 cygwin/sad.cmd  |  3 +++
 6 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..eeb71d7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.o
+sad
+sad.exe
+config.h
diff --git a/Makefile b/Makefile
index 40a42ad..3984457 100644
--- a/Makefile
+++ b/Makefile
@@ -46,6 +46,11 @@ install: all
 	mkdir -p $(DESTDIR)$(PREFIX)/bin
 	cp -f $(BIN) $(DESTDIR)$(PREFIX)/bin
 
+install-cygwin:
+	sed 's/SOUNDSYS ALSA/SOUNDSYS OSS/' config.def.h > config.h
+	$(MAKE) install OUTOBJ=oss.o OUTLIBS=
+	cp -f cygwin/sacc $(DESTDIR)$(PREFIX)/bin
+
 uninstall:
 	rm -f $(DESTDIR)$(PREFIX)/bin/$(BIN)
 
@@ -58,4 +63,4 @@ clean:
 	cp $< $@
 
 .PHONY:
-	all install uninstall clean
+	all install install-cygwin uninstall clean
diff --git a/cygwin/CYGWIN b/cygwin/CYGWIN
new file mode 100644
index 0000000..6271d06
--- /dev/null
+++ b/cygwin/CYGWIN
@@ -0,0 +1,25 @@
+sad on Cygwin
+=============
+
+Cygwin has no sndio or ALSA. It emulates OSS /dev/dsp on top of
+Windows audio, so sad uses the oss backend there.
+
+Packages: gcc-core make socat libsndfile-devel libmpg123-devel
+libvorbis-devel libsoxr-devel
+
+Build and install to /usr/local/bin (sad, sacc):
+
+	make install-cygwin
+
+Optional Windows wrappers: copy cygwin/sad.cmd and cygwin/sacc.cmd to
+a folder on the Windows PATH. They assume Cygwin in C:\cygwin64.
+
+Use (Cygwin shell, PowerShell or cmd):
+
+	sad                    start the daemon (foreground)
+	sacc add FILE          queue a file; Windows paths are converted
+	sacc play
+	sacc status playback
+	sacc kill
+
+SAD_SOCK sets the socket path for both; default /tmp/sad-sock.
diff --git a/cygwin/sacc b/cygwin/sacc
new file mode 100644
index 0000000..f7967e1
--- /dev/null
+++ b/cygwin/sacc
@@ -0,0 +1,12 @@
+#!/bin/sh
+# sacc: send one sad command, e.g. "sacc add FILE", "sacc status playback".
+# Windows paths in "add" are converted with cygpath.
+PATH=/usr/local/bin:/usr/bin:$PATH
+sock=${SAD_SOCK:-/tmp/sad-sock}
+[ $# -eq 0 ] && { echo "usage: sacc command [args]" >&2; exit 1; }
+if [ "$1" = add ] && [ $# -ge 2 ]; then
+	shift
+	for p in "$@"; do printf 'add %s\n' "$(cygpath -ua "$p")"; done
+else
+	printf '%s\n' "$*"
+fi | socat - UNIX-CONNECT:"$sock"
diff --git a/cygwin/sacc.cmd b/cygwin/sacc.cmd
new file mode 100644
index 0000000..eecd633
--- /dev/null
+++ b/cygwin/sacc.cmd
@@ -0,0 +1,2 @@
+@echo off
+C:\cygwin64\bin\sh.exe /usr/local/bin/sacc %*
diff --git a/cygwin/sad.cmd b/cygwin/sad.cmd
new file mode 100644
index 0000000..da6e59f
--- /dev/null
+++ b/cygwin/sad.cmd
@@ -0,0 +1,3 @@
+@echo off
+set PATH=C:\cygwin64\bin;%PATH%
+C:\cygwin64\bin\sh.exe -c "exec /usr/local/bin/sad -f ${SAD_SOCK:-/tmp/sad-sock}"