1 /* OpenCP Module Player 2 * copyright (c) '94-'05 Niklas Beisert <nbeisert@physik.tu-muenchen.de> 3 * 4 * CPIface note dots mode 5 * 6 * revision history: (please note changes here) 7 * -nb980510 Niklas Beisert <nbeisert@physik.tu-muenchen.de> 8 * -first release 9 * -doj980928 Dirk Jagdmann <doj@cubic.org> 10 * -deleted plReadOpenCPPic() which is now found in cpipic.h 11 * -fd981119 Felix Domke <tmbinc@gmx.net> 12 * -added some really important declspec-stuff 13 */ 14 15 #ifndef __CPIFACE_H 16 #define __CPIFACE_H 17 18 #include <stdio.h> 19 20 struct moduleinfostruct; 21 struct ocpfilehandle_t; 22 struct cpifaceplayerstruct 23 { 24 int (*OpenFile)(struct moduleinfostruct *info, struct ocpfilehandle_t *f); 25 void (*CloseFile)(); 26 }; 27 28 enum 29 { 30 cpiGetSampleStereo=1, cpiGetSampleHQ=2 31 }; 32 33 extern unsigned short plNLChan; 34 extern unsigned short plNPChan; 35 extern unsigned char plSelCh; 36 extern unsigned char plChanChanged; 37 extern char plPause; 38 extern char plMuteCh[]; 39 extern char plPanType; 40 extern int (*plProcessKey)(uint16_t key); 41 extern void (*plDrawGStrings)(uint16_t (*plTitleBuf)[CONSOLE_MAX_X]); 42 extern void (*plGetRealMasterVolume)(int *l, int *r); 43 extern void (*plGetMasterSample)(int16_t *, unsigned int len, uint32_t rate, int mode); 44 extern int (*plIsEnd)(void); 45 extern void (*plIdle)(void); 46 extern void (*plSetMute)(int i, int m); 47 extern int (*plGetLChanSample)(unsigned int ch, int16_t *, unsigned int len, uint32_t rate, int opt); 48 extern int (*plGetPChanSample)(unsigned int ch, int16_t *, unsigned int len, uint32_t rate, int opt); 49 50 extern void cpiKeyHelp(uint16_t key, const char *shorthelp); 51 extern void cpiKeyHelpClear(void); 52 extern int cpiKeyHelpDisplay(void); /* recall until it returns zero. This function WILL call ekbhit and egetch, but not framelock */ 53 54 struct cpimoderegstruct 55 { 56 char handle[9]; 57 void (*SetMode)(); 58 void (*Draw)(); 59 int (*IProcessKey)(uint16_t); 60 int (*AProcessKey)(uint16_t); 61 int (*Event)(int ev); 62 struct cpimoderegstruct *next; 63 struct cpimoderegstruct *nextdef; 64 }; 65 66 #define CPIMODEREGSTRUCT_TAIL ,0,0 67 68 struct cpitextmoderegstruct; 69 70 struct cpitextmodequerystruct 71 { 72 unsigned char top; 73 unsigned char xmode; /* bit0, want to be main left column 74 bit1, want to be the right column 75 0x00 = not visible / reserved 76 0x01 = left column (we might cover the hole width) 77 0x02 = right column (we might not be visible, if screen is to narrow) 78 0x03 = we want to cover the hole width 79 */ 80 unsigned char killprio; 81 unsigned char viewprio; 82 unsigned char size; /* used to demand more height than hgtmin. Can be bigger than hgtmax to increase the priority when space is distributed */ 83 int hgtmin; 84 int hgtmax; 85 struct cpitextmoderegstruct *owner; 86 }; 87 88 struct cpitextmoderegstruct 89 { 90 char handle[9]; 91 int (*GetWin)(struct cpitextmodequerystruct *q); 92 void (*SetWin)(int xmin, int xwid, int ymin, int ywid); 93 void (*Draw)(int focus); 94 int (*IProcessKey)(unsigned short); 95 int (*AProcessKey)(unsigned short); 96 int (*Event)(int ev); 97 int active; 98 struct cpitextmoderegstruct *nextact; 99 struct cpitextmoderegstruct *next; 100 struct cpitextmoderegstruct *nextdef; 101 }; 102 103 #define CPITEXTMODEREGSTRUCT_TAIL ,0,0,0,0 104 105 enum 106 { 107 cpievOpen, cpievClose, 108 cpievInit, cpievDone, /* used to test if you can be added to Mode list (called on every song) */ 109 cpievInitAll, cpievDoneAll, /* used to test if you can be added to DefMode list (called by cpiRegisterDefMode) */ 110 cpievGetFocus, cpievLoseFocus, cpievSetMode, 111 cpievKeepalive=42 112 }; 113 114 extern void cpiDrawGStrings(void); 115 extern void cpiSetGraphMode(int big); 116 extern void cpiSetTextMode(int size); 117 extern void cpiResetScreen(void); 118 extern void cpiRegisterDefMode(struct cpimoderegstruct *m); /* this are stuck until unregister is called */ 119 extern void cpiUnregisterDefMode(struct cpimoderegstruct *m); 120 extern void cpiRegisterMode(struct cpimoderegstruct *m); /* This list is cleared automatically on song close, and deflist is appended on load */ 121 extern void cpiUnregisterMode(struct cpimoderegstruct *m); 122 123 124 extern void cpiSetMode(const char *hand); 125 extern void cpiGetMode(char *hand); 126 extern void cpiTextRegisterMode(struct cpitextmoderegstruct *mode); 127 extern void cpiTextUnregisterMode(struct cpitextmoderegstruct *m); 128 extern void cpiTextRegisterDefMode(struct cpitextmoderegstruct *mode); 129 extern void cpiTextUnregisterDefMode(struct cpitextmoderegstruct *m); 130 extern void cpiTextSetMode(const char *name); 131 extern void cpiTextRecalc(void); 132 133 void cpiForwardIProcessKey(uint16_t key); 134 135 extern void plUseMessage(char **); 136 137 struct insdisplaystruct 138 { 139 int height, bigheight; 140 char *title80; 141 char *title132; 142 void (*Mark)(void); 143 void (*Clear)(void); 144 void (*Display)(uint16_t *buf, int len, int n, int mode); 145 void (*Done)(void); 146 }; 147 148 extern void plUseInstruments(struct insdisplaystruct *x); 149 150 extern void plUseChannels(void (*Display)(unsigned short *buf, int len, int i)); 151 152 struct notedotsdata 153 { 154 uint8_t chan; 155 uint16_t note; 156 uint16_t voll,volr; 157 uint8_t col; 158 }; 159 160 extern void plUseDots(int (*get)(struct notedotsdata *, int)); 161 162 struct cpitrakdisplaystruct 163 { 164 int (*getcurpos)(void); 165 int (*getpatlen)(int n); 166 const char *(*getpatname)(int n); 167 void (*seektrack)(int n, int c); 168 int (*startrow)(void); 169 int (*getnote)(uint16_t *bp, int small); 170 int (*getins)(uint16_t *bp); 171 int (*getvol)(uint16_t *bp); 172 int (*getpan)(uint16_t *bp); 173 void (*getfx)(uint16_t *bp, int n); 174 void (*getgcmd)(uint16_t *bp, int n); 175 }; 176 177 extern void cpiTrkSetup(const struct cpitrakdisplaystruct *c, int npat); 178 179 extern char plNoteStr[132][4]; 180 extern unsigned char plChanChanged; 181 extern char plCompoMode; 182 183 /* mcpedit.c */ 184 extern void mcpNormalize(int hasfilter); 185 extern void mcpDrawGStrings(uint16_t (*buf)[CONSOLE_MAX_X]); 186 extern int mcpSetProcessKey(uint16_t key); 187 extern void mcpSetFadePars(int i); 188 extern uint16_t globalmcpspeed; 189 extern uint16_t globalmcppitch; 190 191 #endif 192