annotate mmio/mmerror.c @ 10:55420dceb8e0

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