summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/extra/m_pd.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/extra/m_pd.h')
-rw-r--r--apps/plugins/pdbox/PDa/extra/m_pd.h649
1 files changed, 0 insertions, 649 deletions
diff --git a/apps/plugins/pdbox/PDa/extra/m_pd.h b/apps/plugins/pdbox/PDa/extra/m_pd.h
index 403c5b382b..f08fdccf93 100644
--- a/apps/plugins/pdbox/PDa/extra/m_pd.h
+++ b/apps/plugins/pdbox/PDa/extra/m_pd.h
@@ -648,653 +648,4 @@ defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */
648 648
649#define __m_pd_h_ 649#define __m_pd_h_
650#endif /* __m_pd_h_ */ 650#endif /* __m_pd_h_ */
651/* Copyright (c) 1997-1999 Miller Puckette.
652* For information on usage and redistribution, and for a DISCLAIMER OF ALL
653* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
654
655#ifndef __m_pd_h_
656
657#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
658extern "C" {
659#endif
660
661#define PD_VERSION 0.37 /* oops, don't use this... */ */
662#define PD_MAJOR_VERSION 0 /* ... use these two instead. */
663#define PD_MINOR_VERSION 37
664
665/* old name for "MSW" flag -- we have to take it for the sake of many old
666"nmakefiles" for externs, which will define NT and not MSW */
667#if defined(NT) && !defined(MSW)
668#define MSW
669#endif
670
671#ifdef MSW
672// #pragma warning( disable : 4091 )
673#pragma warning( disable : 4305 ) /* uncast const double to float */
674#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */
675#pragma warning( disable : 4101 ) /* unused automatic variables */
676#endif /* MSW */
677
678 /* the external storage class is "extern" in UNIX; in MSW it's ugly. */
679#ifdef MSW
680#ifdef PD_INTERNAL
681#define EXTERN __declspec(dllexport) extern
682#else
683#define EXTERN __declspec(dllimport) extern
684#endif /* PD_INTERNAL */
685#else
686#define EXTERN extern
687#endif /* MSW */
688
689 /* and depending on the compiler, hidden data structures are
690 declared differently: */
691#if defined( __GNUC__) || defined( __BORLANDC__ ) || defined( __MWERKS__ )
692#define EXTERN_STRUCT struct
693#else
694#define EXTERN_STRUCT extern struct
695#endif
696
697
698#if !defined(_SIZE_T) && !defined(_SIZE_T_)
699#include <stddef.h> /* just for size_t -- how lame! */
700#endif
701
702#define MAXPDSTRING 1000 /* use this for anything you want */
703#define MAXPDARG 5 /* max number of args we can typecheck today */
704
705 /* signed and unsigned integer types the size of a pointer: */
706#ifdef __alpha__
707typedef long t_int;
708#else
709typedef int t_int;
710#endif
711
712typedef float t_float; /* a floating-point number at most the same size */
713typedef float t_floatarg; /* floating-point type for function calls */
714
715typedef struct _symbol
716{
717 char *s_name;
718 struct _class **s_thing;
719 struct _symbol *s_next;
720} t_symbol;
721
722EXTERN_STRUCT _array;
723#define t_array struct _array /* g_canvas.h */
724
725/* pointers to glist and array elements go through a "stub" which sticks
726around after the glist or array is freed. The stub itself is deleted when
727both the glist/array is gone and the refcount is zero, ensuring that no
728gpointers are pointing here. */
729
730#define GP_NONE 0 /* the stub points nowhere (has been cut off) */
731#define GP_GLIST 1 /* the stub points to a glist element */
732#define GP_ARRAY 2 /* ... or array */
733 651
734typedef struct _gstub
735{
736 union
737 {
738 struct _glist *gs_glist; /* glist we're in */
739 struct _array *gs_array; /* array we're in */
740 } gs_un;
741 int gs_which; /* GP_GLIST/GP_ARRAY */
742 int gs_refcount; /* number of gpointers pointing here */
743} t_gstub;
744
745typedef struct _gpointer /* pointer to a gobj in a glist */
746{
747 union
748 {
749 struct _scalar *gp_scalar; /* scalar we're in (if glist) */
750 union word *gp_w; /* raw data (if array) */
751 } gp_un;
752 int gp_valid; /* number which must match gpointee */
753 t_gstub *gp_stub; /* stub which points to glist/array */
754} t_gpointer;
755
756typedef union word
757{
758 t_float w_float;
759 t_symbol *w_symbol;
760 t_gpointer *w_gpointer;
761 t_array *w_array;
762 struct _glist *w_list;
763 int w_index;
764} t_word;
765
766typedef enum
767{
768 A_NULL,
769 A_FLOAT,
770 A_SYMBOL,
771 A_POINTER,
772 A_SEMI,
773 A_COMMA,
774 A_DEFFLOAT,
775 A_DEFSYM,
776 A_DOLLAR,
777 A_DOLLSYM,
778 A_GIMME,
779 A_CANT
780} t_atomtype;
781
782#define A_DEFSYMBOL A_DEFSYM /* better name for this */
783
784typedef struct _atom
785{
786 t_atomtype a_type;
787 union word a_w;
788} t_atom;
789
790EXTERN_STRUCT _class;
791#define t_class struct _class
792
793EXTERN_STRUCT _outlet;
794#define t_outlet struct _outlet
795
796EXTERN_STRUCT _inlet;
797#define t_inlet struct _inlet
798
799EXTERN_STRUCT _binbuf;
800#define t_binbuf struct _binbuf
801
802EXTERN_STRUCT _clock;
803#define t_clock struct _clock
804
805EXTERN_STRUCT _outconnect;
806#define t_outconnect struct _outconnect
807
808EXTERN_STRUCT _glist;
809#define t_glist struct _glist
810#define t_canvas struct _glist /* LATER lose this */
811
812typedef t_class *t_pd; /* pure datum: nothing but a class pointer */
813
814typedef struct _gobj /* a graphical object */
815{
816 t_pd g_pd; /* pure datum header (class) */
817 struct _gobj *g_next; /* next in list */
818} t_gobj;
819
820typedef struct _scalar /* a graphical object holding data */
821{
822 t_gobj sc_gobj; /* header for graphical object */
823 t_symbol *sc_template; /* template name (LATER replace with pointer) */
824 t_word sc_vec[1]; /* indeterminate-length array of words */
825} t_scalar;
826
827typedef struct _text /* patchable object - graphical, with text */
828{
829 t_gobj te_g; /* header for graphical object */
830 t_binbuf *te_binbuf; /* holder for the text */
831 t_outlet *te_outlet; /* linked list of outlets */
832 t_inlet *te_inlet; /* linked list of inlets */
833 short te_xpix; /* x&y location (within the toplevel) */
834 short te_ypix;
835 short te_width; /* requested width in chars, 0 if auto */
836 unsigned int te_type:2; /* from defs below */
837} t_text;
838
839#define T_TEXT 0 /* just a textual comment */
840#define T_OBJECT 1 /* a MAX style patchable object */
841#define T_MESSAGE 2 /* a MAX stype message */
842#define T_ATOM 3 /* a cell to display a number or symbol */
843
844#define te_pd te_g.g_pd
845
846 /* t_object is synonym for t_text (LATER unify them) */
847
848typedef struct _text t_object;
849
850#define ob_outlet te_outlet
851#define ob_inlet te_inlet
852#define ob_binbuf te_binbuf
853#define ob_pd te_g.g_pd
854#define ob_g te_g
855
856typedef void (*t_method)(void);
857typedef void *(*t_newmethod)( void);
858typedef void (*t_gotfn)(void *x, ...);
859
860/* ---------------- pre-defined objects and symbols --------------*/
861EXTERN t_pd pd_objectmaker; /* factory for creating "object" boxes */
862EXTERN t_pd pd_canvasmaker; /* factory for creating canvases */
863EXTERN t_symbol s_pointer;
864EXTERN t_symbol s_float;
865EXTERN t_symbol s_symbol;
866EXTERN t_symbol s_bang;
867EXTERN t_symbol s_list;
868EXTERN t_symbol s_anything;
869EXTERN t_symbol s_signal;
870EXTERN t_symbol s__N;
871EXTERN t_symbol s__X;
872EXTERN t_symbol s_x;
873EXTERN t_symbol s_y;
874EXTERN t_symbol s_;
875
876/* --------- prototypes from the central message system ----------- */
877EXTERN void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv);
878EXTERN void pd_forwardmess(t_pd *x, int argc, t_atom *argv);
879EXTERN t_symbol *gensym(char *s);
880EXTERN t_gotfn getfn(t_pd *x, t_symbol *s);
881EXTERN t_gotfn zgetfn(t_pd *x, t_symbol *s);
882EXTERN void nullfn(void);
883EXTERN void pd_vmess(t_pd *x, t_symbol *s, char *fmt, ...);
884#define mess0(x, s) ((*getfn((x), (s)))((x)))
885#define mess1(x, s, a) ((*getfn((x), (s)))((x), (a)))
886#define mess2(x, s, a,b) ((*getfn((x), (s)))((x), (a),(b)))
887#define mess3(x, s, a,b,c) ((*getfn((x), (s)))((x), (a),(b),(c)))
888#define mess4(x, s, a,b,c,d) ((*getfn((x), (s)))((x), (a),(b),(c),(d)))
889#define mess5(x, s, a,b,c,d,e) ((*getfn((x), (s)))((x), (a),(b),(c),(d),(e)))
890EXTERN void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv);
891EXTERN t_pd *pd_newest(void);
892
893/* --------------- memory management -------------------- */
894EXTERN void *getbytes(size_t nbytes);
895EXTERN void *getzbytes(size_t nbytes);
896EXTERN void *copybytes(void *src, size_t nbytes);
897EXTERN void freebytes(void *x, size_t nbytes);
898EXTERN void *resizebytes(void *x, size_t oldsize, size_t newsize);
899
900/* -------------------- atoms ----------------------------- */
901
902#define SETSEMI(atom) ((atom)->a_type = A_SEMI, (atom)->a_w.w_index = 0)
903#define SETCOMMA(atom) ((atom)->a_type = A_COMMA, (atom)->a_w.w_index = 0)
904#define SETPOINTER(atom, gp) ((atom)->a_type = A_POINTER, \
905 (atom)->a_w.w_gpointer = (gp))
906#define SETFLOAT(atom, f) ((atom)->a_type = A_FLOAT, (atom)->a_w.w_float = (f))
907#define SETSYMBOL(atom, s) ((atom)->a_type = A_SYMBOL, \
908 (atom)->a_w.w_symbol = (s))
909#define SETDOLLAR(atom, n) ((atom)->a_type = A_DOLLAR, \
910 (atom)->a_w.w_index = (n))
911#define SETDOLLSYM(atom, s) ((atom)->a_type = A_DOLLSYM, \
912 (atom)->a_w.w_symbol= (s))
913
914EXTERN t_float atom_getfloat(t_atom *a);
915EXTERN t_int atom_getint(t_atom *a);
916EXTERN t_symbol *atom_getsymbol(t_atom *a);
917EXTERN t_symbol *atom_gensym(t_atom *a);
918EXTERN t_float atom_getfloatarg(int which, int argc, t_atom *argv);
919EXTERN t_int atom_getintarg(int which, int argc, t_atom *argv);
920EXTERN t_symbol *atom_getsymbolarg(int which, int argc, t_atom *argv);
921
922EXTERN void atom_string(t_atom *a, char *buf, unsigned int bufsize);
923
924/* ------------------ binbufs --------------- */
925
926EXTERN t_binbuf *binbuf_new(void);
927EXTERN void binbuf_free(t_binbuf *x);
928EXTERN t_binbuf *binbuf_duplicate(t_binbuf *y);
929
930EXTERN void binbuf_text(t_binbuf *x, char *text, size_t size);
931EXTERN void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp);
932EXTERN void binbuf_clear(t_binbuf *x);
933EXTERN void binbuf_add(t_binbuf *x, int argc, t_atom *argv);
934EXTERN void binbuf_addv(t_binbuf *x, char *fmt, ...);
935EXTERN void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y);
936EXTERN void binbuf_addsemi(t_binbuf *x);
937EXTERN void binbuf_restore(t_binbuf *x, int argc, t_atom *argv);
938EXTERN void binbuf_print(t_binbuf *x);
939EXTERN int binbuf_getnatom(t_binbuf *x);
940EXTERN t_atom *binbuf_getvec(t_binbuf *x);
941EXTERN void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv);
942EXTERN int binbuf_read(t_binbuf *b, char *filename, char *dirname,
943 int crflag);
944EXTERN int binbuf_read_via_path(t_binbuf *b, char *filename, char *dirname,
945 int crflag);
946EXTERN int binbuf_write(t_binbuf *x, char *filename, char *dir,
947 int crflag);
948EXTERN void binbuf_evalfile(t_symbol *name, t_symbol *dir);
949EXTERN t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av,
950 int tonew);
951
952/* ------------------ clocks --------------- */
953
954typedef long long t_time;
955EXTERN t_clock *clock_new(void *owner, t_method fn);
956EXTERN void clock_set(t_clock *x, t_time systime);
957EXTERN void clock_delay(t_clock *x, t_time delaytime);
958EXTERN void clock_unset(t_clock *x);
959EXTERN t_time clock_getlogicaltime(void);
960EXTERN t_time clock_getsystime(void); /* OBSOLETE; use clock_getlogicaltime() */
961EXTERN t_time clock_gettimesince(t_time prevsystime);
962EXTERN t_time clock_getsystimeafter(t_time delaytime);
963EXTERN void clock_free(t_clock *x);
964
965/* ----------------- pure data ---------------- */
966EXTERN t_pd *pd_new(t_class *cls);
967EXTERN void pd_free(t_pd *x);
968EXTERN void pd_bind(t_pd *x, t_symbol *s);
969EXTERN void pd_unbind(t_pd *x, t_symbol *s);
970EXTERN t_pd *pd_findbyclass(t_symbol *s, t_class *c);
971EXTERN void pd_pushsym(t_pd *x);
972EXTERN void pd_popsym(t_pd *x);
973EXTERN t_symbol *pd_getfilename(void);
974EXTERN t_symbol *pd_getdirname(void);
975EXTERN void pd_bang(t_pd *x);
976EXTERN void pd_pointer(t_pd *x, t_gpointer *gp);
977EXTERN void pd_float(t_pd *x, t_float f);
978EXTERN void pd_symbol(t_pd *x, t_symbol *s);
979EXTERN void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv);
980EXTERN void pd_anything(t_pd *x, t_symbol *s, int argc, t_atom *argv);
981#define pd_class(x) (*(x))
982
983/* ----------------- pointers ---------------- */
984EXTERN void gpointer_init(t_gpointer *gp);
985EXTERN void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto);
986EXTERN void gpointer_unset(t_gpointer *gp);
987EXTERN int gpointer_check(const t_gpointer *gp, int headok);
988
989/* ----------------- patchable "objects" -------------- */
990EXTERN_STRUCT _inlet;
991#define t_inlet struct _inlet
992EXTERN_STRUCT _outlet;
993#define t_outlet struct _outlet
994
995EXTERN t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1,
996 t_symbol *s2);
997EXTERN t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp);
998EXTERN t_inlet *floatinlet_new(t_object *owner, t_float *fp);
999EXTERN t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp);
1000EXTERN void inlet_free(t_inlet *x);
1001
1002EXTERN t_outlet *outlet_new(t_object *owner, t_symbol *s);
1003EXTERN void outlet_bang(t_outlet *x);
1004EXTERN void outlet_pointer(t_outlet *x, t_gpointer *gp);
1005EXTERN void outlet_float(t_outlet *x, t_float f);
1006EXTERN void outlet_symbol(t_outlet *x, t_symbol *s);
1007EXTERN void outlet_list(t_outlet *x, t_symbol *s, int argc, t_atom *argv);
1008EXTERN void outlet_anything(t_outlet *x, t_symbol *s, int argc, t_atom *argv);
1009EXTERN t_symbol *outlet_getsymbol(t_outlet *x);
1010EXTERN void outlet_free(t_outlet *x);
1011EXTERN t_object *pd_checkobject(t_pd *x);
1012
1013
1014/* -------------------- canvases -------------- */
1015
1016EXTERN void glob_setfilename(void *dummy, t_symbol *name, t_symbol *dir);
1017
1018EXTERN void canvas_setargs(int argc, t_atom *argv);
1019EXTERN void canvas_getargs(int *argcp, t_atom **argvp);
1020EXTERN t_symbol *canvas_getcurrentdir(void);
1021EXTERN t_glist *canvas_getcurrent(void);
1022EXTERN void canvas_makefilename(t_glist *c, char *file,
1023 char *result,int resultsize);
1024EXTERN t_symbol *canvas_getdir(t_glist *x);
1025EXTERN int sys_fontwidth(int fontsize);
1026EXTERN int sys_fontheight(int fontsize);
1027EXTERN void canvas_dataproperties(t_glist *x, t_scalar *sc, t_binbuf *b);
1028
1029/* ---------------- widget behaviors ---------------------- */
1030
1031EXTERN_STRUCT _widgetbehavior;
1032#define t_widgetbehavior struct _widgetbehavior
1033
1034EXTERN_STRUCT _parentwidgetbehavior;
1035#define t_parentwidgetbehavior struct _parentwidgetbehavior
1036EXTERN t_parentwidgetbehavior *pd_getparentwidget(t_pd *x);
1037
1038/* -------------------- classes -------------- */
1039
1040#define CLASS_DEFAULT 0 /* flags for new classes below */
1041#define CLASS_PD 1
1042#define CLASS_GOBJ 2
1043#define CLASS_PATCHABLE 3
1044#define CLASS_NOINLET 8
1045
1046#define CLASS_TYPEMASK 3
1047
1048
1049EXTERN t_class *class_new(t_symbol *name, t_newmethod newmethod,
1050 t_method freemethod, size_t size, int flags, t_atomtype arg1, ...);
1051EXTERN void class_addcreator(t_newmethod newmethod, t_symbol *s,
1052 t_atomtype type1, ...);
1053EXTERN void class_addmethod(t_class *c, t_method fn, t_symbol *sel,
1054 t_atomtype arg1, ...);
1055EXTERN void class_addbang(t_class *c, t_method fn);
1056EXTERN void class_addpointer(t_class *c, t_method fn);
1057EXTERN void class_doaddfloat(t_class *c, t_method fn);
1058EXTERN void class_addsymbol(t_class *c, t_method fn);
1059EXTERN void class_addlist(t_class *c, t_method fn);
1060EXTERN void class_addanything(t_class *c, t_method fn);
1061EXTERN void class_sethelpsymbol(t_class *c, t_symbol *s);
1062EXTERN void class_setwidget(t_class *c, t_widgetbehavior *w);
1063EXTERN void class_setparentwidget(t_class *c, t_parentwidgetbehavior *w);
1064EXTERN t_parentwidgetbehavior *class_parentwidget(t_class *c);
1065EXTERN char *class_getname(t_class *c);
1066EXTERN char *class_gethelpname(t_class *c);
1067EXTERN void class_setdrawcommand(t_class *c);
1068EXTERN int class_isdrawcommand(t_class *c);
1069EXTERN void class_domainsignalin(t_class *c, int onset);
1070#define CLASS_MAINSIGNALIN(c, type, field) \
1071 class_domainsignalin(c, (char *)(&((type *)0)->field) - (char *)0)
1072
1073 /* prototype for functions to save Pd's to a binbuf */
1074typedef void (*t_savefn)(t_gobj *x, t_binbuf *b);
1075EXTERN void class_setsavefn(t_class *c, t_savefn f);
1076EXTERN t_savefn class_getsavefn(t_class *c);
1077 /* prototype for functions to open properties dialogs */
1078typedef void (*t_propertiesfn)(t_gobj *x, struct _glist *glist);
1079EXTERN void class_setpropertiesfn(t_class *c, t_propertiesfn f);
1080EXTERN t_propertiesfn class_getpropertiesfn(t_class *c);
1081
1082#ifndef PD_CLASS_DEF
1083#define class_addbang(x, y) class_addbang((x), (t_method)(y))
1084#define class_addpointer(x, y) class_addpointer((x), (t_method)(y))
1085#define class_addfloat(x, y) class_doaddfloat((x), (t_method)(y))
1086#define class_addsymbol(x, y) class_addsymbol((x), (t_method)(y))
1087#define class_addlist(x, y) class_addlist((x), (t_method)(y))
1088#define class_addanything(x, y) class_addanything((x), (t_method)(y))
1089#endif
1090
1091/* ------------ printing --------------------------------- */
1092EXTERN void post(char *fmt, ...);
1093EXTERN void startpost(char *fmt, ...);
1094EXTERN void poststring(char *s);
1095EXTERN void postfloat(float f);
1096EXTERN void postatom(int argc, t_atom *argv);
1097EXTERN void endpost(void);
1098EXTERN void error(char *fmt, ...);
1099EXTERN void bug(char *fmt, ...);
1100EXTERN void pd_error(void *object, char *fmt, ...);
1101EXTERN void sys_logerror(char *object, char *s);
1102EXTERN void sys_unixerror(char *object);
1103EXTERN void sys_ouch(void);
1104
1105#ifdef __linux__
1106EXTERN char* sys_get_path( void);
1107#endif
1108EXTERN void sys_addpath(const char* p);
1109
1110
1111/* ------------ system interface routines ------------------- */
1112EXTERN int sys_isreadablefile(const char *name);
1113EXTERN void sys_bashfilename(const char *from, char *to);
1114EXTERN void sys_unbashfilename(const char *from, char *to);
1115EXTERN int open_via_path(const char *name, const char *ext, const char *dir,
1116 char *dirresult, char **nameresult, unsigned int size, int bin);
1117EXTERN int sched_geteventno(void);
1118EXTERN double sys_getrealtime(void);
1119
1120
1121/* ------------ threading ------------------- */
1122/* T.Grill - see m_sched.c */
1123
1124EXTERN void sys_lock(void);
1125EXTERN void sys_unlock(void);
1126EXTERN int sys_trylock(void);
1127
1128
1129/* --------------- signals ----------------------------------- */
1130
1131#define MAXLOGSIG 32
1132#define MAXSIGSIZE (1 << MAXLOGSIG)
1133#ifndef FIXEDPOINT
1134typedef float t_sample;
1135#else
1136#include "m_fixed.h"
1137#endif
1138
1139
1140typedef struct _signal
1141{
1142 int s_n; /* number of points in the array */
1143 t_sample *s_vec; /* the array */
1144 float s_sr; /* sample rate */
1145 int s_refcount; /* number of times used */
1146 int s_isborrowed; /* whether we're going to borrow our array */
1147 struct _signal *s_borrowedfrom; /* signal to borrow it from */
1148 struct _signal *s_nextfree; /* next in freelist */
1149 struct _signal *s_nextused; /* next in used list */
1150} t_signal;
1151
1152
1153typedef t_int *(*t_perfroutine)(t_int *args);
1154
1155EXTERN t_int *plus_perform(t_int *args);
1156EXTERN t_int *zero_perform(t_int *args);
1157EXTERN t_int *copy_perform(t_int *args);
1158
1159EXTERN void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n);
1160EXTERN void dsp_add_copy(t_sample *in, t_sample *out, int n);
1161EXTERN void dsp_add_scalarcopy(t_sample *in, t_sample *out, int n);
1162EXTERN void dsp_add_zero(t_sample *out, int n);
1163
1164EXTERN int sys_getblksize(void);
1165EXTERN float sys_getsr(void);
1166EXTERN int sys_get_inchannels(void);
1167EXTERN int sys_get_outchannels(void);
1168
1169EXTERN void dsp_add(t_perfroutine f, int n, ...);
1170EXTERN void dsp_addv(t_perfroutine f, int n, t_int *vec);
1171EXTERN void pd_fft(float *buf, int npoints, int inverse);
1172EXTERN int ilog2(int n);
1173
1174EXTERN void mayer_fht(t_sample *fz, int n);
1175EXTERN void mayer_fft(int n, t_sample *real, t_sample *imag);
1176EXTERN void mayer_ifft(int n, t_sample *real, t_sample *imag);
1177EXTERN void mayer_realfft(int n, t_sample *real);
1178EXTERN void mayer_realifft(int n, t_sample *real);
1179
1180EXTERN t_sample *cos_table;
1181
1182#define LOGCOSTABSIZE 9
1183#define COSTABSIZE (1<<LOGCOSTABSIZE)
1184
1185EXTERN int canvas_suspend_dsp(void);
1186EXTERN void canvas_resume_dsp(int oldstate);
1187EXTERN void canvas_update_dsp(void);
1188
1189/* IOhannes { (up/downsampling) */
1190typedef struct _resample
1191{
1192 int method; /* up/downsampling method ID */
1193
1194 t_int downsample; /* downsampling factor */
1195 t_int upsample; /* upsampling factor */
1196
1197 t_sample *s_vec; /* here we hold the resampled data */
1198 int s_n;
1199
1200 t_sample *coeffs; /* coefficients for filtering... */
1201 int coefsize;
1202
1203 t_sample *buffer; /* buffer for filtering */
1204 int bufsize;
1205} t_resample;
1206
1207EXTERN void resample_init(t_resample *x);
1208EXTERN void resample_free(t_resample *x);
1209
1210EXTERN void resample_dsp(t_resample *x, t_sample *in, int insize, t_sample *out, int outsize, int method);
1211EXTERN void resamplefrom_dsp(t_resample *x, t_sample *in, int insize, int outsize, int method);
1212EXTERN void resampleto_dsp(t_resample *x, t_sample *out, int insize, int outsize, int method);
1213/* } IOhannes */
1214
1215/* ----------------------- utility functions for signals -------------- */
1216EXTERN float mtof(float);
1217EXTERN float ftom(float);
1218EXTERN float rmstodb(float);
1219EXTERN float powtodb(float);
1220EXTERN float dbtorms(float);
1221EXTERN float dbtopow(float);
1222
1223EXTERN float q8_sqrt(float);
1224EXTERN float q8_rsqrt(float);
1225#ifndef N32
1226EXTERN float qsqrt(float); /* old names kept for extern compatibility */
1227EXTERN float qrsqrt(float);
1228#endif
1229/* --------------------- data --------------------------------- */
1230
1231 /* graphical arrays */
1232EXTERN_STRUCT _garray;
1233#define t_garray struct _garray
1234
1235EXTERN t_class *garray_class;
1236EXTERN int garray_getfloatarray(t_garray *x, int *size, t_sample **vec);
1237EXTERN float garray_get(t_garray *x, t_symbol *s, t_int indx);
1238EXTERN void garray_redraw(t_garray *x);
1239EXTERN int garray_npoints(t_garray *x);
1240EXTERN char *garray_vec(t_garray *x);
1241EXTERN void garray_resize(t_garray *x, t_floatarg f);
1242EXTERN void garray_usedindsp(t_garray *x);
1243EXTERN void garray_setsaveit(t_garray *x, int saveit);
1244EXTERN t_class *scalar_class;
1245
1246EXTERN t_float *value_get(t_symbol *s);
1247EXTERN void value_release(t_symbol *s);
1248EXTERN int value_getfloat(t_symbol *s, t_float *f);
1249EXTERN int value_setfloat(t_symbol *s, t_float f);
1250
1251/* ------- GUI interface - functions to send strings to TK --------- */
1252EXTERN void sys_vgui(char *fmt, ...);
1253EXTERN void sys_gui(char *s);
1254
1255 /* dialog window creation and destruction */
1256EXTERN void gfxstub_new(t_pd *owner, void *key, const char *cmd);
1257EXTERN void gfxstub_deleteforkey(void *key);
1258
1259extern t_class *glob_pdobject; /* object to send "pd" messages */
1260
1261/*------------- Max 0.26 compatibility --------------------*/
1262
1263/* the following reflects the new way classes are laid out, with the class
1264 pointing to the messlist and not vice versa. Externs shouldn't feel it. */
1265typedef t_class *t_externclass;
1266
1267EXTERN void c_extern(t_externclass *cls, t_newmethod newroutine,
1268 t_method freeroutine, t_symbol *name, size_t size, int tiny, \
1269 t_atomtype arg1, ...);
1270EXTERN void c_addmess(t_method fn, t_symbol *sel, t_atomtype arg1, ...);
1271
1272#define t_getbytes getbytes
1273#define t_freebytes freebytes
1274#define t_resizebytes resizebytes
1275#define typedmess pd_typedmess
1276#define vmess pd_vmess
1277
1278/* A definition to help gui objects straddle 0.34-0.35 changes. If this is
1279defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */
1280
1281#define PD_USE_TE_XPIX
1282
1283#if 0
1284/* a test for NANs and denormals. Should only be necessary on i386. */
1285#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \
1286 (((*(unsigned int*)&(f))&0x7f800000)==0x7f800000))
1287/* more stringent test: anything not between 1e-19 and 1e19 in absolute val */
1288#define PD_BIGORSMALL(f) ((((*(unsigned int*)&(f))&0x60000000)==0) || \
1289 (((*(unsigned int*)&(f))&0x60000000)==0x60000000))
1290#else
1291#define PD_BADFLOAT(f) 0
1292#define PD_BIGORSMALL(f) 0
1293#endif
1294
1295#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
1296}
1297#endif
1298
1299#define __m_pd_h_
1300#endif /* __m_pd_h_ */