Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM (code), use...
[maemo-rb.git] / apps / plugins / mikmod / mmerror.c
blobbd703f6c267bee4b8ae1c7a9054a17d186acf36d
1 /* MikMod sound library
2 (c) 1998, 1999, 2000 Miodrag Vallat and others - see file AUTHORS for
3 complete list.
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
18 02111-1307, USA.
21 /*==============================================================================
23 $Id: mmerror.c,v 1.2 2005/03/30 19:10:41 realtech Exp $
25 Error handling functions.
26 Register an error handler with _mm_RegisterErrorHandler() and you're all set.
28 ==============================================================================*/
32 The global variables _mm_errno, and _mm_critical are set before the error
33 handler in called. See below for the values of these variables.
37 #ifdef HAVE_CONFIG_H
38 #include "config.h"
39 #endif
41 #include "mikmod_internals.h"
43 CHAR *_mm_errmsg[MMERR_MAX+1] =
45 /* No error */
47 "No error",
49 /* Generic errors */
51 "Could not open requested file",
52 "Out of memory",
53 "Dynamic linking failed",
55 /* Sample errors */
57 "Out of memory to load sample",
58 "Out of sample handles to load sample",
59 "Sample format not recognized",
61 /* Module errors */
63 "Failure loading module pattern",
64 "Failure loading module track",
65 "Failure loading module header",
66 "Failure loading sampleinfo",
67 "Module format not recognized",
68 "Module sample format not recognized",
69 "Synthsounds not supported in MED files",
70 "Compressed sample is invalid",
72 /* Driver errors: */
74 "Sound device not detected",
75 "Device number out of range",
76 "Software mixer failure",
77 "Could not open sound device",
78 "This driver supports 8 bit linear output only",
79 "This driver supports 16 bit linear output only",
80 "This driver supports stereo output only",
81 "This driver supports uLaw output (8 bit mono, 8 kHz) only",
82 "Unable to set non-blocking mode for audio device",
84 /* AudioFile driver errors */
86 "Cannot find suitable AudioFile audio port",
88 /* AIX driver errors */
90 "Configuration (init step) of audio device failed",
91 "Configuration (control step) of audio device failed",
92 "Configuration (start step) of audio device failed",
94 /* ALSA driver errors */
96 /* EsounD driver errors */
98 /* Ultrasound driver errors */
100 "Ultrasound driver only works in 16 bit stereo 44 KHz",
101 "Ultrasound card could not be reset",
102 "Could not start Ultrasound timer",
104 /* HP driver errors */
106 "Unable to select 16bit-linear sample format",
107 "Could not select requested sample-rate",
108 "Could not select requested number of channels",
109 "Unable to select audio output",
110 "Unable to get audio description",
111 "Could not set transmission buffer size",
113 /* Open Sound System driver errors */
115 "Could not set fragment size",
116 "Could not set sample size",
117 "Could not set mono/stereo setting",
118 "Could not set sample rate",
120 /* SGI driver errors */
122 "Unsupported sample rate",
123 "Hardware does not support 16 bit sound",
124 "Hardware does not support 8 bit sound",
125 "Hardware does not support stereo sound",
126 "Hardware does not support mono sound",
128 /* Sun driver errors */
130 "Sound device initialization failed",
132 /* OS/2 drivers errors */
134 "Could not set mixing parameters",
135 "Could not create playback semaphores",
136 "Could not create playback timer",
137 "Could not create playback thread",
139 /* DirectSound driver errors */
141 "Could not set playback priority",
142 "Could not create playback buffers",
143 "Could not set playback format",
144 "Could not register callback",
145 "Could not register event",
146 "Could not create playback thread",
147 "Could not initialize playback thread",
149 /* Windows Multimedia API driver errors */
151 "Invalid device handle",
152 "The resource is already allocated",
153 "Invalid device identifier",
154 "Unsupported output format",
155 "Unknown error",
157 /* Macintosh driver errors */
159 "Unsupported sample rate",
160 "Could not start playback",
162 /* MacOS X/Darwin driver errors */
164 "Unknown device",
165 "Bad property",
166 "Could not set playback format",
167 "Could not set mono/stereo setting",
168 "Could not create playback buffers",
169 "Could not create playback thread",
170 "Could not start audio device",
171 "Could not create buffer thread",
173 /* DOS driver errors */
175 "WSS_STARTDMA",
176 "SB_STARTDMA",
178 /* Invalid error */
180 "Invalid error code"
183 MIKMODAPI char *MikMod_strerror(int code)
185 if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX+1;
186 return _mm_errmsg[code];
189 /* User installed error callback */
190 MikMod_handler_t _mm_errorhandler = NULL;
191 MIKMODAPI int _mm_errno = 0;
192 MIKMODAPI int _mm_critical = 0;
194 MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)
196 MikMod_handler_t oldproc=_mm_errorhandler;
198 _mm_errorhandler = proc;
199 return oldproc;
202 MIKMODAPI MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t proc)
204 MikMod_handler_t result;
206 MUTEX_LOCK(vars);
207 result=_mm_registererrorhandler(proc);
208 MUTEX_UNLOCK(vars);
210 return result;
213 /* ex:set ts=4: */