1 /* $Id: umodplayer.h,v 1.5 2006/09/15 14:16:27 toad32767 Exp $ */
2 /**
3  ** 2005, 2006 by Marco Trillo
4  ** This file is part of UModPlayer, and is released by
5  ** its autors to the Public Domain.
6  ** In case it's not legally possible, its autors grant
7  ** anyone the right to use, redistribute and modify
8  ** this software for any purpose, without any conditions
9  ** unless such conditions are required by law.
10  **
11  ** THIS FILE COMES WITHOUT ANY WARRANTY. THE AUTHORS
12  ** SHALL NOT BE LIABLE FOR ANY DAMAGE RESULTING BY THE
13  ** USE OR MISUSE OF THIS SOFTWARE.
14  **/
15 
16 #ifndef _UMODPLAYER_H_
17 #define _UMODPLAYER_H_
18 
19 #include <config.h>
20 
21 #ifdef EXPORT
22 # undef EXPORT
23 #endif
24 
25 #define EXPORT    /**/
26 
27 #ifdef LOCAL
28 # undef LOCAL
29 #endif
30 
31 #define LOCAL static
32 
33 #include <modplug.config.h>
34 
35 #include <inttypes.h>
36 #include <stdlib.h>
37 #include <unistd.h>
38 #include <dirent.h>
39 #include <fcntl.h>
40 #include <sys/types.h>
41 #include <stdio.h>
42 #include <string.h>
43 
44 #include <modinfo.h>
45 #include <tablewidget.h>
46 #include <libmodplug/modplug.h>
47 #include <ao/ao.h>
48 
49 /* byte-swapping */
50 #ifdef swap32
51 # undef swap32
52 #endif
53 #ifdef swap16
54 # undef swap16
55 #endif
56 #define swap32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0xff0000) >> 8) | (((x) & 0xff00) << 8) | (((x) & 0xff) << 24))
57 #define swap16(x) ((((x) & 0xff00) >> 8) | (((x) & 0xff) << 8))
58 
59 #define DEFAULT_SAMPLERATE 44100
60 #define PREFS_FILE ".umodplayerb"
61 
62 #define STREQ(aa,bb) (strcmp(aa,bb)==0)
63 #define MAXVAL(xx,yy) ((xx>yy) ? xx : yy)
64 
65 #define EXPORT_TYPE_IT    6
66 #define EXPORT_TYPE_WAV   3
67 #define EXPORT_TYPE_AIFF  4
68 #define EXPORT_TYPE_PCM   5
69 #define EXPORT_SYS_ENDIAN 0
70 #define EXPORT_BIG_ENDIAN 2
71 #define EXPORT_LTE_ENDIAN 8
72 
73 /* error codes */
74 #define UM_OK		0
75 #define UM_ERR_INTERNAL	1
76 #define UM_ERR_INVAL	2
77 #define UM_ERR_MEMORY	3
78 #define UM_ERR_IO	4
79 #define UM_ERR_NOITEM	5 /* this is special for playlist */
80 
81 /*
82  * some system header files might define these
83  */
84 #ifdef BIG_ENDIAN
85 # undef BIG_ENDIAN
86 #endif
87 #ifdef LTE_ENDIAN
88 # undef LTE_ENDIAN
89 #endif
90 #ifdef UNKNOWN_ENDIAN
91 # undef UNKNOWN_ENDIAN
92 #endif
93 
94 enum endian {BIG_ENDIAN, LTE_ENDIAN, UNKNOWN_ENDIAN};
95 typedef enum endian Endian;
96 
97 /*
98  * boolean data type
99  */
100 #ifdef Bool
101 # undef Bool
102 #endif
103 #ifdef TRUE
104 # undef TRUE
105 #endif
106 #ifdef FALSE
107 # undef FALSE
108 #endif
109 
110 enum boolean {FALSE = 0, TRUE};
111 typedef enum boolean Bool;
112 
113 struct oFlags {
114 	int samplerate;
115 	unsigned int vol;
116 	int channels;
117 	int flags;
118 	int resampling;
119 	int reverbDepth;
120 	int reverbDelay;
121 	int bassAmount;
122 	int bassRange;
123 	int surroundDepth;
124 	int surroundDelay;
125 	WTheme appareance;
126 	Endian endianness;
127 	int verbosity;
128 };
129 
130 typedef void (*xproc) ();
131 
132 struct file {
133 	Bool malloc; /* is file name malloc()'d ? */
134 	char *name; /* file name */
135 	ModPlugFile *mod; /* ModPlug */
136 };
137 
138 extern struct file file;
139 extern struct oFlags sets;
140 extern char **rr;
141 extern int startpos;
142 extern int endpos;
143 extern int CoreSound_BitsPerSample;
144 extern char *AudioDriver;
145 extern Bool AudioActive;
146 extern ao_device *AO_Device;
147 
148 void PrintBanner(void);
149 
150 #ifdef bsLE16
151 # undef bsLE16
152 #endif
153 #ifdef bsLE32
154 # undef bsLE32
155 #endif
156 #ifdef bsBE32
157 # undef bsBE32
158 #endif
159 
160 /* defined in io.c */
161 uint16_t bsLE16(uint16_t);
162 uint32_t bsLE32(uint32_t);
163 uint32_t bsBE32(uint32_t);
164 void notice(char*, ...);
165 void warning(char*, ...);
166 void error(char*, ...);
167 
168 #endif
169