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.c213
1 files changed, 213 insertions, 0 deletions
diff --git a/apps/plugins/mikmod/mmerror.c b/apps/plugins/mikmod/mmerror.c
new file mode 100644
index 0000000000..bd703f6c26
--- /dev/null
+++ b/apps/plugins/mikmod/mmerror.c
@@ -0,0 +1,213 @@
1/* MikMod sound library
2 (c) 1998, 1999, 2000 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: mmerror.c,v 1.2 2005/03/30 19:10:41 realtech Exp $
24
25 Error handling functions.
26 Register an error handler with _mm_RegisterErrorHandler() and you're all set.
27
28==============================================================================*/
29
30/*
31
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.
34
35*/
36
37#ifdef HAVE_CONFIG_H
38#include "config.h"
39#endif
40
41#include "mikmod_internals.h"
42
43CHAR *_mm_errmsg[MMERR_MAX+1] =
44{
45/* No error */
46
47 "No error",
48
49/* Generic errors */
50
51 "Could not open requested file",
52 "Out of memory",
53 "Dynamic linking failed",
54
55/* Sample errors */
56
57 "Out of memory to load sample",
58 "Out of sample handles to load sample",
59 "Sample format not recognized",
60
61/* Module errors */
62
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",
71
72/* Driver errors: */
73
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",
83
84/* AudioFile driver errors */
85
86 "Cannot find suitable AudioFile audio port",
87
88/* AIX driver errors */
89
90 "Configuration (init step) of audio device failed",
91 "Configuration (control step) of audio device failed",
92 "Configuration (start step) of audio device failed",
93
94/* ALSA driver errors */
95
96/* EsounD driver errors */
97
98/* Ultrasound driver errors */
99
100 "Ultrasound driver only works in 16 bit stereo 44 KHz",
101 "Ultrasound card could not be reset",
102 "Could not start Ultrasound timer",
103
104/* HP driver errors */
105
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",
112
113/* Open Sound System driver errors */
114
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",
119
120/* SGI driver errors */
121
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",
127
128/* Sun driver errors */
129
130 "Sound device initialization failed",
131
132/* OS/2 drivers errors */
133
134 "Could not set mixing parameters",
135 "Could not create playback semaphores",
136 "Could not create playback timer",
137 "Could not create playback thread",
138
139/* DirectSound driver errors */
140
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",
148
149/* Windows Multimedia API driver errors */
150
151 "Invalid device handle",
152 "The resource is already allocated",
153 "Invalid device identifier",
154 "Unsupported output format",
155 "Unknown error",
156
157/* Macintosh driver errors */
158
159 "Unsupported sample rate",
160 "Could not start playback",
161
162/* MacOS X/Darwin driver errors */
163
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",
172
173/* DOS driver errors */
174
175 "WSS_STARTDMA",
176 "SB_STARTDMA",
177
178/* Invalid error */
179
180 "Invalid error code"
181};
182
183MIKMODAPI char *MikMod_strerror(int code)
184{
185 if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX+1;
186 return _mm_errmsg[code];
187}
188
189/* User installed error callback */
190MikMod_handler_t _mm_errorhandler = NULL;
191MIKMODAPI int _mm_errno = 0;
192MIKMODAPI int _mm_critical = 0;
193
194MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)
195{
196 MikMod_handler_t oldproc=_mm_errorhandler;
197
198 _mm_errorhandler = proc;
199 return oldproc;
200}
201
202MIKMODAPI MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t proc)
203{
204 MikMod_handler_t result;
205
206 MUTEX_LOCK(vars);
207 result=_mm_registererrorhandler(proc);
208 MUTEX_UNLOCK(vars);
209
210 return result;
211}
212
213/* ex:set ts=4: */