home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / prg / dsik205 / dsik.dat / INCLUDE / IMPORT.H < prev    next >
C/C++ Source or Header  |  1995-04-10  |  7KB  |  323 lines

  1. /****************************************************************************
  2. *
  3. *                   Digital Sound Interface Kit (DSIK)
  4. *                            Version 2.00
  5. *
  6. *                           by Carlos Hasan
  7. *
  8. * Filename:     import.h
  9. * Version:      Revision 1.3
  10. *
  11. * Language:     WATCOM C
  12. * Environment:  IBM PC (DOS/4GW)
  13. *
  14. * Description:  External music modules import routines.
  15. *
  16. * Revision History:
  17. * ----------------
  18. *
  19. * Revision 1.3  94/11/17  16:58:20  chv
  20. * Added Composer 669 and Scream Tracker 2.0 import routines
  21. *
  22. * Revision 1.2  94/11/08  15:10:42  chv
  23. * Added Amiga IFF/8SVX sample file import routines
  24. *
  25. * Revision 1.1  94/10/26  13:12:43  chv
  26. * Added Multitracker MTM modules import routines
  27. *
  28. * Revision 1.0  94/08/22  16:09:24  chv
  29. * Initial revision
  30. *
  31. ****************************************************************************/
  32.  
  33. #ifndef __IMPORT_H
  34. #define __IMPORT_H
  35.  
  36. #ifndef __AUDIO_H
  37. #include <audio.h>
  38. #endif
  39.  
  40. /* supported file formats */
  41.  
  42. #define FORM_DSM    0x00            /* RIFF/DSMF module file */
  43. #define FORM_MOD    0x01            /* Protracker/Fastracker modules */
  44. #define FORM_S3M    0x02            /* Scream Tracker 3.0 modules */
  45. #define FORM_MTM    0x03            /* Multitracker 1.0 modules */
  46. #define FORM_669    0x04            /* Composer 669 modules */
  47. #define FORM_STM    0x05            /* Scream Tracker 2.0 modules */
  48.  
  49. #define FORM_WAV    0x80            /* Windows WAVE PCM files */
  50. #define FORM_VOC    0x81            /* Creative Labs Voice Files */
  51. #define FORM_IFF    0x82            /* Amiga IFF/8SVX sample files */
  52. #define FORM_RAW    0x83            /* 8-bit mono RAW sample files */
  53.  
  54.  
  55. /* Protracker/Fastracker (MOD) file format */
  56.  
  57. #define MOD_MK      0x2E4B2E4DL
  58. #define MOD_FLT4    0x34544C46L
  59. #define MOD_FLT8    0x38544C46L
  60. #define MOD_6CHN    0x4E484336L
  61. #define MOD_8CHN    0x4E484338L
  62.  
  63. typedef struct {
  64.     char    SampleName[22];
  65.     word    Length;
  66.     byte    Finetune;
  67.     byte    Volume;
  68.     word    LoopStart;
  69.     word    LoopLength;
  70. } MODSample;
  71.  
  72. typedef struct {
  73.     char    SongName[20];
  74.     MODSample Samples[31];
  75.     byte    NumOrders;
  76.     byte    ReStart;
  77.     byte    Orders[128];
  78.     dword   Magic;
  79. } MODSong;
  80.  
  81.  
  82. /* Scream Tracker 3.0 (S3M) file format */
  83.  
  84. #define S3M_SCRM    0x4D524353L
  85. #define S3M_SCRS    0x53524353L
  86.  
  87. typedef struct {
  88.     byte    Type;
  89.     char    FileName[13];
  90.     word    DataPtr;
  91.     dword   Length;
  92.     dword   LoopStart;
  93.     dword   LoopEnd;
  94.     byte    Volume;
  95.     byte    LibDisk;
  96.     byte    Pack;
  97.     byte    Flags;
  98.     dword   Rate;
  99.     char    Pad0[12];
  100.     char    SampleName[28];
  101.     dword   Magic;
  102. } S3MSample;
  103.  
  104. typedef struct {
  105.     char    SongName[28];
  106.     byte    EofMark;
  107.     byte    SongType;
  108.     word    Pad0;
  109.     word    NumOrders;
  110.     word    NumSamples;
  111.     word    NumPatterns;
  112.     word    Flags;
  113.     word    Tracker;
  114.     word    FileFormat;
  115.     dword   Magic;
  116.     byte    GlobalVolume;
  117.     byte    Tempo;
  118.     byte    BPM;
  119.     byte    MasterVolume;
  120.     byte    UltraClick;
  121.     byte    DefPan;
  122.     byte    Pad1[8];
  123.     word    Special;
  124.     byte    ChanMap[32];
  125. } S3MSong;
  126.  
  127.  
  128. /* Multitracker 1.0 (MTM) file format */
  129.  
  130. #define MTM_MAGIC   0x104D544DL
  131. #define MTM_MASK    0xF0FFFFFFL
  132.  
  133. typedef struct {
  134.     dword   Magic;
  135.     char    SongName[20];
  136.     word    NumTracks;
  137.     byte    LastPattern;
  138.     byte    LastOrder;
  139.     word    CommentLength;
  140.     byte    NumSamples;
  141.     byte    Flags;
  142.     byte    BeatsPerTrack;
  143.     byte    NumChans;
  144.     byte    PanPos[32];
  145. } MTMSong;
  146.  
  147. typedef struct {
  148.     char    SampleName[22];
  149.     dword   Length;
  150.     dword   LoopStart;
  151.     dword   LoopEnd;
  152.     byte    Finetune;
  153.     byte    Volume;
  154.     byte    Flags;
  155. } MTMSample;
  156.  
  157. typedef struct {
  158.     byte    Data[192];
  159. } MTMTrack;
  160.  
  161.  
  162. /* Composer 669 file format */
  163.  
  164. #define GG9_MAGIC   0x6669
  165.  
  166. typedef struct {
  167.     word    Magic;
  168.     char    SongName[108];
  169.     byte    NumSamples;
  170.     byte    NumPatterns;
  171.     byte    ReStart;
  172.     byte    Orders[128];
  173.     byte    Tempos[128];
  174.     byte    Breaks[128];
  175. } GG9Song;
  176.  
  177. typedef struct {
  178.     char    FileName[13];
  179.     dword   Length;
  180.     dword   LoopStart;
  181.     dword   LoopEnd;
  182. } GG9Sample;
  183.  
  184.  
  185. /* Scream Tracker 2.0 (STM) modules */
  186.  
  187. #define STM_TRACKER "!Scream!"
  188.  
  189. typedef struct {
  190.     char    FileName[13];
  191.     byte    LibDisk;
  192.     word    DataPtr;
  193.     word    Length;
  194.     word    LoopStart;
  195.     word    LoopEnd;
  196.     byte    Volume;
  197.     byte    Pad0;
  198.     word    Rate;
  199.     byte    Pad1[6];
  200. } STMSample;
  201.  
  202. typedef struct {
  203.     char    SongName[20];
  204.     char    Tracker[8];
  205.     byte    EofMark;
  206.     byte    FileType;
  207.     word    TrackerVer;
  208.     byte    InitTempo;
  209.     byte    NumPatterns;
  210.     byte    GlobalVolume;
  211.     byte    Pad[13];
  212.     STMSample Samples[31];
  213.     byte    Orders[128];
  214. } STMSong;
  215.  
  216.  
  217. /* Creative Labs Voice (VOC) file format */
  218.  
  219. #define VOC_HDR         "Creative Voice File\32"
  220.  
  221. #define VOC_TERM        0
  222. #define VOC_DATA        1
  223. #define VOC_CONTINUE    2
  224. #define VOC_SILENCE     3
  225. #define VOC_MARK        4
  226. #define VOC_TEXT        5
  227. #define VOC_REPEAT      6
  228. #define VOC_ENDREPEAT   7
  229. #define VOC_EXTINFO     8
  230.  
  231. #define VOC_FMT_8BITS   0
  232. #define VOC_FMT_4BITS   1
  233. #define VOC_FMT_26BITS  2
  234. #define VOC_FMT_2BITS   3
  235.  
  236. #define VOC_MODE_MONO   0
  237. #define VOC_MODE_STEREO 1
  238.  
  239. typedef struct {
  240.     byte    Magic[20];
  241.     word    BlockPos;
  242.     word    Version;
  243.     word    VersionCheck;
  244. } VocHeader;
  245.  
  246. typedef struct {
  247.     byte    Type;
  248.     byte    Size[3];
  249. } VocBlock;
  250.  
  251. typedef struct {
  252.     byte    TimeConst;
  253.     byte    Format;
  254. } VocData;
  255.  
  256. typedef struct {
  257.     word    TimeConst;
  258.     byte    Pack;
  259.     byte    Mode;
  260. } VocExtInfo;
  261.  
  262.  
  263. /* Amiga IFF/8SVX file format */
  264.  
  265. #define IFF_FORM    0x4D524F46L
  266. #define IFF_8SVX    0x58565338L
  267. #define IFF_VHDR    0x52444856L
  268. #define IFF_ANNO    0x4F4E4E41L
  269. #define IFF_NAME    0x454D414EL
  270. #define IFF_CHAN    0x4E414843L
  271. #define IFF_BODY    0x59444F42L
  272.  
  273. #define WSWAP(w)    ((((w)&0xFF)<<8)|(((w)>>8)&0xFF))
  274. #define LSWAP(l)    ((WSWAP((l)&0xFFFF)<<16)|(WSWAP((l)>>16)))
  275.  
  276. typedef struct {
  277.     dword   ID;
  278.     dword   Length;
  279.     dword   Type;
  280. } IffHeader;
  281.  
  282. typedef struct {
  283.     dword   ID;
  284.     dword   Length;
  285. } IffBlock;
  286.  
  287. typedef struct {
  288.     byte    Pad0[12];
  289.     word    Rate;
  290.     byte    Pad1;
  291.     byte    Format;
  292.     byte    Pad2[4];
  293. } IffVHdr;
  294.  
  295. typedef struct {
  296.     dword   Channels;
  297. } IffChan;
  298.  
  299.  
  300. #ifdef  __cplusplus
  301. extern "C" {
  302. #endif
  303.  
  304. /* Import routines API prototypes */
  305.  
  306. DSM    *dImportModule(char *Filename, int Form);
  307. Sample *dImportSample(char *Filename, int Form);
  308. DSM    *dImportModuleFile(int Handle, long Length, int Form);
  309. Sample *dImportSampleFile(int Handle, long Length, int Form);
  310.  
  311. #ifdef  __cplusplus
  312. }
  313. #endif
  314.  
  315. /* Register calling convention used by the API routines */
  316.  
  317. #pragma aux dImportModule       "_*" parm [eax] [edx];
  318. #pragma aux dImportSample       "_*" parm [eax] [edx];
  319. #pragma aux dImportModuleFile   "_*" parm [eax] [edx] [ebx];
  320. #pragma aux dImportSampleFile   "_*" parm [eax] [edx] [ebx];
  321.  
  322. #endif
  323.