new audio system?

This commit is contained in:
Anthony Samms
2025-09-15 10:58:44 -04:00
parent e34fce6012
commit 74c3414ccd
10 changed files with 2093 additions and 975 deletions

51
libs/audio/Makefile Normal file
View File

@@ -0,0 +1,51 @@
# Makefile for audio library
CC = gcc
CFLAGS = -Wall -Wextra -O3 -fPIC -std=c99
LDFLAGS = -shared -Wl,--export-dynamic
LIBS = -lportaudio -lsndfile -lsamplerate -lpthread -lm
# Detect OS for library naming
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LIBNAME = libaudio.dylib
CFLAGS += -I/usr/local/include -I/opt/homebrew/include
LDFLAGS = -shared -undefined dynamic_lookup
LDFLAGS += -L/usr/local/lib -L/opt/homebrew/lib
else ifeq ($(UNAME_S),Linux)
LIBNAME = libaudio.so
else
LIBNAME = libaudio.dll
LIBS += -lole32 -lwinmm
LDFLAGS = -shared
endif
SOURCES = $(wildcard *.c)
OBJECTS = $(SOURCES:.c=.o)
.PHONY: all clean install
all: $(LIBNAME)
$(LIBNAME): $(OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -f $(OBJECTS) $(LIBNAME)
install: $(LIBNAME)
sudo cp $(LIBNAME) /usr/local/lib/
sudo ldconfig 2>/dev/null || true
# Development target with debug symbols
debug: CFLAGS += -g -DDEBUG
debug: $(LIBNAME)
# Check dependencies
check-deps:
@echo "Checking dependencies..."
@pkg-config --exists portaudio-2.0 || (echo "PortAudio not found!" && false)
@pkg-config --exists sndfile || (echo "libsndfile not found!" && false)
@echo "All dependencies found!"