home *** CD-ROM | disk | FTP | other *** search
/ Amiga Dream 59 / CDDream59.ISO / BeOs / Sound / Intel / PPBeDevKit.ZIP / PLAYERPR.TAR / PlayerPRO / Source / MAD.h < prev    next >
C/C++ Source or Header  |  1998-12-26  |  6KB  |  274 lines

  1. /********************                        ***********************/
  2. //
  3. //    Player PRO 5.0x -- MAD Music Driver Definition -
  4. //
  5. //    Library Version 5.0
  6. //
  7. //    To use with MAD Library for Mac Symantec, CodeWarrior and MPW
  8. //
  9. //    Antoine ROSSET
  10. //    16 Tranchees
  11. //    1206 GENEVA
  12. //    SWITZERLAND
  13. //
  14. //    Thank you for your interest in PlayerPRO !
  15. //
  16. //    FAX:        (+41 22) 346 11 97
  17. //    PHONE:         (+41 79) 203 74 62
  18. //    Internet:     RossetAntoine@bluewin.ch
  19. //
  20. /********************                        ***********************/
  21.  
  22. #ifndef __MADI__
  23. #define __MADI__
  24.  
  25. //////////////////////////////////////////////////////////////////////
  26. #if defined(THINK_C)            // MACINTOSH
  27. #define _MAC_H
  28. #define EXP
  29.  
  30. #elif macintosh                    // MACINTOSH - CODEWARRIOR                
  31.  
  32. #define _MAC_H
  33.  
  34. #define _MIDIHARDWARE_            // DONT DEFINE IT, IF YOU DONT WANT TO SUPPORT OMS !!!!
  35.  
  36. #define EXP
  37.  
  38. //////////////////////////////////////////////////////////////////////
  39. #elif __dest_os == __be_os        // BEOS
  40.  
  41. #define _BE_H
  42. #define EXP    __declspec(dllexport)
  43.  
  44. //////////////////////////////////////////////////////////////////////
  45. #elif defined (WIN32)            // WIN32 - 95/NT
  46.  
  47. #define _INTEL_H
  48. #define EXP __declspec(dllexport)
  49.  
  50. #endif
  51. //////////////////////////////////////////////////////////////////////
  52.  
  53. #if defined(_INTEL_H) || defined (_BE_H)
  54.  
  55. #if !defined(THINK_C)
  56. #include "stdio.h"
  57. #include "stdlib.h"
  58. #include "string.h"
  59.  
  60. typedef unsigned char     Byte;
  61. typedef char             *Ptr;
  62. typedef Ptr             *Handle;
  63. typedef unsigned char     Boolean;
  64. typedef short             OSErr;
  65. typedef unsigned char     Str255[256], Str63[64];
  66. typedef unsigned long     OSType;
  67.  
  68. #define NewPtr(x)                    (Ptr) malloc(x)
  69. #define NewPtrClear(x)                  (Ptr) calloc(x, 1)
  70. #define NewPtrSys(x)                (Ptr) malloc(x)
  71. #define NewPtrSysClear(x)             (Ptr) calloc(x, 1)
  72.  
  73. #define DisposPtr(x)                free(x)
  74. #define DisposePtr(x)                free(x)
  75. #define BlockMoveData(x,y,z)        memcpy(y,x,z)
  76. #define BlockMove(x,y,z)            memcpy(y,x,z)
  77. #define MemError()                    0
  78.  
  79. #ifndef true
  80. #define true     TRUE
  81. #endif
  82.  
  83. #ifndef false
  84. #define false    FALSE
  85. #endif
  86.  
  87.  
  88. #define FSSpec    char
  89. #define noErr    0
  90.  
  91. static void DebugStr( unsigned char* x)
  92. {
  93.     char *temp;
  94.     
  95.     temp = NewPtr( (x[ 0] + 1));
  96.     
  97.     BlockMoveData( x+1, temp, x[ 0]);
  98.     temp[ x[ 0]] = 0;
  99.     
  100.     debugger( temp);
  101.     
  102.     DisposePtr( temp);
  103. }
  104.  
  105. #endif
  106. #endif
  107.  
  108. //////////////////////////////////////////////////////////////////////
  109.  
  110. #if defined(powerc) || defined (__powerc)
  111. #pragma options align=mac68k
  112. #else
  113. #if !defined(THINK_C)
  114. #pragma options align=mac68k
  115. #endif
  116. #endif
  117.  
  118. #define DEFAULT_VOLFADE        300L
  119. #define MAXINSTRU            255L
  120. #define MAXPOINTER            999L
  121. #define MAXTRACK            256L
  122. #define MADID                'MADI'
  123.  
  124. // ***    
  125. // ***    PATTERN DESCRIPTION
  126. // ***    
  127.  
  128. struct Cmd                            // COMMAND
  129. {
  130.     Byte    ins;                    // Instrument no        0x00: no ins cmd
  131.     Byte     note;                    // Note, see table        0xFF : no note cmd
  132.     Byte     cmd;                    // Effect cmd
  133.     Byte     arg;                    // Effect argument
  134.     Byte    vol;                    // Volume                0xFF : no volume cmd
  135.     Byte    unused;
  136. };
  137. typedef struct Cmd Cmd;
  138.  
  139. struct PatHeader                    // HEADER
  140. {
  141.     long    size;                    // Length of pattern: standard = 64
  142.     long    compMode;                // Compression mode, none = 'NONE'
  143.     char    name[ 32];
  144.     long    patBytes;                // Pattern Size in Bytes
  145.     long    unused2;
  146. };
  147. typedef struct PatHeader PatHeader;
  148.  
  149. struct PatData                        // DATA STRUCTURE : HEADER + COMMANDS
  150. {                                    // Pattern = 64 notes to play
  151.     PatHeader    header;
  152.     Cmd            Cmds[ 1];
  153. };
  154. typedef struct PatData PatData;
  155.  
  156.  
  157.  
  158. // ***    
  159. // ***    INSTRUMENT DESCRIPTION
  160. // ***    
  161.  
  162.  
  163. struct sData                                // SAMPLE
  164. {
  165.     long                 size;                // Sample length
  166.     long                loopBeg;            // LoopStart
  167.     long                loopSize;            // LoopLength
  168.     Byte                 vol;                // Base volume
  169.     unsigned short        c2spd;                // c2spd
  170.     Byte                loopType;
  171.     Byte                amp;                // 8 or 16 bits
  172.     char                relNote;
  173.     char                 name[ 32];            // Sample name
  174.     Byte                stereo;                // Stereo
  175.     Ptr                    data;                // Used only in memory, not in files
  176. };
  177. typedef struct sData sData;
  178.  
  179. enum
  180. {
  181.     eClassicLoop    = 0,
  182.     ePingPongLoop    = 1
  183. };
  184.  
  185.  
  186. struct EnvRec                // Volume Enveloppe
  187. {
  188.     short     pos;                // pos
  189.     short    val;                // val
  190. };
  191. typedef struct EnvRec EnvRec;
  192.  
  193. struct InstrData                // INSTRUMENT
  194. {
  195.     char     name[ 32];            // instrument name
  196.     Byte     type;                // Instrument type = 0
  197.     Byte    no;                    // Instrument number
  198.     
  199.     short    firstSample;        // First sample ID in sample list
  200.     short    numSamples;            // Number of samples in instrument
  201.     
  202.     /**/
  203.     
  204.     Byte    what[ 96];            // Sample number for all notes
  205.     EnvRec     volEnv[ 12];        // Points for volume envelope
  206.     EnvRec    pannEnv[ 12];        // Points for panning envelope
  207.     
  208.     Byte    volSize;            // Number of volume points
  209.     Byte    pannSize;            // Number of panning points
  210.     
  211.     Byte    volSus;                // Volume sustain point
  212.     Byte    volBeg;                // Volume loop start point
  213.     Byte    volEnd;                // Volume loop end point
  214.     
  215.     Byte    pannSus;            // Panning sustain point
  216.     Byte    pannBeg;            // Panning loop start point
  217.     Byte    pannEnd;            // Panning loop end point
  218.     
  219.     Byte    volType;            // Volume type: bit 0: On; 1: Sustain; 2: Loop
  220.     Byte    pannType;            // Panning type: bit 0: On; 1: Sustain; 2: Loop
  221.     
  222.     unsigned short    volFade;    // Volume fadeout
  223.     
  224.     Byte    vibDepth;
  225.     Byte    vibRate;
  226. };
  227. typedef struct InstrData InstrData;
  228.  
  229.  
  230. enum
  231. {
  232.     EFON        = 1,
  233.     EFSUSTAIN    = 2,
  234.     EFLOOP        = 4
  235. };
  236.  
  237.  
  238. // ***    
  239. // ***    MAD FILE HEADER DESCRIPTION
  240. // ***    
  241.  
  242.  
  243. #define INFOSSIZE 252
  244.  
  245. struct MADSpec
  246. {
  247.     long        MAD;                        // Mad Identification
  248.     char         name[ 32];                    // Music's name
  249.     char        infos[ INFOSSIZE];            // Informations & Author name of the music
  250.     Byte        showCopyright;                // Show infos at startup? true or false
  251.     Byte        generalPitch;                // General Pitch
  252.     Byte        generalSpeed;                // General Speed
  253.     Byte        generalVol;                    // Software general volume
  254.     Byte        numPat;                        // Patterns number
  255.     Byte        numChn;                        // Channels number
  256.     Byte         numPointers;                // Partition length
  257.     Byte        numInstru;                    // Instruments number
  258.     Byte        numSamples;                    // Samples number
  259.     Byte        oPointers[ MAXPOINTER];        // Partition : Patterns ID List
  260.     short        speed;                        // Default speed
  261.     short        tempo;                        // Default tempo
  262.     Byte        chanPan[ MAXTRACK];            // Channel settings, from 0 to 256
  263.     Byte        chanVol[ MAXTRACK];            // Channel Volume, from 0 to 64
  264. };
  265. typedef struct MADSpec MADSpec;
  266.  
  267. #if defined(powerc) || defined (__powerc)
  268. #pragma options align=reset
  269. #else
  270. #if !defined(THINK_C)
  271. #pragma options align=reset
  272. #endif
  273. #endif
  274. #endif