aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/puredata/xtract/a_blockswap~.pd29
-rw-r--r--src/fini.c48
-rw-r--r--src/xtract_globals_private.h36
3 files changed, 113 insertions, 0 deletions
diff --git a/examples/puredata/xtract/a_blockswap~.pd b/examples/puredata/xtract/a_blockswap~.pd
new file mode 100644
index 0000000..959ecfd
--- /dev/null
+++ b/examples/puredata/xtract/a_blockswap~.pd
@@ -0,0 +1,29 @@
+#N canvas 670 208 475 328 10;
+#X obj 70 159 samplerate~;
+#X obj 70 223 phasor~;
+#X msg 163 159 0.5;
+#X obj 23 10 inlet~;
+#X obj 23 34 tabsend~ input;
+#X obj 385 4 table input;
+#X obj 76 272 tabread~ input;
+#X obj 75 299 outlet~;
+#X obj 70 194 / \$1;
+#X obj 141 78 loadbang;
+#X text 232 72 Clone of zexy blockswap~;
+#X text 232 90 First argument gives block size;
+#X msg 209 158 \; input resize \$1;
+#X obj 141 109 t b b b;
+#X obj 75 249 *~ \$1;
+#X obj 209 135 f \$1;
+#X connect 0 0 8 0;
+#X connect 1 0 14 0;
+#X connect 2 0 1 1;
+#X connect 3 0 4 0;
+#X connect 6 0 7 0;
+#X connect 8 0 1 0;
+#X connect 9 0 13 0;
+#X connect 13 0 0 0;
+#X connect 13 1 2 0;
+#X connect 13 2 15 0;
+#X connect 14 0 6 0;
+#X connect 15 0 12 0;
diff --git a/src/fini.c b/src/fini.c
new file mode 100644
index 0000000..3ec9133
--- /dev/null
+++ b/src/fini.c
@@ -0,0 +1,48 @@
+/* libxtract feature extraction library
+ *
+ * Copyright (C) 2006 Jamie Bullock
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
+
+/* fini.c: Contains library destructor routine */
+
+#ifdef XTRACT_FFT
+#include <fftw3.h>
+#include "xtract_globals_private.h"
+#endif
+
+#ifdef __GNUC__
+__attribute__((destructor)) void fini()
+#else
+void _fini()
+#endif
+{
+#ifdef XTRACT_FFT
+ if(spectrum_plan != NULL)
+ fftwf_destroy_plan(spectrum_plan);
+ if(autocorrelation_fft_plan_1 != NULL)
+ fftwf_destroy_plan(autocorrelation_fft_plan_1);
+ if(autocorrelation_fft_plan_2 != NULL)
+ fftwf_destroy_plan(autocorrelation_fft_plan_2);
+ if(dct_plan != NULL)
+ fftwf_destroy_plan(dct_plan);
+ fftwf_cleanup();
+#endif
+}
+
+
+
diff --git a/src/xtract_globals_private.h b/src/xtract_globals_private.h
new file mode 100644
index 0000000..ab96044
--- /dev/null
+++ b/src/xtract_globals_private.h
@@ -0,0 +1,36 @@
+/* libxtract feature extraction library
+ *
+ * Copyright (C) 2006 Jamie Bullock
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
+ */
+
+/* xtract_globals_private.h: declares private global variables */
+
+#ifndef XTRACT_GLOBALS_PRIVATE_H
+#define XTRACT_GLOBALS_PRIVATE_H
+
+#ifdef XTRACT_FFT
+#include <fftw3.h>
+
+fftwf_plan spectrum_plan,
+ autocorrelation_fft_plan_1,
+ autocorrelation_fft_plan_2,
+ dct_plan;
+#endif
+
+#endif
+