1 /* MikMod sound library
2 (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21 /*==============================================================================
25 MikMod sound library internal definitions
27 ==============================================================================*/
29 #ifndef _UNIMOD_PRIV_H
30 #define _UNIMOD_PRIV_H
37 #if defined(HAVE_MALLOC_H) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
41 #if defined(__OS2__)||defined(__EMX__)||defined(__W32__)
43 #define strcasecmp(s,t) stricmp(s,t)
51 #pragma warning(disable:4761)
56 /*========== Error handling */
58 #define _mm_errno ML_errno
60 /*========== Memory allocation */
62 extern void *_mm_malloc (size_t);
63 extern void *_mm_calloc (size_t, size_t);
64 #define _mm_free(p) do { if (p) free(p); p = NULL; } while(0)
66 /*========== Portable file I/O */
68 #define _mm_read_SBYTE(x) ((SBYTE)url_getc(x))
69 #define _mm_read_UBYTE(x) ((UBYTE)url_getc(x))
70 #define _mm_read_SBYTES(x,y,z) url_nread(z,(void *)x,y)
71 #define _mm_read_UBYTES(x,y,z) url_nread(z,(void *)x,y)
72 #define _mm_fseek(x,y,z) url_seek(x,y,z)
73 #define _mm_ftell(x) url_tell(x)
74 #define _mm_eof(x) url_eof(x)
75 #define _mm_rewind(x) _mm_fseek(x,0,SEEK_SET)
77 extern int _mm_read_string (CHAR *, int, URL);
79 extern SWORD _mm_read_M_SWORD (URL);
80 extern SWORD _mm_read_I_SWORD (URL);
81 extern UWORD _mm_read_M_UWORD (URL);
82 extern UWORD _mm_read_I_UWORD (URL);
84 extern SLONG _mm_read_M_SLONG (URL);
85 extern SLONG _mm_read_I_SLONG (URL);
86 extern ULONG _mm_read_M_ULONG (URL);
87 extern ULONG _mm_read_I_ULONG (URL);
89 extern int _mm_read_M_SWORDS (SWORD *, int, URL);
90 extern int _mm_read_I_SWORDS (SWORD *, int, URL);
91 extern int _mm_read_M_UWORDS (UWORD *, int, URL);
92 extern int _mm_read_I_UWORDS (UWORD *, int, URL);
94 extern int _mm_read_M_SLONGS (SLONG *, int, URL);
95 extern int _mm_read_I_SLONGS (SLONG *, int, URL);
96 extern int _mm_read_M_ULONGS (ULONG *, int, URL);
97 extern int _mm_read_I_ULONGS (ULONG *, int, URL);
100 /*========== Loaders */
102 typedef struct MLOADER
104 struct MLOADER *next;
110 void (*Cleanup) (void);
111 CHAR *(*LoadTitle) (void);
115 /* internal loader variables: */
116 extern URL modreader;
117 extern UWORD finetune[16];
118 extern MODULE of; /* static unimod loading space */
120 extern SBYTE remap[UF_MAXCHAN]; /* for removing empty channels */
121 extern UBYTE *poslookup; /* lookup table for pattern jumps after
122 blank pattern removal */
123 extern UBYTE poslookupcnt;
124 extern UWORD *origpositions;
126 extern BOOL filters; /* resonant filters in use */
127 extern UBYTE activemacro; /* active midi macro number for Sxx */
128 extern UBYTE filtermacros[UF_MAXMACRO]; /* midi macros settings */
129 extern FILTER filtersettings[UF_MAXFILTER]; /* computed filter settings */
131 extern int *noteindex;
133 /* tracker identifiers */
134 #define STM_NTRACKERS 3
135 extern const CHAR *STM_Signatures[];
136 extern const CHAR *STM_Version[];
139 /*========== Internal loader interface */
141 extern BOOL ReadComment (UWORD);
142 extern BOOL ReadLinedComment (UWORD, UWORD);
143 extern BOOL AllocPositions (int);
144 extern BOOL AllocPatterns (void);
145 extern BOOL AllocTracks (void);
146 extern BOOL AllocInstruments (void);
147 extern BOOL AllocSamples (void);
148 extern CHAR *DupStr (CHAR *, UWORD, BOOL);
150 /* loader utility functions */
151 extern int *AllocLinear (void);
152 extern void FreeLinear (void);
153 extern int speed_to_finetune (ULONG, int);
154 extern void S3MIT_ProcessCmd (UBYTE, UBYTE, BOOL);
155 extern void S3MIT_CreateOrders (BOOL);