home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / packery / fp_adpcm / deliplayers / source / deliplayer.h < prev    next >
C/C++ Source or Header  |  1977-12-31  |  12KB  |  321 lines

  1. /**
  2.  **  $Filename: misc/DeliPlayer.h $
  3.  **  $Release: 2.0 $
  4.  **  $Revision: 2.15$
  5.  **  $Date: 22/06/95$
  6.  **
  7.  **  Definitions and Macros for creating DeliTracker Playermodules
  8.  **
  9.  **  Stripped include file version for use with ADPCM-Player only.
  10.  **  DeliTracker's NotePlayer interface is private and may change at any time!
  11.  **
  12.  **  please contact Peter Kunath before trying to create your own players
  13.  **  using the NotePlayer interface
  14.  **
  15.  **  (C) Copyright 1991, 1992, 1993, 1994, 1995 Delirium Softdesign
  16.  **      All Rights Reserved
  17.  **
  18.  **/
  19.  
  20. #ifndef    DELITRACKER_PLAYER_H
  21. #define DELITRACKER_PLAYER_H
  22.  
  23. #ifndef EXEC_TYPES_H
  24. #include <exec/types.h>
  25. #endif
  26.  
  27. #ifndef EXEC_PORTS_H
  28. #include <exec/ports.h>
  29. #endif
  30.  
  31. #ifndef UTILITY_TAGITEM_H
  32. #include <utility/tagitem.h>
  33. #endif
  34.  
  35. #ifndef INTUITION_SCREENS_H
  36. #include <intuition/screens.h>
  37. #endif
  38.  
  39. /* --------------------------------------------------------------------------- */
  40.  
  41. #define DELIVERSION 17            /* Current Version of DeliTracker */
  42. #define DELIREVISION 4            /* Current Revision of DeliTracker */
  43.  
  44. /* -------------- The declarations for the interface functions --------------- */
  45.  
  46. extern __asm APTR dt_GetListDataAddr(register __d0 ULONG num);
  47. extern __asm ULONG dt_GetListDataSize(register __d0 ULONG num);
  48. extern __asm BOOL dt_LoadFile(void);
  49. extern __asm void dt_CopyDir(void);
  50. extern __asm void dt_CopyFile(void);
  51. extern __asm void dt_CopyString(register __a0 STRPTR string);
  52. extern __asm BOOL dt_AudioAlloc(void);
  53. extern __asm void dt_AudioFree(void);
  54. extern __asm void dt_StartInt(void);
  55. extern __asm void dt_StopInt(void);
  56. extern __asm void dt_SongEnd(void);
  57. extern __asm void dt_CutSuffix(void);
  58. extern __asm void dt_SetTimer(void);
  59. extern __asm void dt_WaitAudioDMA(void);
  60. extern __asm struct Screen *dt_LockScreen(void);
  61. extern __asm void dt_UnlockScreen(void);
  62. extern __asm void dt_NotePlayer(void);
  63. extern __asm APTR dt_AllocListData(register __d0 ULONG size, register __d1 ULONG memflags);
  64. extern __asm void dt_FreeListData(register __a1 APTR memblock);
  65.  
  66. /* ------------------------ Player Function Offsets -------------------------- */
  67.  
  68. struct DeliTrackerPlayer {
  69.     ULONG RTS_code;
  70.     UBYTE ID[8];
  71.     struct TagItem *TagArray;
  72. };
  73.  
  74. /* The TagItem ID's (ti_Tag values) for the player interface follow. */
  75.  
  76. #define DTP_Dummy    (TAG_USER + 0x4454)
  77.  
  78. #define DTP_InternalPlayer    (DTP_Dummy)        /* obsolete */
  79. #define DTP_CustomPlayer    (DTP_Dummy + 1)        /* player is a customplayer */
  80.  
  81. #define DTP_RequestDTVersion    (DTP_Dummy + 2)        /* minimum DeliTracker version needed */
  82. #define DTP_RequestKickVersion    (DTP_Dummy + 3)        /* minimum KickStart version needed */
  83.  
  84. #define DTP_PlayerVersion    (DTP_Dummy + 4)        /* actual player version & revision */
  85. #define DTP_PlayerName        (DTP_Dummy + 5)        /* name of this player */
  86. #define DTP_Creator        (DTP_Dummy + 6)        /* misc string */
  87.  
  88. #define DTP_Check1        (DTP_Dummy + 7)        /* Check Format before loading */
  89. #define DTP_Check2        (DTP_Dummy + 8)        /* Check Format after file is loaded */
  90. #define DTP_ExtLoad        (DTP_Dummy + 9)        /* Load additional files */
  91. #define DTP_Interrupt        (DTP_Dummy + 10)    /* Interrupt routine */
  92. #define DTP_Stop        (DTP_Dummy + 11)    /* Clear Patterncounter */
  93. #define DTP_Config        (DTP_Dummy + 12)    /* Config Player */
  94. #define DTP_UserConfig        (DTP_Dummy + 13)    /* User-Configroutine */
  95. #define DTP_SubSongRange    (DTP_Dummy + 14)    /* Get min&max subsong number */
  96.  
  97. #define DTP_InitPlayer        (DTP_Dummy + 15)    /* Initialisize the Player */
  98. #define DTP_EndPlayer        (DTP_Dummy + 16)    /* Player clean up */
  99. #define DTP_InitSound        (DTP_Dummy + 17)    /* Soundinitialisation routine */
  100. #define DTP_EndSound        (DTP_Dummy + 18)    /* End sound */
  101. #define DTP_StartInt        (DTP_Dummy + 19)    /* Start interrupt */
  102. #define DTP_StopInt        (DTP_Dummy + 20)    /* Stop interrupt */
  103.  
  104. #define DTP_Volume        (DTP_Dummy + 21)    /* Set Volume */
  105. #define DTP_Balance        (DTP_Dummy + 22)    /* Set Balance */
  106. #define DTP_Faster        (DTP_Dummy + 23)    /* Incease playspeed */
  107. #define DTP_Slower        (DTP_Dummy + 24)    /* Decrease playspeed */
  108. #define DTP_NextPatt        (DTP_Dummy + 25)    /* Jump to next pattern */
  109. #define DTP_PrevPatt        (DTP_Dummy + 26)    /* Jump to previous pattern */
  110. #define DTP_NextSong        (DTP_Dummy + 27)    /* Play next subsong */
  111. #define DTP_PrevSong        (DTP_Dummy + 28)    /* Play previous subsong */
  112.  
  113.     /*--- functions in revision 14 or higher (distributed as Release 1.35) --- */
  114.  
  115. #define DTP_SubSongTest        (DTP_Dummy + 29)    /* Test, if given subsong is vaild */
  116.  
  117.     /*--- functions in revision 16 or higher (distributed as Release 2.01) --- */
  118.  
  119. #define DTP_NewSubSongRange    (DTP_Dummy + 30)    /* enhanced replacement for DTP_SubSongRange */
  120.  
  121. #define DTP_DeliBase        (DTP_Dummy + 31)    /* the address of a pointer where DT */
  122.                                                 /* stores a pointer to the DeliGlobals */
  123.  
  124. #define DTP_Flags        (DTP_Dummy + 32)    /* misc Flags (see below) */
  125.  
  126. #define DTP_CheckLen        (DTP_Dummy + 33)    /* Length of the Check Code */
  127.  
  128. #define DTP_Description        (DTP_Dummy + 34)    /* misc string */
  129.  
  130. #define DTP_Decrunch        (DTP_Dummy + 35)    /* pointer to Decrunch Code */
  131. #define DTP_Convert        (DTP_Dummy + 36)    /* pointer to Converter Code */
  132.  
  133. #define DTP_NotePlayer        (DTP_Dummy + 37)    /* pointer to a NotePlayer Structure */
  134. #define DTP_NoteStruct        (DTP_Dummy + 38)    /* the address of a pointer to the */
  135.                                                 /* NoteStruct Structure */
  136. #define DTP_NoteInfo        (DTP_Dummy + 39)    /* a pointer where DT stores a pointer */
  137.                                                 /* to the current NoteStruct Structure */
  138. #define DTP_NoteSignal        (DTP_Dummy + 40)    /* pointer to NoteSignal code */
  139.  
  140. #define DTP_Process        (DTP_Dummy + 41)    /* pointer to process entry code */
  141. #define DTP_Priority        (DTP_Dummy + 42)    /* priority of the process */
  142. #define DTP_StackSize        (DTP_Dummy + 43)    /* stack size of the process */
  143. #define DTP_MsgPort        (DTP_Dummy + 44)    /* a pointer where DT stores a pointer */
  144.                                                 /* to a port to send its messages */
  145.  
  146. #define DTP_Appear        (DTP_Dummy + 45)    /* open your window, if you can */
  147. #define DTP_Disappear        (DTP_Dummy + 46)    /* go dormant */
  148.  
  149. #define DTP_ModuleName        (DTP_Dummy + 47)    /* get the name of the current module */
  150. #define DTP_FormatName        (DTP_Dummy + 48)    /* get the name of the module format */
  151. #define DTP_AuthorName        (DTP_Dummy + 49)    /* not implemented yet */
  152.  
  153.     /*--- functions in revision 17 or higher (distributed as Release 2.07) --- */
  154.  
  155. #define DTP_InitNote        (DTP_Dummy + 50)    /* NoteStruct initialization */
  156.  
  157. #define    DTP_NoteAllocMem    (DTP_Dummy + 51)    /* allocates memory for module */
  158.  
  159. #define    DTP_NoteFreeMem        (DTP_Dummy + 52)    /* frees module-memory */
  160.  
  161. #define    DTP_PlayerInfo        (DTP_Dummy + 53)    /* a pointer where DT stores a pointer */
  162.                             /* to the current Player Taglist */
  163.  
  164. #define    DTP_Patterns        (DTP_Dummy + 54)    /* FPTR to a pattern-count routine */
  165.  
  166. #define    DTP_Duration        (DTP_Dummy + 55)    /* FPTR to a duration calc routine */
  167.  
  168. #define    DTP_SampleData        (DTP_Dummy + 56)    /* FPTR to a sample-info routine */
  169.  
  170. #define    DTP_MiscText        (DTP_Dummy + 57)    /* FPTR to a misc-text routine */
  171.  
  172. /* end of player interface enumeration */
  173.  
  174.  
  175. /* --- various flags --------------------------------------------------------- */
  176.  
  177. #define PLYB_CUSTOM 0        /* player is a customplayer */
  178. #define PLYF_CUSTOM (1<<0)
  179. #define PLYB_SONGEND 1        /* player supports songend */
  180. #define PLYF_SONGEND (1<<1)
  181.  
  182.     /*--- flags defined in revision 17 or higher (distributed as Release 2.07) --- */
  183.  
  184. #define PLYB_ANYMEM 2        /* modules of this player don't require chipmem */
  185. #define PLYF_ANYMEM (1<<2)
  186.  
  187. /* --- DeliTracker message --------------------------------------------------- */
  188.  
  189. struct DeliMessage {
  190.     struct Message Message;
  191.     ULONG (*Function)(void);
  192.     ULONG Result;
  193.     ULONG    DTMN_ArgumentD0;
  194.     ULONG    DTMN_ArgumentA0;
  195. };
  196.  
  197. /* --- DeliTracker NotePlayer ------------------------------------------------ */
  198.  
  199. struct NotePlayer {
  200.     UWORD    npl_LeftChannels;    /* max. number of left channels this noteplayer supports */
  201.     UWORD    npl_RightChannels;    /* max. number of right channels this noteplayer supports */
  202.     ULONG    npl_Flags;        /* misc flags (see below) */
  203.     ULONG    npl_MaxFrequency;    /* max. frequency this noteplayer supports (-1 if unlimited) */
  204.     ULONG    npl_Memory;        /* memory type for samples (e.g. MEMF_CHIP) */
  205.     UBYTE    npl_Reserved[16];    /* reserved for future use (must be 0 for now) */
  206. };
  207.  
  208. struct NoteStruct {
  209.     APTR    nst_Channels;        /* pointer to a list of notechannels */
  210.     ULONG    nst_Flags;        /* misc flags (see below) */
  211.     ULONG    nst_MaxFrequency;    /* max. frequency of this player (28,867 Hz in DMA mode) */
  212.     UWORD    nst_MaxVolume;        /* max. volume of this player (in most cases 64) */
  213.     UBYTE    nst_Reserved[18];    /* reserved for future use (must be 0 for now) */
  214. };
  215.  
  216. #define    NSTB_Dummy 0            /* only a dummy-NoteStruct (no NotePlayer needed) */
  217. #define    NSTF_Dummy (1<<0)
  218.  
  219. #define    NSTB_Period 1            /* Amiga period supplied instead of frequency */
  220. #define    NSTF_Period (1<<1)
  221.  
  222. #define    NSTB_Signed 9            /* sample data is signed linear (2's complement) */
  223. #define    NSTF_Signed (1<<9)
  224.  
  225. #define    NSTB_8Bit 17            /*        -"-        bytes */
  226. #define    NSTF_8Bit (1<<17)
  227.  
  228. struct NoteChannel {
  229.     APTR    nch_NextChannel;    /* next channel in the list (NULL if last) */
  230.     ULONG    nch_NotePlayer;        /* for use by the noteplayer (the deliplayer must ignore this) */
  231.     WORD    nch_Reserved0;        /* reserved for future use (must be 0 for now) */
  232.     UBYTE    nch_Private;        /* just what it says */
  233.     UBYTE    nch_Changed;        /* what has changed since last call */
  234.     WORD    nch_StereoPos;        /* set this field when the InitNote function is called */
  235.     WORD    nch_Stereo;        /* describes "where" this channel is supposed to play */
  236.     APTR    nch_SampleStart;    /* ^sampledata */
  237.     ULONG    nch_SampleLength;    /* size of sample */
  238.     APTR    nch_RepeatStart;    /* ^repeat part of sample */
  239.     ULONG    nch_RepeatLength;    /* size of repeat part */
  240.     ULONG    nch_Frequency;        /* frequency (or period) of sample */
  241.     UWORD    nch_Volume;        /* volume of sample */
  242.     UBYTE    nch_Reserved1[26];    /* reserved for future use (must be 0 for now) */
  243. };
  244.  
  245. #define    NCHB_Sample 1            /* one-shot part of sample has changed */
  246. #define    NCHF_Sample (1<<1)
  247. #define    NCHB_Repeat 2            /* repeat part of sample has changed */
  248. #define    NCHF_Repeat (1<<2)
  249. #define    NCHB_Frequency 3        /* frequency has changed */
  250. #define    NCHF_Frequency (1<<3)
  251. #define    NCHB_Volume 4            /* volume (or pan position ???) has changed */
  252. #define    NCHF_Volume (1<<4)
  253.  
  254. #define    NCHD_FarLeft -32767        /* play only on left speaker */
  255. #define    NCHD_FarRight +32767        /* play only on right speaker */
  256.  
  257.  
  258. /* ---------------------------- Global Variables ------------------------------ */
  259.  
  260. struct DeliTrackerGlobals {
  261.  
  262.     /* ------ if you use dtg_AslBase, make sure that */
  263.     /* ------ DTP_RequestDTVersion is at least 13 ! */
  264.  
  265.     struct Library *AslBase;        /* library base, don't CloseLibrary()!! */
  266.  
  267.     struct Library *DOSBase;        /* library base -"- */
  268.     struct IntuitionBase *IntuitionBase;    /* library base -"- */
  269.     struct GfxBase *GfxBase;        /* library base -"- */
  270.     struct Library *GadToolsBase;        /* librarybase -"- (NULL for Kick 1.3 and below) */
  271.     APTR ReservedLibraryBase;        /* reserved for future use */
  272.  
  273.     STRPTR    DirArrayPtr;        /* Ptr to the directory of the current module */
  274.     STRPTR    FileArrayPtr;        /* Ptr to the filename of the current module */
  275.     STRPTR    PathArrayPtr;        /* Ptr to PathArray (e.g used in LoadFile()) */
  276.  
  277.     APTR    ChkData;        /* pointer to the module to be checked */
  278.     ULONG    ChkSize;        /* size of the module */
  279.  
  280.     UWORD    SndNum;            /* current sound number */
  281.     UWORD    SndVol;            /* volume (ranging from 0 to 64) */
  282.     UWORD    SndLBal;        /* left volume (ranging from 0 to 64) */
  283.     UWORD    SndRBal;        /* right volume (ranging from 0 to 64) */
  284.     UWORD    LED;            /* filter (0 if the LED is off) */
  285.     UWORD    Timer;            /* timer-value for the CIA-Timers */
  286.  
  287.     APTR    dtg_GetListData;
  288.     APTR    dtg_LoadFile;
  289.     APTR    dtg_CopyDir;
  290.     APTR    dtg_CopyFile;
  291.     APTR    dtg_CopyString;
  292.     APTR    dtg_AudioAlloc;
  293.     APTR    dtg_AudioFree;
  294.     APTR    dtg_StartInt;
  295.     APTR    dtg_StopInt;
  296.     APTR    dtg_SongEnd;        /* safe to call from interrupt code ! */
  297.     APTR    dtg_CutSuffix;
  298.  
  299.     /* ------ extension in revision 14 */
  300.  
  301.     APTR    dtg_SetTimer;        /* safe to call from interrupt code ! */
  302.  
  303.     /* ------ extension in revision 15 */
  304.  
  305.     APTR    dtg_WaitAudioDMA;    /* safe to call from interrupt code ! */
  306.  
  307.     /* ------ extension in revision 16 */
  308.  
  309.     APTR    dtg_LockScreen;
  310.     APTR    dtg_UnlockScreen;
  311.     APTR    dtg_NotePlayer;        /* safe to call from interrupt code ! */
  312.     APTR    dtg_AllocListData;
  313.     APTR    dtg_FreeListData;
  314.  
  315.     APTR    dtg_Reserved1;        /* do not use !!! */
  316.     APTR    dtg_Reserved2;        /* do not use !!! */
  317.     APTR    dtg_Reserved3;        /* do not use !!! */
  318. };
  319.  
  320. #endif
  321.