From 611b5933372343af0a50da738e83e37669ccda2f Mon Sep 17 00:00:00 2001 From: "N.N." Date: Fri, 10 Aug 2007 09:08:08 +0000 Subject: *** empty log message *** svn path=/trunk/externals/miXed/; revision=8501 --- riddle/riddle.h | 131 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 80 insertions(+), 51 deletions(-) (limited to 'riddle/riddle.h') diff --git a/riddle/riddle.h b/riddle/riddle.h index 12d5907..0795f5f 100644 --- a/riddle/riddle.h +++ b/riddle/riddle.h @@ -2,103 +2,132 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +/* these are the riddle external API declarations */ + #ifndef __RIDDLE_H__ #define __RIDDLE_H__ EXTERN_STRUCT _riddle; #define t_riddle struct _riddle +EXTERN_STRUCT _rdprivate; +#define t_rdprivate struct _rdprivate + EXTERN_STRUCT _rdsource; #define t_rdsource struct _rdsource EXTERN_STRUCT _rdsink; #define t_rdsink struct _rdsink -EXTERN_STRUCT _rdpool; -#define t_rdpool struct _rdpool +EXTERN_STRUCT _rdpicker; +#define t_rdpicker struct _rdpicker + +EXTERN_STRUCT _rdfeedchain; +#define t_rdfeedchain struct _rdfeedchain -EXTERN_STRUCT _rdbuffer; -#define t_rdbuffer struct _rdbuffer +EXTERN_STRUCT _rdremote; +#define t_rdremote struct _rdremote typedef void (*t_rdblockfn)(t_riddle *); typedef void (*t_rddspfn)(t_riddle *, t_signal **); struct _riddle { - t_sic rd_sic; + t_sic rd_sic; + + /* LATER rethink: indirection cost vs. abi stability */ + t_rdprivate *rd_private; /* designed for system-level control: block mismatches, etc. - (user-level control via '_idle' slot in graphpool) */ - int rd_disabled; - int rd_wasdisabled; + (user-level control possible via the '_idle' slot in graphpool) */ + int rd_disabled; + int rd_wasdisabled; t_rdblockfn rd_blockfn; t_rddspfn rd_dspfn; - t_rdpool *rd_graphpool; - - int rd_graphsr; - int rd_graphblock; + int rd_graphsr; + int rd_graphblock; int rd_nsiginlets; int rd_nremoteslots; - t_rdsource *rd_inslots; /* rd_nsiginlets + rd_nremoteslots elements */ - t_rdsource *rd_remoteslots; /* == rd_inslots + rd_nsiginlets */ + t_rdsource *rd_inslots; /* nsiginlets + nremoteslots elements */ + t_rdsource *rd_remoteslots; /* == inslots + nsiginlets (readers only) */ + t_rdremote *rd_remoteports; /* the list of all remotes */ - int rd_nsigoutlets; - t_rdsink *rd_outslots; /* rd_nsigoutlets elements */ + int rd_nsigoutlets; + t_rdsink *rd_outslots; /* nsigoutlets elements */ - int rd_remotesource; /* LATER consider storing remote sources here */ + t_rdpicker *rd_idlepicker; }; -void riddlebug_post(t_riddle *rd, char *pfx, char *fmt, ...); +#define RIDDLE_STRICTNESSMASK 1 /* if set: non-riddle sinks are rejected */ -int riddle_getsr(t_riddle *rd); -int riddle_getgraphblock(t_riddle *rd); +/* the main part of the API */ int riddle_getsourceblock(t_riddle *rd, int siginno); -t_symbol *riddle_getsourcepattern(t_riddle *rd, int siginno, int *maxblockp); -int riddle_getoutblock(t_riddle *rd, int sigoutno); -t_symbol *riddle_getoutpattern(t_riddle *rd, int sigoutno, int *maxblockp); +t_symbol *riddle_getsourcelayout(t_riddle *rd, int siginno, int *maxblockp); +int riddle_getsourceflags(t_riddle *rd, int siginno); +/* or perhaps, IFBUILTIN, int inlet_getblock(t_inlet *)... */ void riddle_setoutblock(t_riddle *rd, int sigoutno, int newblock); -void riddle_setoutpattern(t_riddle *rd, int sigoutno, - t_symbol *pattern, int maxblock); +void riddle_setoutlayout(t_riddle *rd, int sigoutno, + t_symbol *pattern, int maxblock); +void riddle_setoutflags(t_riddle *rd, int sigoutno, int flags); +/* or perhaps, IFBUILTIN, void outlet_setblock(t_outlet *, int)... */ int riddle_checksourceblock(t_riddle *rd, int siginno, int reqblock); -int riddle_checksourcepattern(t_riddle *rd, int siginno, - t_symbol *reqpattern, int *maxblockp); -int riddle_checkanysource(t_riddle *rd, int siginno); +int riddle_checksourcelayout(t_riddle *rd, int siginno, + t_symbol *reqpattern, int *maxblockp); int riddle_isdisabled(t_riddle *rd); void riddle_disable(t_riddle *rd); -void riddle_mute(t_riddle *rd, t_signal **sp); + +/* this part is specific to the library implementation */ t_class *riddle_setup(t_symbol *name, t_newmethod newfn, t_method freefn, size_t sz, t_method floatfn, t_rdblockfn blockfn, t_rddspfn dspfn); -void riddle_updatedsp(void); - -void rdpool_set(t_rdpool *rp, t_symbol *key, int size, t_float *data); -void rdpool_setbygraph(t_canvas *graph, t_symbol *key, int size, t_float *data); -t_float *rdpool_get(t_rdpool *rp, t_symbol *key, int *sizep); -t_float *riddle_getlink(t_riddle *rd, t_symbol *key, int *sizep); -t_canvas *riddle_getgraph(t_riddle *rd, int sigoutno); - -t_rdbuffer *riddle_getbuffer(t_symbol *name); -t_rdbuffer *rdbuffer_getwriter(t_rdbuffer *rb); -void rdbuffer_validate(t_rdbuffer *rb, int nblock); -void rdbuffer_reset(t_rdbuffer *rb); -int rdbuffer_getframesize(t_rdbuffer *rb); -t_float *rdbuffer_gethead(t_rdbuffer *rb); -void rdbuffer_stephead(t_rdbuffer *rb); -void rdbuffer_movehead(t_rdbuffer *rb, int nframes); -void rdbuffer_delayhead(t_rdbuffer *rb, int nframes); -void rdbuffer_free(t_rdbuffer *rb); -t_rdbuffer *rdbuffer_new(t_riddle *owner, t_symbol *name, int nframes); -t_rdbuffer *rdbuffer_newreader(t_riddle *owner, t_symbol *name); - -int riddle_erbfill(int nbands, int *buf, int nblock, int sr); +/* this part is very experimental: remote connections */ + +t_rdremote *rdremote_newwriter(t_riddle *owner, t_symbol *name, int nframes); +t_rdremote *rdremote_newreader(t_riddle *owner, t_symbol *name); +t_rdremote *rdremote_newbuffer(t_riddle *owner, int nframes); + +int rdremote_getsourceblock(t_rdremote *re); +t_symbol *rdremote_getsourcelayout(t_rdremote *re, int *maxblockp); +int rdremote_getsourceflags(t_rdremote *re); + +void rdremote_setoutblock(t_rdremote *re, int nblock); +void rdremote_setoutlayout(t_rdremote *re, t_symbol *pattern, int maxblock); +void rdremote_setoutflags(t_rdremote *re, int flags); + +void rdremote_reset(t_rdremote *re); +t_float *rdremote_gethead(t_rdremote *re); +void rdremote_stephead(t_rdremote *re); +void rdremote_movehead(t_rdremote *re, int nframes); +void rdremote_delayhead(t_rdremote *re, int nframes); + +t_rdpicker *rdpicker_attach(t_riddle *rd, t_symbol *key); +void rdpicker_detach(t_rdpicker *pi, t_riddle *rd); +t_float *rdpicker_pick(t_rdpicker *pi, int *sizep); +t_float rdpicker_pick1(t_rdpicker *pi); +int riddle_isidle(t_riddle *rd); + +t_rdfeedchain *riddle_usefeedchain(t_riddle *rd, + int sigoutno, t_symbol *key, int size); +t_rdfeedchain *riddle_useidlechain(t_riddle *rd, int sigoutno); +void rdfeedchain_feed(t_rdfeedchain *ch, int size, t_float *data); +void rdfeedchain_feed1(t_rdfeedchain *ch, t_float v); + +/* utilities */ + +void riddlebug_post(t_riddle *rd, char *pfx, char *fmt, ...); + +int riddle_getsr(t_riddle *rd); +int riddle_getgraphblock(t_riddle *rd); + +int riddle_erbfill(int nbands, int *buf, int nbins, int sr); #endif -- cgit v1.2.1