home *** CD-ROM | disk | FTP | other *** search
/ Da Capo / da_capo_vol1.bin / programs / amiga / midi / mod2midi / mod2midi.h < prev    next >
C/C++ Source or Header  |  1994-06-12  |  2KB  |  76 lines

  1. /* File buffer size.. increase for better performance */
  2. #define BUFFSIZE 512
  3.  
  4. /* Max line length in text files */
  5. #define MAXSTRING 128
  6.  
  7. /* MIDI instrument file */
  8. #define DEF_INSFILE "mod2midi.ins"
  9.  
  10. /* MOD sample to MIDI instrument map */
  11. #define DEF_MAPFILE "mod2midi.map"
  12.  
  13. /* Note conversion statements: */
  14. #define ANOTE(x) ((x < 0) ? (-x) : (NoteValue(x)))
  15. #define ENOTE(x,y) ((sam->m > 127) ? (sam->m - 128) : (ANOTE(x) + sam->t[y]))
  16. #define EVOL(x) ((x + sam->a[0]) * sam->a[1] / sam->a[2])
  17.  
  18. /* Amount of bytes of a sample read in when scanning it */
  19. #define SCANSIZE 3000
  20.  
  21. /* Make sure these fseek positions are defined */
  22. #ifndef SEEK_SET
  23. #define SEEK_SET 0
  24. #define SEEK_CUR 1
  25. #endif
  26.  
  27. /* Make sure this macro is defined */
  28. #ifndef min
  29. #define min(x,y) ((x > y) ? y : x)
  30. #endif
  31.  
  32. typedef char *string;
  33.  
  34. typedef struct bstruct
  35. {
  36.     FILE *f; // File to read/write to
  37.     unsigned char b[BUFFSIZE]; // Holds buffer data
  38.     unsigned int o, r; // Offset in buffer, Bytes actually read
  39. } bfile[1];
  40.  
  41. struct bpos
  42. {
  43.     struct bstruct d; // File data
  44.     unsigned long p; // File position
  45. };
  46.  
  47. typedef struct _X3
  48. {
  49.     char n[23]; // Sample name
  50.     unsigned int l; // Number of ticks in length (4000 per second)
  51.     unsigned char v, m; // Volume of sample, Midi instrument
  52.     signed char c; // Midi channel
  53.     int t[3]; // Transposition amounts
  54.     int a[3]; // Amplification formula: (Vol + a[0]) * a[1] / a[2]
  55. } samp;
  56.  
  57. typedef struct _X4
  58. {
  59.     unsigned char n; // Number of samples
  60.     samp s[31]; // Sample information
  61. } samps[1];
  62.  
  63. /* Bit IDs for conversion modes */
  64. #define MODE_MAPSAMPLES 0x0001
  65. #define MODE_SAVEINFO 0x0002
  66. #define MODE_TRANSPOSE 0x0004
  67. #define MODE_VOLUMESHIFT 0x0008
  68. #define MODE_ABOUT 0x0010
  69. #define MODE_CONVERT 0x0020
  70.  
  71. /* Modes for HandleGadgetMessages() */
  72. #define HM_LISTVIEW 1
  73. #define HM_ENTRY 2
  74.  
  75. #define GetString( g ) ((( struct StringInfo * )g->SpecialInfo )->Buffer )
  76.