Skip to content

Commit

Permalink
add fftw to build
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-wes committed Dec 30, 2024
1 parent 6426bd9 commit 4865cc1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/compile-and-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:

- name: install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libfftw3-dev
git clone --branch=${{ env.PD_VERSION }} --depth=1 https://github.com/pure-data/pure-data.git
- name: make
Expand Down
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ class.sources = \
faccwrap~.c \
faccleak~.c \
nchans~.c \
mc_conv~.c \
mc_conv2d~.c \
noisen~.c \
qacc~.c \
qmul~.c \
Expand All @@ -20,7 +18,6 @@ class.sources = \
urn~.c \
mc_route~.c \
zc~.c \
frft~.c \
ambi2dir.c \
tetra2pos.c \
tabsmear~.c \
Expand Down Expand Up @@ -54,10 +51,17 @@ datafiles = \
${empty}
# add nchans~ help

# FFTW3 specific flags
cflags += -I$(FFTW_INCLUDE)
ldflags += -L$(FFTW_LIB)
ldlibs += -lfftw3
# List externals that need FFTW3
FFTW_SOURCES = \
frft~.c \
mc_conv~.c \
mc_conv2d~.c \


# Add FFTW flags only to specific externals
$(FFTW_SOURCES:.c=.class.sources.o): cflags += -I$(FFTW_INCLUDE)
$(FFTW_SOURCES:.c=.class.sources.o): ldflags += -L$(FFTW_LIB)
$(FFTW_SOURCES:.c=.class.sources.o): ldlibs += -lfftw3

objectsdir = ./build
PDLIBBUILDER_DIR=./pd-lib-builder
Expand Down
10 changes: 7 additions & 3 deletions faccleak~.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,14 @@ static void *faccleak_tilde_new(t_floatarg leak_rate)
{
t_faccleak_tilde *x = (t_faccleak_tilde *)pd_new(faccleak_tilde_class);

// Store initial leak rate, with bounds checking
x->init_leak = leak_rate;
if (x->init_leak < 0.0f) x->init_leak = 0.0f;
if (x->init_leak > 1.0f) x->init_leak = 1.0f;

// Initialize
x->n_channels = 0;
x->leak_nchans = 1; // Start with 1 leak channel
x->init_leak = leak_rate; // Store initial leak rate
x->leak_nchans = 1;

x->in = (t_sample **)getbytes(sizeof(t_sample *));
x->leak = (t_sample **)getbytes(sizeof(t_sample *));
Expand Down Expand Up @@ -174,7 +178,7 @@ void faccleak_tilde_setup(void)
(t_newmethod)faccleak_tilde_new,
(t_method)faccleak_tilde_free,
sizeof(t_faccleak_tilde),
CLASS_DEFAULT | CLASS_MULTICHANNEL,
CLASS_MULTICHANNEL,
A_DEFFLOAT, 0);

class_addmethod(faccleak_tilde_class,
Expand Down
2 changes: 1 addition & 1 deletion faccwrap~.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void faccwrap_tilde_setup(void)
(t_newmethod)faccwrap_tilde_new,
(t_method)faccwrap_tilde_free,
sizeof(t_faccwrap_tilde),
CLASS_DEFAULT | CLASS_MULTICHANNEL,
CLASS_MULTICHANNEL,
A_DEFFLOAT, A_DEFFLOAT, 0);

class_addmethod(faccwrap_tilde_class, (t_method)faccwrap_tilde_dsp, gensym("dsp"), A_CANT, 0);
Expand Down

0 comments on commit 4865cc1

Please sign in to comment.