home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / audio / multiplay / player.h < prev    next >
C/C++ Source or Header  |  1992-09-14  |  7KB  |  234 lines

  1. /*
  2.  * MultiPlayer
  3.  * Copyright (C) 1992 Bryan Ford
  4.  *
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or
  8.  * (at your option) any later version.
  9.  *
  10.  * This program is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.  * GNU General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  *
  19.  * I (the author of MultiPlayer) can be contacted on the Internet at
  20.  * "bryan.ford@m.cc.utah.edu".  See "Player.doc" for other addresses.
  21.  *
  22.  * $Id: player.h,v 5.1 92/09/14 18:44:24 BAF Exp Locker: BAF $
  23.  * Global header for C modules
  24.  *
  25.  * $Log:    player.h,v $
  26.  * Revision 5.1  92/09/14  18:44:24  BAF
  27.  * Got rid of C++ style comments
  28.  * 
  29.  * Revision 4.3  92/07/20  20:05:00  BAF
  30.  * progload() and progsave() calling format changed
  31.  *
  32.  * Revision 4.2  92/06/21  11:20:24  BAF
  33.  * Migrated regargs to stdargs
  34.  *
  35.  * Revision 4.1  92/06/06  19:57:33  BAF
  36.  * Major_code_cleanup
  37.  *
  38.  * Revision 3.1  92/05/25  07:54:02  BAF
  39.  * GNU-ized.
  40.  *
  41.  *
  42.  */
  43.  
  44. #ifndef DOS_DOS_H
  45. #include <dos/dos.h>
  46. #endif
  47.  
  48. #define CLOCK 3579545
  49.  
  50. #define callvec(name) { extern void (*name)(void); if(name) (*name)(); }
  51.  
  52. #define FFperF 3
  53.  
  54. struct ModNode
  55.   {
  56.     struct MinNode node;
  57.     short size;
  58.     char *nameptr;
  59.     BPTR dir;
  60.     char volume;
  61.     char balance;
  62.     unsigned char speed;
  63.     char filter;
  64.     long endtime;
  65.     char flags;
  66.     char pad;
  67.     char name[1];
  68.   };
  69. #define MNF_ENDFADE           0x02      /* Fade out on ending */
  70. #define MNF_PTTEMPO           0x04      /* Enable Protracker tempo commands */
  71. #define MNF_NOTPROTRACKER     0x08      /* This is not a Protracker module */
  72.  
  73. /* Program arguments */
  74. extern struct PlayerArgs
  75.   {
  76.     char *dir;
  77.     char **mods;
  78.     char *prog;
  79.     char *screen;
  80.     int noreq;
  81.     int nowin;
  82.     int norexx;
  83.     int nodetach;
  84.   } argarray;
  85.  
  86. /* One of MultiPlayer's windows (or some other thread) */
  87. struct MPWin
  88.   {
  89.     void *spec;
  90.     short *snappos;
  91.     void (*initfunc)(void);
  92.     struct RemindNode snapnode;
  93.     struct RemindNode checknode;
  94.     struct RemindNode closenode;
  95.     void *userdata;
  96.     struct Window *win;
  97.     long sigmask;
  98.   };
  99.  
  100. /* All of the following variables, except the arbitrated globals, are
  101.    declared (and explained more fully) in main.c.  */
  102.  
  103. /* System flags */
  104. extern char sysflags, sysflags2;
  105. #define SF_KILL         0x01    /* Kill MultiPlayer ASAP */
  106. #define SF_TIMERUP      0x04    /* Timer/sequence needs updating */
  107. #define SF_WINDOWUP     0x08    /* Windows need updating */
  108. #define SF_REPEAT       0x10    /* Song is repeating */
  109. #define SF_SECOND       0x20    /* One second has gone by */
  110. #define SF_FADEDONE     0x40    /* We're finished fading */
  111. #define SF_FADEPAUSE    0x80    /* We're fading out for a pause */
  112.  
  113. /* Play mode */
  114. extern char playmode;
  115. #define PM_SEQUENCE     0       /* Play in sequence */
  116. #define PM_RANDOM       1       /* Random order */
  117. #define PM_ONCE         2       /* Play once then unload */
  118. #define PM_OVEROVER     3       /* Play same module over and over */
  119. #define PM_SEQUENCEONCE 4       /* Through sequence once */
  120.  
  121. /* Show mode */
  122. extern char showmode;
  123. #define SM_NOTHING      0       /* Don't mess with the title bar */
  124. #define SM_CLOCK        1       /* Minute/second music timer */
  125. #define SM_SEQUENCE0    2       /* Sequence starting from 0 */
  126. #define SM_SEQUENCE1    3       /* Sequence starting from 1 */
  127.  
  128. /* Flash mode */
  129. extern char flashflags;
  130. #define FF_SPECTRUM     0x01    /* Spectrum analyzer */
  131. #define FF_SCOPE        0x02    /* Stereo Scope */
  132. #define FF_QSCOPE       0x04    /* Quadrascope */
  133. #define FF_NOTES        0x08    /* Note scroller */
  134. #define FF_CHANNELS     0x10    /* Channel meter */
  135. #define FF_INFO         0x20    /* Info display (not really "flashy", but handled the same way...) */
  136.  
  137. /* Module type */
  138. extern char modtype;
  139. #define MTF_MODSPEED    0x01    /* Supports modspeed */
  140. #define MTF_SEQUENCE    0x02    /* Supports sequence display */
  141. #define MTF_REPEAT      0x04    /* Supports repeat detection */
  142. #define MTF_MODIFIED    0x08    /* Mod prefs have been changed */
  143. #define MTF_PROTRACKER  0x10    /* This is the Protracker player */
  144. #define MTF_FILTER      0x20    /* Filter can be controlled */
  145. #define MTF_JUMP        0x40    /* Module can jump to other positions */
  146.  
  147. /* Help contexts */
  148. #define MAINCONTEXT     0
  149. #define PANELCONTEXT    1
  150. #define PROGWINCONTEXT  2
  151. #define PREFSWINCONTEXT 3
  152. #define FLASHYWINCONTEXT 4
  153.  
  154. /* Other globals */
  155. extern struct Screen *playerscreen;
  156. extern struct MsgPort *wbappport;
  157.  
  158. extern struct RemindList dolist;
  159. extern struct RemindList checklist;
  160. extern struct RemindList updatelist;
  161. extern struct RemindList timerlist;
  162. extern struct RemindList snaplist;
  163. extern struct RemindList closelist;
  164. extern struct RemindList endlist;
  165.  
  166. extern char playmode, showmode;
  167.  
  168. /* Arbitrated globals */
  169. extern struct MinList modlist;
  170. extern struct ModNode *curmod, *selmod;
  171.  
  172. #define adddo(node) remind_add(&dolist,node)
  173.  
  174. /* main.c */
  175. char *showerr(char *mes);
  176. char *setdir(BPTR newdir);
  177. char *setdirname(char *name);
  178. char *progadd(BPTR dir,char *name);
  179. char *progaddargs(int args,struct WBArg *arg);
  180. char *progstart(void);
  181. char *prognext(void);
  182. char *progprev(void);
  183. char *progact(struct ModNode *node);
  184. void progdel(struct ModNode *node);
  185. void progclear(void);
  186. char *progsave(BPTR dir,char *filename);
  187. char *progload(BPTR dir,char *filename,int start);
  188.  
  189. void addcalls(
  190.   struct CallNode *check,
  191.   struct CallNode *update,
  192.   struct CallNode *timernode,
  193.   struct CallNode *end);
  194. void addsigs(long newsigs);
  195. void remsigs(long oldsigs);
  196.  
  197. char *reqmod(int clear);
  198. char *openfilerequest(void (*donecall)(struct WBArg *args,int count),
  199.   void *frspec,void *userstruct);
  200. void closefilerequest(void (*donecall)(struct WBArg *args,int count));
  201. void windowkey(int rawcode,int context);
  202. void windowclick(int rawcode);
  203. void standardcallback(struct GuidMessage *gm);
  204.  
  205. char *openmpwin(struct MPWin *win);
  206. void closempwin(struct MPWin *win);
  207. void setfinmpwin(struct MPWin *win);
  208.  
  209. /* window.c */
  210. void windowremake(void);
  211. void windowclose(void);
  212. char *windowopen(void);
  213.  
  214. /* progwin.c */
  215. char *progwinopenclose(void);
  216.  
  217. /* Player prototypes */
  218. void setsong(int song);
  219. char *loadmod(char *name);
  220. char *playmod(int song);
  221. char *startmod(char *name,int song);
  222. char *contmod(void);
  223. char *contplaymod(void);
  224. void stopmod(void);
  225. void endmod(void);
  226. int iscantcont(char *errmes);
  227.  
  228. /* Globals prototypes */
  229. void GlobSetByte(char *var,char value,void *(*notroutine)(void));
  230. void GlobSetWord(short *var,short value,void *(*notroutine)(void));
  231. void GlobSetLong(long *var,long value,void *(*notroutine)(void));
  232. void GlobPreMod(void *var,void *(*notroutine)(void));
  233. void GlobPostMod(void *var,void *(*notroutine)(void));
  234.