diff options
author | Jamie Bullock <jamie@postlude.co.uk> | 2007-08-19 16:54:25 +0000 |
---|---|---|
committer | Jamie Bullock <jamie@postlude.co.uk> | 2007-08-19 16:54:25 +0000 |
commit | de66582f51c1e5ce57325d79b55292c64267f1ff (patch) | |
tree | 56fbfceb2a45a64d4f7e5c7191cbf8e0b8e1d3e1 /examples | |
parent | a6c2d64b740008f10ddfa35143632669e0db1a16 (diff) | |
download | LibXtract-de66582f51c1e5ce57325d79b55292c64267f1ff.tar.gz LibXtract-de66582f51c1e5ce57325d79b55292c64267f1ff.tar.bz2 LibXtract-de66582f51c1e5ce57325d79b55292c64267f1ff.zip |
Fixes for MSP example, and changed the fundamental estimators so that if they don't get a samplerate 44100 is assumed (I'm not sure if this is a good idea!).
Diffstat (limited to 'examples')
-rw-r--r-- | examples/MSP/Makefile | 10 | ||||
-rw-r--r-- | examples/MSP/xtract~.c | 27 |
2 files changed, 22 insertions, 15 deletions
diff --git a/examples/MSP/Makefile b/examples/MSP/Makefile index d990d85..8078861 100644 --- a/examples/MSP/Makefile +++ b/examples/MSP/Makefile @@ -7,7 +7,7 @@ current: universal MAXINCLUDE = /usr/local/include/max-includes
MSPINCLUDE = /usr/local/include/msp-includes
FRAMEWORKS = /Library/Frameworks
-INSTALLDIR = /Applications/MaxMSP\ 4.6/Cycling\ \'74/externals/
+INSTALLDIR = /Applications/Audio/MaxMSP\ 4.6.3/Cycling\ \'74/externals/
LIPO = /usr/bin/lipo
CC = gcc
@@ -15,7 +15,7 @@ CC = gcc CFLAGS = -F$(FRAMEWORKS) -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -x c -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -fmessage-length=0 -I$(MAXINCLUDE) -I$(MSPINCLUDE) -include macho-prefix.h -Werror
I386CFLAGS = -arch i386
-PPCCFLAGS = -arch ppc -faltivec -fasm-blocks
+PPCCFLAGS = -arch ppc -faltivec -fasm-blocks -Wno-unused
LDFLAGS = -F$(FRAMEWORKS) -L$(MAXINCLUDE) -L$(MSPINCLUDE) -framework Carbon -framework MaxAPI -framework MaxAudioAPI -Wl,-Y,1455 -bundle -L/usr/local/lib -lxtract
@@ -24,10 +24,10 @@ PPCLDFLAGS = -arch ppc universal:
$(CC) $(CFLAGS) $(I386CFLAGS) -o $(NAME)-i386.o -c $(NAME).c
-# $(CC) $(CFLAGS) $(PPCCFLAGS) -o $(NAME)-ppc.o -c $(NAME).c
+ $(CC) $(CFLAGS) $(PPCCFLAGS) -o $(NAME)-ppc.o -c $(NAME).c
$(CC) $(LDFLAGS) $(I386LDFLAGS) -o $(NAME)-i386 $(NAME)-i386.o
-# $(CC) $(LDFLAGS) $(PPCLDFLAGS) -o $(NAME)-ppc $(NAME)-ppc.o
-# $(LIPO) -create $(NAME)-ppc $(NAME)-i386 -output $(NAME)
+ $(CC) $(LDFLAGS) $(PPCLDFLAGS) -o $(NAME)-ppc $(NAME)-ppc.o
+ $(LIPO) -create $(NAME)-ppc $(NAME)-i386 -output $(NAME)
$(LIPO) -create $(NAME)-i386 -output $(NAME)
mkdir -p $(NAME).mxo/Contents/MacOS
cp Info.plist PkgInfo $(NAME).mxo/Contents/
diff --git a/examples/MSP/xtract~.c b/examples/MSP/xtract~.c index fcc2190..3f8115a 100644 --- a/examples/MSP/xtract~.c +++ b/examples/MSP/xtract~.c @@ -46,11 +46,11 @@ typedef struct _xtract { } t_xtract_tilde; static t_int *xtract_perform(t_int *w) { - t_sample *in = (t_sample *)(w[1]); + t_float *in = (t_float *)(w[1]); t_xtract_tilde *x = (t_xtract_tilde *)(w[2]); t_int N = (t_int)(w[3]); t_int return_code = 0; - float result = 0; + float result = 0.f; return_code = xtract[x->feature]((float *)in, N, x->argv, &result); @@ -65,8 +65,8 @@ static t_int *xtract_perform(t_int *w) { } static t_int *xtract_perform_vector(t_int *w) { - t_sample *in = (t_sample *)(w[1]); - t_sample *out = (t_sample *)(w[2]); + t_sample *in = (t_float *)(w[1]); + t_sample *out = (t_float *)(w[2]); float *temp_in, *temp_out; t_xtract_tilde *x = (t_xtract_tilde *)(w[3]); t_int N = (t_int)(w[4]), n; @@ -114,23 +114,31 @@ static void *xtract_tilde_new(t_symbol *me, t_int argc, t_atom *argv) { t_symbol *tmp; t_xtract_tilde *x = (t_xtract_tilde *)newobject(xtract_tilde_class); xtract_mel_filter *mf; - t_int n, N, f, F, n_args, type; + t_int n, N, f, F, n_args, type, blocksize; t_float *argv_max; xtract_function_descriptor_t *fd; char *p_name, *p_desc, *author; int year; + + blocksize = BLOCKSIZE; /* Default */ + tmp = NULL; p_name = p_desc = author = NULL; n_args = type = x->feature = 0; f = F = XTRACT_FEATURES; - N = BLOCKSIZE; + /* N = BLOCKSIZE;*/ x->argv = NULL; - tmp = argv->a_w.w_sym; /*atom_getsymbol(argv); */ + if(argc) + tmp = argv[0].a_w.w_sym; /*atom_getsymbol(argv); */ + if(argc > 1) + blocksize = (t_int)argv[1].a_w.w_long; + + N = blocksize; /* get function descriptors */ fd = (xtract_function_descriptor_t *)xtract_make_descriptors(); @@ -186,7 +194,6 @@ static void *xtract_tilde_new(t_symbol *me, t_int argc, t_atom *argv) { else post("xtract~: No arguments given"); - /* do init if needed */ if(x->feature == XTRACT_MFCC){ @@ -224,7 +231,7 @@ static void *xtract_tilde_new(t_symbol *me, t_int argc, t_atom *argv) { else x->feature_type = XTRACT_SCALAR; /* argv through right inlet */ - inlet_new((t_pxobject *)x, "argv"); + inlet_new((t_pxobject *)x, "list"); /* DSP inlet */ dsp_setup((t_pxobject *)x, 1); @@ -294,7 +301,7 @@ int main(void) { A_GIMME, 0); addmess((method)xtract_tilde_dsp, "dsp", A_CANT, 0); - addmess((method)xtract_tilde_get_args, "argv", A_GIMME, 0); + addmess((method)xtract_tilde_get_args, "list", A_GIMME, 0); addmess((method)xtract_tilde_show_help, "help", A_DEFSYM, 0); dsp_initclass(); //class_setname("xtract~", "xtract~"); |