Skip to content

Latest commit

 

History

History
197 lines (141 loc) · 4.84 KB

mmerror.c

File metadata and controls

197 lines (141 loc) · 4.84 KB
 
Dec 27, 1999
Dec 27, 1999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* MikMod sound library
(c) 1998, 1999 Miodrag Vallat and others - see file AUTHORS for
complete list.
This library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
Oct 21, 1999
Oct 21, 1999
20
Dec 27, 1999
Dec 27, 1999
21
/*==============================================================================
Oct 21, 1999
Oct 21, 1999
22
Dec 27, 1999
Dec 27, 1999
23
$Id$
Oct 21, 1999
Oct 21, 1999
24
Dec 27, 1999
Dec 27, 1999
25
26
Error handling functions.
Register an error handler with _mm_RegisterErrorHandler() and you're all set.
Oct 21, 1999
Oct 21, 1999
27
Dec 27, 1999
Dec 27, 1999
28
==============================================================================*/
Oct 21, 1999
Oct 21, 1999
29
Dec 27, 1999
Dec 27, 1999
30
/*
Oct 21, 1999
Oct 21, 1999
31
Dec 27, 1999
Dec 27, 1999
32
33
The global variables _mm_errno, and _mm_critical are set before the error
handler in called. See below for the values of these variables.
Oct 21, 1999
Oct 21, 1999
34
35
36
*/
Dec 27, 1999
Dec 27, 1999
37
38
39
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Oct 21, 1999
Oct 21, 1999
40
Dec 27, 1999
Dec 27, 1999
41
#include "mikmod_internals.h"
Oct 21, 1999
Oct 21, 1999
42
Dec 27, 1999
Dec 27, 1999
43
CHAR *_mm_errmsg[MMERR_MAX+1] =
Oct 21, 1999
Oct 21, 1999
44
{
Dec 27, 1999
Dec 27, 1999
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/* No error */
"No error",
/* Generic errors */
"Could not open requested file",
"Out of memory",
"Dynamic linking failed",
/* Sample errors */
"Out of memory to load sample",
"Out of sample handles to load sample",
"Sample format not recognized",
/* Module errors */
"Failure loading module pattern",
"Failure loading module track",
"Failure loading module header",
"Failure loading sampleinfo",
"Module format not recognized",
"Module sample format not recognized",
"Synthsounds not supported in MED files",
"Compressed sample is invalid",
/* Driver errors: */
"Sound device not detected",
"Device number out of range",
"Software mixer failure",
"Could not open sound device",
"This driver supports 8 bit linear output only",
"This driver supports 16 bit linear output only",
"This driver supports stereo output only",
"This driver supports uLaw output (8 bit mono, 8 kHz) only",
"Unable to set non-blocking mode for audio device",
/* AudioFile driver errors */
"Cannot find suitable AudioFile audio port",
/* AIX driver errors */
"Configuration (init step) of audio device failed",
"Configuration (control step) of audio device failed",
"Configuration (start step) of audio device failed",
/* ALSA driver errors */
/* EsounD driver errors */
/* Ultrasound driver errors */
"Ultrasound driver only works in 16 bit stereo 44 KHz",
"Ultrasound card could not be reset",
"Could not start Ultrasound timer",
/* HP driver errors */
"Unable to select 16bit-linear sample format",
"Could not select requested sample-rate",
"Could not select requested number of channels",
"Unable to select audio output",
"Unable to get audio description",
"Could not set transmission buffer size",
/* Open Sound System driver errors */
"Could not set fragment size",
"Could not set sample size",
"Could not set mono/stereo setting",
"Could not set sample rate",
/* SGI driver errors */
"Unsupported sample rate",
"Hardware does not support 16 bit sound",
"Hardware does not support 8 bit sound",
"Hardware does not support stereo sound",
"Hardware does not support mono sound",
/* Sun driver errors */
"Sound device initialization failed",
/* OS/2 drivers errors */
"Could not set mixing parameters",
"Could not create playback semaphores",
"Could not create playback timer",
"Could not create playback thread",
/* DirectSound driver errors */
"Could not set playback priority",
"Could not create playback buffers",
"Could not set playback format",
"Could not register callback",
"Could not register event",
"Could not create playback thread",
"Could not initialize playback thread",
/* Windows Multimedia API driver errors */
"Invalid device handle",
"The resource is already allocated",
"Invalid device identifier",
"Unsupported output format",
"Unknown error",
/* Macintosh driver errors */
"Unsupported sample rate",
"Could not start playback",
/* Invalid error */
"Invalid error code"
Oct 21, 1999
Oct 21, 1999
165
166
};
Dec 27, 1999
Dec 27, 1999
167
168
169
170
171
char *MikMod_strerror(int code)
{
if ((code<0)||(code>MMERR_MAX)) code=MMERR_MAX+1;
return _mm_errmsg[code];
}
Oct 21, 1999
Oct 21, 1999
172
Dec 27, 1999
Dec 27, 1999
173
174
175
176
/* User installed error callback */
MikMod_handler_t _mm_errorhandler = NULL;
int _mm_errno = 0;
BOOL _mm_critical = 0;
Oct 21, 1999
Oct 21, 1999
177
Dec 27, 1999
Dec 27, 1999
178
179
180
181
182
183
184
MikMod_handler_t _mm_registererrorhandler(MikMod_handler_t proc)
{
MikMod_handler_t oldproc=_mm_errorhandler;
_mm_errorhandler = proc;
return oldproc;
}
Oct 21, 1999
Oct 21, 1999
185
Dec 27, 1999
Dec 27, 1999
186
MikMod_handler_t MikMod_RegisterErrorHandler(MikMod_handler_t proc)
Oct 21, 1999
Oct 21, 1999
187
{
Dec 27, 1999
Dec 27, 1999
188
189
190
191
192
193
194
MikMod_handler_t result;
MUTEX_LOCK(vars);
result=_mm_registererrorhandler(proc);
MUTEX_UNLOCK(vars);
return result;
Oct 21, 1999
Oct 21, 1999
195
196
}
Dec 27, 1999
Dec 27, 1999
197
/* ex:set ts=4: */