aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFranz Zotter <fzotter@users.sourceforge.net>2008-10-23 08:33:15 +0000
committerFranz Zotter <fzotter@users.sourceforge.net>2008-10-23 08:33:15 +0000
commit43720f34cf581a11a23b12d13c23a2a82ddbcdb8 (patch)
tree767853acd13ed51ed40c718a98cc691d7168568a /src
parenta8b18d53387b5ab1cbae7cd7c8a872a0473d1130 (diff)
made changes to account for iemmatrix structures in the new files.
mtx_pack~ crashes (!) svn path=/trunk/externals/iem/iemmatrix/; revision=10340
Diffstat (limited to 'src')
-rw-r--r--src/mtx_dispersive_dline.c7
-rw-r--r--src/mtx_pack~.c7
-rw-r--r--src/mtx_sndfileread.c35
3 files changed, 43 insertions, 6 deletions
diff --git a/src/mtx_dispersive_dline.c b/src/mtx_dispersive_dline.c
index 369ab96..e180075 100644
--- a/src/mtx_dispersive_dline.c
+++ b/src/mtx_dispersive_dline.c
@@ -39,7 +39,7 @@ outlet: C rows and L colums matrix with current state of the dispersive delay
*/
-#include "m_pd.h"
+#include "iemmatrix.h"
static t_class *mtx_dispersive_dline_class;
@@ -240,3 +240,8 @@ void mtx_dispersive_dline_setup(void)
class_addmethod(mtx_dispersive_dline_class, (t_method)mtx_dispersive_dline_helper, gensym("help"), 0);
}
+
+void iemtx_dispersive_dline_setup(void)
+{
+ mtx_dispersive_dline_setup();
+}
diff --git a/src/mtx_pack~.c b/src/mtx_pack~.c
index c935d10..8afe3a2 100644
--- a/src/mtx_pack~.c
+++ b/src/mtx_pack~.c
@@ -1,4 +1,4 @@
-#include "m_pd.h"
+#include "iemmatrix.h"
#define MTX_PACK_MAXCHANNELS 200
static t_class *mtx_pack_tilde_class;
@@ -77,4 +77,9 @@ void mtx_pack_tilde_setup (void)
class_addmethod (mtx_pack_tilde_class, (t_method) mTxPackTildeDsp, gensym("dsp"),0);
}
+void iemtx_pack__setup(void)
+{
+ mtx_pack_tilde_setup();
+}
+
diff --git a/src/mtx_sndfileread.c b/src/mtx_sndfileread.c
index 06ae1dc..041e2bd 100644
--- a/src/mtx_sndfileread.c
+++ b/src/mtx_sndfileread.c
@@ -1,6 +1,7 @@
-#include <stdio.h>
-#include <sndfile.h>
-#include "m_pd.h"
+#ifdef HAVE_SNDFILE_H
+# include <sndfile.h>
+#endif
+#include "iemmatrix.h"
#ifdef __WIN32__
# include <io.h>
@@ -103,8 +104,10 @@ static t_class *mtx_sndfileread_class;
typedef struct mtx_sndfileread
{
t_object x_ob;
+#ifdef HAVE_SNDFILE_H
SNDFILE *x_sndfileread;
SF_INFO x_sfinfo;
+#endif
t_outlet *x_message_outlet;
t_outlet *x_readybang_outlet;
t_canvas *x_canvas;
@@ -117,9 +120,11 @@ typedef struct mtx_sndfileread
static void mtx_sndfileread_close (t_mtx_sndfileread *x)
{
+#ifdef HAVE_SNDFILE_H
if(x->x_sndfileread)
sf_close (x->x_sndfileread);
x->x_sndfileread=0;
+#endif
if(x->x_outlist)
freebytes(x->x_outlist, sizeof(t_atom)*(2+x->num_chan*x->num_frames));
@@ -132,6 +137,7 @@ static void mtx_sndfileread_close (t_mtx_sndfileread *x)
static void mtx_sndfileread_open (t_mtx_sndfileread *x, t_symbol *s, t_symbol*type)
{
+#ifdef HAVE_SNDFILE_H
char filenamebuf[MAXPDSTRING], *filenamebufptr;
char*dirname=canvas_getdir(x->x_canvas)->s_name;
int fd;
@@ -150,10 +156,14 @@ static void mtx_sndfileread_open (t_mtx_sndfileread *x, t_symbol *s, t_symbol*ty
return;
}
x->num_chan = x->x_sfinfo.channels;
+#else
+ pd_error(x,"mtx_sndfileread: compiled without libsndfile: no file opened!");
+#endif
}
static void mtx_sndfileread_frame (t_mtx_sndfileread *x)
{
+#ifdef HAVE_SNDFILE_H
int n;
t_atom *ptr;
@@ -189,11 +199,15 @@ static void mtx_sndfileread_frame (t_mtx_sndfileread *x)
}
outlet_anything(x->x_message_outlet,gensym("matrix"),x->num_chan+2,x->x_outlist);
}
+#else
+ pd_error(x,"mtx_sndfileread: compiled without libsndfile: no file opened for reading!");
+#endif
}
static void mtx_sndfileread_frames (t_mtx_sndfileread *x, t_float f)
{
+#ifdef HAVE_SNDFILE_H
int n,n2,c;
sf_count_t frames_read;
int num_frames=(int)f;
@@ -239,7 +253,9 @@ static void mtx_sndfileread_frames (t_mtx_sndfileread *x, t_float f)
outlet_bang(x->x_readybang_outlet);
}
}
-
+#else
+ pd_error(x,"mtx_sndfileread: compiled without libsndfile: no file opened!");
+#endif
}
static void mtx_sndfileread_free (t_mtx_sndfileread *x)
@@ -254,7 +270,11 @@ static void *mtx_sndfileread_new(void)
t_mtx_sndfileread *x = (t_mtx_sndfileread *)pd_new(mtx_sndfileread_class);
x->x_message_outlet = outlet_new(&x->x_ob, &s_list);
x->x_readybang_outlet = outlet_new(&x->x_ob, &s_bang);
+#ifdef HAVE_SNDFILE_H
x->x_sndfileread=0;
+#else
+ pd_error(x,"mtx_sndfileread won't work: compiled without libsndfile!");
+#endif
x->num_chan=0;
x->num_frames=0;
x->x_canvas = canvas_getcurrent();
@@ -269,6 +289,13 @@ void mtx_sndfileread_setup(void)
class_addmethod(mtx_sndfileread_class, (t_method)mtx_sndfileread_close, gensym("close"), A_NULL, 0);
class_addbang(mtx_sndfileread_class, (t_method)mtx_sndfileread_frame);
class_addfloat(mtx_sndfileread_class, (t_method)mtx_sndfileread_frames);
+#ifndef HAVE_SNDFILE_H
+ post("mtx_sndfileread won't work: compiled without libsndfile!");
+#endif
+}
+void iemtx_sndfileread_setup (void)
+{
+ mtx_sndfileread_setup();
}