OSDN Git Service

* configure.in
[timidity41/timidity41.git] / libunimod / unimod_priv.h
1 /*      MikMod sound library
2    (c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for
3    complete list.
4
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.
9
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.
14
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
18    02111-1307, USA.
19  */
20
21 /*==============================================================================
22
23   $Id$
24
25   MikMod sound library internal definitions
26
27 ==============================================================================*/
28
29 #ifndef _UNIMOD_PRIV_H
30 #define _UNIMOD_PRIV_H
31
32 #ifdef __cplusplus
33 extern "C"
34 {
35 #endif
36
37 #if defined(HAVE_MALLOC_H) && !defined(_MSC_VER) && !defined(__BORLANDC__) && !defined(__WATCOMC__)
38 #include <malloc.h>
39 #endif
40 #include <stdarg.h>
41 #if defined(__OS2__)||defined(__EMX__)||defined(__W32__)
42 #ifndef strcasecmp
43 #define strcasecmp(s,t) stricmp(s,t)
44 #endif
45 #endif
46
47 #include "unimod.h"
48 #include "url.h"
49
50 #ifdef __W32__
51 #pragma warning(disable:4761)
52 #endif
53
54 /*========== Error handling */
55
56 #define _mm_errno ML_errno
57
58 /*========== Memory allocation */
59
60 extern void *_mm_malloc (size_t);
61 extern void *_mm_calloc (size_t, size_t);
62 #define _mm_free(p) do { if (p) free(p); p = NULL; } while(0)
63
64 /*========== Portable file I/O */
65
66 #define _mm_read_SBYTE(x)       ((SBYTE)url_getc(x))
67 #define _mm_read_UBYTE(x)       ((UBYTE)url_getc(x))
68 #define _mm_read_SBYTES(x,y,z)  url_nread(z,(void *)x,y)
69 #define _mm_read_UBYTES(x,y,z)  url_nread(z,(void *)x,y)
70 #define _mm_fseek(x,y,z)        url_seek(x,y,z)
71 #define _mm_ftell(x)            url_tell(x)
72 #define _mm_eof(x)              url_eof(x)
73 #define _mm_rewind(x)           _mm_fseek(x,0,SEEK_SET)
74
75 extern int _mm_read_string (CHAR *, int, URL);
76
77 extern SWORD _mm_read_M_SWORD (URL);
78 extern SWORD _mm_read_I_SWORD (URL);
79 extern UWORD _mm_read_M_UWORD (URL);
80 extern UWORD _mm_read_I_UWORD (URL);
81
82 extern SLONG _mm_read_M_SLONG (URL);
83 extern SLONG _mm_read_I_SLONG (URL);
84 extern ULONG _mm_read_M_ULONG (URL);
85 extern ULONG _mm_read_I_ULONG (URL);
86
87 extern int _mm_read_M_SWORDS (SWORD *, int, URL);
88 extern int _mm_read_I_SWORDS (SWORD *, int, URL);
89 extern int _mm_read_M_UWORDS (UWORD *, int, URL);
90 extern int _mm_read_I_UWORDS (UWORD *, int, URL);
91
92 extern int _mm_read_M_SLONGS (SLONG *, int, URL);
93 extern int _mm_read_I_SLONGS (SLONG *, int, URL);
94 extern int _mm_read_M_ULONGS (ULONG *, int, URL);
95 extern int _mm_read_I_ULONGS (ULONG *, int, URL);
96
97
98 /*========== Loaders */
99
100 typedef struct MLOADER
101 {
102   struct MLOADER *next;
103   CHAR *type;
104   CHAR *version;
105   BOOL (*Init) (void);
106   BOOL (*Test) (void);
107   BOOL (*Load) (BOOL);
108   void (*Cleanup) (void);
109   CHAR *(*LoadTitle) (void);
110 }
111 MLOADER;
112
113 /* internal loader variables: */
114 extern URL modreader;
115 extern UWORD finetune[16];
116 extern MODULE of;               /* static unimod loading space */
117
118 extern SBYTE remap[64]; /* for removing empty channels */
119 extern UBYTE *poslookup;        /* lookup table for pattern jumps after
120                                  blank pattern removal */
121 extern UBYTE poslookupcnt;
122 extern UWORD *origpositions;
123
124 extern BOOL filters;            /* resonant filters in use */
125 extern UBYTE activemacro;       /* active midi macro number for Sxx */
126 extern UBYTE filtermacros[16];  /* midi macros settings */
127 extern FILTER filtersettings[256];      /* computed filter settings */
128
129 extern int *noteindex;
130
131 /* tracker identifiers */
132 #define STM_NTRACKERS 3
133 extern CHAR *STM_Signatures[];
134 extern CHAR *STM_Version[];
135
136
137 /*========== Internal loader interface */
138
139 extern BOOL ReadComment (UWORD);
140 extern BOOL ReadLinedComment (UWORD, UWORD);
141 extern BOOL AllocPositions (int);
142 extern BOOL AllocPatterns (void);
143 extern BOOL AllocTracks (void);
144 extern BOOL AllocInstruments (void);
145 extern BOOL AllocSamples (void);
146 extern CHAR *DupStr (CHAR *, UWORD, BOOL);
147
148 /* loader utility functions */
149 extern int *AllocLinear (void);
150 extern void FreeLinear (void);
151 extern int speed_to_finetune (ULONG, int);
152 extern void S3MIT_ProcessCmd (UBYTE, UBYTE, BOOL);
153 extern void S3MIT_CreateOrders (BOOL);
154
155 #ifdef __cplusplus
156 }
157 #endif
158
159 #endif
160
161 /* ex:set ts=4: */