home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / SoundAndMusic / cmix / H / ugens.h < prev    next >
C/C++ Source or Header  |  1991-09-21  |  2KB  |  79 lines

  1. /*
  2.  *    ugens.h: define unit generator structure
  3.  */
  4. #define    UG_NSIZ    7    /*  Max len of UG name    */
  5. #define    UG_NULL    (struct ug_item *)0
  6. #define NAMESIZE 128    /* Max size of file name */
  7.  
  8. #define FLOAT (sizeof(float))   /* nbytes in floating point word*/
  9. #define INT   (sizeof(int))   /* nbytes in integer word */
  10. #define SHORT (sizeof(short))
  11. #define LONG  (sizeof(long))
  12. #define NFILES       12       /* maximum number of opened files */
  13.  
  14. struct    ug_item    {
  15.     struct    ug_item    *ug_next;
  16.     double     (*ug_ptr)();    /*  Pointer to the function    */
  17.     char    *ug_name;
  18. };
  19. typedef    struct ug_item    ug_t;
  20.  
  21. extern    ug_t    *ug_list;
  22. extern    addfunc();
  23.  
  24. #define    UG_INTRO(flabel,func)    \
  25.     { extern double func();    \
  26.         static ug_t this_ug = { UG_NULL, func, flabel }; \
  27.         if (addfunc(&this_ug) == -1) merror(flabel);    }
  28.  
  29.  
  30. #define      PI2    6.2831853
  31. #define      PI     3.141592654
  32. extern       float  SR;
  33.  
  34. #ifndef MAIN
  35. extern int aargc;
  36. extern char *aargv[];          /* to pass commandline args to subroutines */
  37. #endif
  38.  
  39.  
  40. /*  structure to pass to gen routines */
  41. struct gen {
  42.            int size;           /* size of array to load up */
  43.            int nargs;          /* number of arguments passed in p array */
  44.            float *pvals;       /* address of array of p values */
  45.            float *array;       /* address of array to be loaded up */
  46.        int slot;           /* slot number, for fnscl test */
  47.            };
  48. #ifndef SOUND
  49. extern int (*addoutpointer[NFILES])();
  50. extern int (*layoutpointer[NFILES])();
  51. extern int (*wipeoutpointer[NFILES])();
  52. extern int (*getinpointer[NFILES])();
  53. extern int (*bwipeoutpointer[NFILES])();
  54.  
  55. #define ADDOUT(x,y)  (*addoutpointer[y])(x,y)
  56. #define LAYOUT(x,l,y)  (*layoutpointer[y])(x,l,y)
  57. #define WIPEOUT(x,y) (*wipeoutpointer[y])(x,y)
  58. #define GETIN(x,y)   (*getinpointer[y])(x,y)
  59. #define BWIPEOUT(x,y,z) (*bwipeoutpointer[y])(x,y,z)
  60. #endif  SOUND
  61. #define  ABS(x) ((x < 0) ? (-x) : (x))
  62. #define  SIGN(x) (ABS(x)/(x ? x : 1.))
  63.  
  64. /* declarations of units */
  65. long  setnot();
  66. float reson(),resonz(),oscil(),oscili(),osciln(),oscilni(),evp(),table(),tablei();
  67. float cpspch(),pchcps(),cpsoct(),octcps(),pchoct(),buzz(),allpole();
  68. float delget(),dliget(),boost(),rrand();
  69. float octpch(),*floc(),reverb(),bpluck(),hpluck(),hcomb(),comb();
  70. float allpass(),allpole(),ballpole(),bbuzz(),boscili(),
  71.     delput(),crandom(),random();
  72. double ampdb();
  73. float pluck(),randf();
  74. float pchmidi();
  75. int midipch();
  76.  
  77. int (*getsample)();
  78. #define GETSAMPLE (*getsample)
  79.