10
|
1 /*
|
|
2 --> The MM_Error Portable Error Handling Functions
|
|
3 -> Divine Entertainment GameDev Libraries
|
|
4
|
|
5 File: MMERROR.C
|
|
6
|
|
7 Description:
|
|
8 Error handling functions for use with the DivEnt MMIO and MikMod
|
|
9 libraries. Register an error handler with _mm_RegisterErrorHandler()
|
|
10 and you're all set.
|
|
11
|
|
12 NOTES:
|
|
13
|
|
14 - the global variables _mm_error, _mm_errno, and _mm_critical are
|
|
15 set before the error handler in called. See below for the values
|
|
16 of these variables.
|
|
17
|
|
18 --------------------------
|
|
19
|
|
20
|
|
21 */
|
|
22
|
|
23
|
|
24 #include "mmio.h"
|
|
25
|
|
26 CHAR *_mm_errmsg[] =
|
|
27 {
|
|
28 "",
|
|
29
|
|
30 // Generic MikMod Errors [referenced by _mm_error]
|
|
31 // -----------------------------------------------
|
|
32
|
|
33 "Cannot open requested file",
|
|
34 "Out of memory",
|
|
35 "Unexpected end of file",
|
|
36 "Cannot write to file - Disk full",
|
|
37
|
|
38 // Specific Misceallenous Errors:
|
|
39
|
|
40 "Sample load failed - Out of memory",
|
|
41 "Sample load failed - Out of sample handles",
|
|
42 "Could not allocate page-contiguous dma-buffer",
|
|
43 "Unknown wave file or sample type",
|
|
44 "Unknown streaming audio type",
|
|
45
|
|
46 // Specific Module Loader [MLOADER.C] errors:
|
|
47
|
|
48 "Failure loading module pattern",
|
|
49 "Failure loading module track",
|
|
50 "Failure loading module header",
|
|
51 "Failure loading sampleinfo",
|
|
52 "Unknown module format",
|
|
53
|
|
54 // Specific Driver [MDRIVER.C / drivers] errors:
|
|
55
|
|
56 "None of the supported sound-devices were detected",
|
|
57 "Device number out of range",
|
|
58 "Software mixer failure - Out of memory",
|
|
59
|
|
60 #ifdef SUN
|
|
61 #elif defined(SOLARIS)
|
|
62 #elif defined(__alpha)
|
|
63 "Cannot find suitable audio port!"
|
|
64 #elif defined(OSS)
|
|
65 #ifdef ULTRA
|
|
66 #endif
|
|
67 #elif defined(__hpux)
|
|
68 "Unable to open /dev/audio",
|
|
69 "Unable to set non-blocking mode for /dev/audio",
|
|
70 "Unable to select 16bit-linear sample format",
|
|
71 "Could not select requested sample-rate",
|
|
72 "Could not select requested number of channels",
|
|
73 "Unable to select audio output",
|
|
74 "Unable to get audio description",
|
|
75 "Unable to get gain values",
|
|
76 "Unable to set gain values",
|
|
77 "Could not set transmission buffer size"
|
|
78 #elif defined(AIX)
|
|
79 "Could not open AIX audio device",
|
|
80 "Configuration (init) of AIX audio device failed",
|
|
81 "Configuration (control) of AIX audio device failed",
|
|
82 "Configuration (start) of AIX audio device failed",
|
|
83 "Unable to set non-blocking mode for /dev/audio",
|
|
84 #elif defined(SGI)
|
|
85 #elif defined(__OS2__)
|
|
86 #elif defined(__WIN32__)
|
|
87 #else
|
|
88 "The requested soundcard was not found",
|
|
89 "Could not open a High-DMA channel"
|
|
90 #endif
|
|
91 };
|
|
92
|
|
93
|
|
94 void (*_mm_errorhandler)(void) = NULL;
|
|
95 int _mm_errno = 0;
|
|
96 BOOL _mm_critical = 0;
|
|
97
|
|
98
|
|
99 void _mm_RegisterErrorHandler(void (*proc)(void))
|
|
100 {
|
|
101 _mm_errorhandler = proc;
|
|
102 }
|
|
103
|