summaryrefslogtreecommitdiff
path: root/apps/plugins/mikmod/mmerror.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mikmod/mmerror.c')
-rw-r--r--apps/plugins/mikmod/mmerror.c150
1 files changed, 126 insertions, 24 deletions
diff --git a/apps/plugins/mikmod/mmerror.c b/apps/plugins/mikmod/mmerror.c
index ed7c66a10f..4d7949890e 100644
--- a/apps/plugins/mikmod/mmerror.c
+++ b/apps/plugins/mikmod/mmerror.c
@@ -6,12 +6,12 @@
6 it under the terms of the GNU Library General Public License as 6 it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of 7 published by the Free Software Foundation; either version 2 of
8 the License, or (at your option) any later version. 8 the License, or (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Library General Public License for more details. 13 GNU Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public 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 16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
@@ -20,7 +20,7 @@
20 20
21/*============================================================================== 21/*==============================================================================
22 22
23 $Id: mmerror.c,v 1.2 2005/03/30 19:10:41 realtech Exp $ 23 $Id$
24 24
25 Error handling functions. 25 Error handling functions.
26 Register an error handler with _mm_RegisterErrorHandler() and you're all set. 26 Register an error handler with _mm_RegisterErrorHandler() and you're all set.
@@ -40,7 +40,9 @@
40 40
41#include "mikmod_internals.h" 41#include "mikmod_internals.h"
42 42
43CHAR *_mm_errmsg[MMERR_MAX+1] = 43#define _mmerr_invalid "Invalid error code"
44
45static const char *_mm_errmsg[MMERR_MAX+1] =
44{ 46{
45/* No error */ 47/* No error */
46 48
@@ -82,62 +84,89 @@ CHAR *_mm_errmsg[MMERR_MAX+1] =
82 "Unable to set non-blocking mode for audio device", 84 "Unable to set non-blocking mode for audio device",
83 85
84/* AudioFile driver errors */ 86/* AudioFile driver errors */
85 87#ifdef DRV_AF
86 "Cannot find suitable AudioFile audio port", 88 "Cannot find suitable AudioFile audio port",
89#else
90 _mmerr_invalid,
91#endif
87 92
88/* AIX driver errors */ 93/* AIX driver errors */
89 94#ifdef DRV_AIX
90 "Configuration (init step) of audio device failed", 95 "Configuration (init step) of audio device failed",
91 "Configuration (control step) of audio device failed", 96 "Configuration (control step) of audio device failed",
92 "Configuration (start step) of audio device failed", 97 "Configuration (start step) of audio device failed",
93 98#else
94/* ALSA driver errors */ 99 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
95 100#endif
96/* EsounD driver errors */
97 101
98/* Ultrasound driver errors */ 102/* Ultrasound driver errors */
99 103#ifdef DRV_ULTRA
100 "Ultrasound driver only works in 16 bit stereo 44 KHz", 104 "Ultrasound driver only works in 16 bit stereo 44 KHz",
101 "Ultrasound card could not be reset", 105 "Ultrasound card could not be reset",
102 "Could not start Ultrasound timer", 106 "Could not start Ultrasound timer",
107#else
108 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
109#endif
103 110
104/* HP driver errors */ 111/* HP driver errors */
105 112#ifdef DRV_HP
106 "Unable to select 16bit-linear sample format", 113 "Unable to select 16bit-linear sample format",
107 "Could not select requested sample-rate", 114 "Could not select requested sample-rate",
108 "Could not select requested number of channels", 115 "Could not select requested number of channels",
109 "Unable to select audio output", 116 "Unable to select audio output",
110 "Unable to get audio description", 117 "Unable to get audio description",
111 "Could not set transmission buffer size", 118 "Could not set transmission buffer size",
119#else
120 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
121 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
122#endif
112 123
113/* Open Sound System driver errors */ 124/* Open Sound System driver errors */
114 125#ifdef DRV_OSS
115 "Could not set fragment size", 126 "Could not set fragment size",
116 "Could not set sample size", 127 "Could not set sample size",
117 "Could not set mono/stereo setting", 128 "Could not set mono/stereo setting",
118 "Could not set sample rate", 129 "Could not set sample rate",
130#else
131 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
132 _mmerr_invalid,
133#endif
119 134
120/* SGI driver errors */ 135/* SGI driver errors */
121 136#ifdef DRV_SGI
122 "Unsupported sample rate", 137 "Unsupported sample rate",
123 "Hardware does not support 16 bit sound", 138 "Hardware does not support 16 bit sound",
124 "Hardware does not support 8 bit sound", 139 "Hardware does not support 8 bit sound",
125 "Hardware does not support stereo sound", 140 "Hardware does not support stereo sound",
126 "Hardware does not support mono sound", 141 "Hardware does not support mono sound",
142#else
143 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
144 _mmerr_invalid, _mmerr_invalid,
145#endif
127 146
128/* Sun driver errors */ 147/* Sun driver errors */
129 148#ifdef DRV_SUN
130 "Sound device initialization failed", 149 "Sound device initialization failed",
150#else
151 _mmerr_invalid,
152#endif
131 153
132/* OS/2 drivers errors */ 154/* OS/2 drivers errors */
133 155#if defined(DRV_OS2) || defined(DRV_DART)
134 "Could not set mixing parameters", 156 "Could not set mixing parameters",
157#else
158 _mmerr_invalid,
159#endif
160#ifdef DRV_OS2
135 "Could not create playback semaphores", 161 "Could not create playback semaphores",
136 "Could not create playback timer", 162 "Could not create playback timer",
137 "Could not create playback thread", 163 "Could not create playback thread",
164#else
165 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
166#endif
138 167
139/* DirectSound driver errors */ 168/* DirectSound driver errors */
140 169#ifdef DRV_DS
141 "Could not set playback priority", 170 "Could not set playback priority",
142 "Could not create playback buffers", 171 "Could not create playback buffers",
143 "Could not set playback format", 172 "Could not set playback format",
@@ -145,22 +174,34 @@ CHAR *_mm_errmsg[MMERR_MAX+1] =
145 "Could not register event", 174 "Could not register event",
146 "Could not create playback thread", 175 "Could not create playback thread",
147 "Could not initialize playback thread", 176 "Could not initialize playback thread",
177#else
178 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
179 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
180 _mmerr_invalid,
181#endif
148 182
149/* Windows Multimedia API driver errors */ 183/* Windows Multimedia API driver errors */
150 184#ifdef DRV_WIN
151 "Invalid device handle", 185 "Invalid device handle",
152 "The resource is already allocated", 186 "The resource is already allocated",
153 "Invalid device identifier", 187 "Invalid device identifier",
154 "Unsupported output format", 188 "Unsupported output format",
155 "Unknown error", 189 "Unknown error",
190#else
191 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
192 _mmerr_invalid, _mmerr_invalid,
193#endif
156 194
157/* Macintosh driver errors */ 195/* Macintosh driver errors */
158 196#ifdef DRV_MAC
159 "Unsupported sample rate", 197 "Unsupported sample rate",
160 "Could not start playback", 198 "Could not start playback",
199#else
200 _mmerr_invalid, _mmerr_invalid,
201#endif
161 202
162/* MacOS X/Darwin driver errors */ 203/* MacOS X/Darwin driver errors */
163 204#ifdef DRV_OSX
164 "Unknown device", 205 "Unknown device",
165 "Bad property", 206 "Bad property",
166 "Could not set playback format", 207 "Could not set playback format",
@@ -169,20 +210,81 @@ CHAR *_mm_errmsg[MMERR_MAX+1] =
169 "Could not create playback thread", 210 "Could not create playback thread",
170 "Could not start audio device", 211 "Could not start audio device",
171 "Could not create buffer thread", 212 "Could not create buffer thread",
213#else
214 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
215 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
216 _mmerr_invalid, _mmerr_invalid,
217#endif
172 218
173/* DOS driver errors */ 219/* DOS driver errors */
174 220#ifdef DRV_WSS
175 "WSS_STARTDMA", 221 "WSS_STARTDMA",
222#else
223 _mmerr_invalid,
224#endif
225#ifdef DRV_SB
176 "SB_STARTDMA", 226 "SB_STARTDMA",
227#else
228 _mmerr_invalid,
229#endif
230
231/* float32 output */
232
233 "This driver doesn't support 32 bit float output",
234
235/* OpenAL driver errors */
236#ifdef DRV_OPENAL
237 "Could not create context",
238 "Could not make context current",
239 "Could not create buffers",
240 "Could not create sources",
241 "Could not change source parameters",
242 "Could not queue buffers",
243 "Could not unqueue buffers",
244 "Could not copy buffer data",
245 "Could not get source parameters",
246 "Could not play source",
247 "Could not stop source",
248#else
249 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
250 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
251 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
252 _mmerr_invalid, _mmerr_invalid,
253#endif
254
255/* ALSA driver errors */
256#ifdef DRV_ALSA
257 "No ALSA configurations available",
258 "Could not set ALSA output params",
259 "Could not set playback format",
260 "Could not set sample rate",
261 "Could not set mono/stereo setting",
262 "Could not get buffer size from ALSA",
263 "ALSA PCM start error",
264 "ALSA PCM write error",
265 "ALSA PCM recovery failure",
266#else
267 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
268 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
269 _mmerr_invalid, _mmerr_invalid, _mmerr_invalid,
270#endif
271
272/* Sndio errors */
273#ifdef DRV_SNDIO
274 "Could not set SNDIO output params",
275 "Unsupported SNDIO output params",
276#else
277 _mmerr_invalid, _mmerr_invalid,
278#endif
177 279
178/* Invalid error */ 280/* Invalid error */
179 281
180 "Invalid error code" 282 _mmerr_invalid
181}; 283};
182 284
183MIKMODAPI char *MikMod_strerror(int code) 285MIKMODAPI const char *MikMod_strerror(int code)
184{ 286{
185 if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX+1; 287 if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX;
186 return _mm_errmsg[code]; 288 return _mm_errmsg[code];
187} 289}
188 290