Mercurial > audio-send
comparison Alc/utils.c @ 0:f9476ff7637e
initial forking of open-al to create multiple listeners
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:02:31 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f9476ff7637e |
---|---|
1 void pauseAllSources(ALCcontext *ctx){ | |
2 ALCcontext *current = alcGetCurrentContext(); | |
3 alcMakeContextCurrent(ctx); | |
4 ALsource **src, **src_end; | |
5 src = ctx->ActiveSources; | |
6 src_end = src + ctx->ActiveSourceCount; | |
7 while(src != src_end){ | |
8 if (AL_PLAYING == (*src)->state){ | |
9 //if (AL_TRUE){ | |
10 ALuint source_id = (*src)->source; | |
11 //printf("pausing ONE source\n"); | |
12 alSourcePause(source_id); | |
13 } | |
14 src++; | |
15 } | |
16 alcMakeContextCurrent(current); | |
17 } | |
18 | |
19 | |
20 #define RUNONLY(n) \ | |
21 {static int __runonce = n; \ | |
22 if (__runonce-- <= 0){__runonce = 0;return;}} | |
23 | |
24 #define RUNAT(n) \ | |
25 {static int __runat = n; \ | |
26 if (0 != __runat--){return;}} | |
27 | |
28 | |
29 #define DsyncSourcei(sourceID1, sourceID2, ctx1, ctx2, param) \ | |
30 {/*printf("synci : " #param "\n");*/ \ | |
31 syncSourcei(sourceID1, sourceID2, ctx1, ctx2, param);} | |
32 | |
33 #define DsyncSourcef(sourceID1, sourceID2, ctx1, ctx2, param) \ | |
34 {/*printf("syncf : " #param "\n");*/ \ | |
35 syncSourcef(sourceID1, sourceID2, ctx1, ctx2, param);} | |
36 | |
37 #define DsyncSource3i(sourceID1, sourceID2, ctx1, ctx2, param) \ | |
38 {/*printf("sync3i : " #param "\n");*/ \ | |
39 syncSource3i(sourceID1, sourceID2, ctx1, ctx2, param);} | |
40 | |
41 #define DsyncSource3f(sourceID1, sourceID2, ctx1, ctx2, param) \ | |
42 {/*printf("sync3f : " #param "\n");*/ \ | |
43 syncSource3f(sourceID1, sourceID2, ctx1, ctx2, param);} | |
44 | |
45 void printError(void){ | |
46 ALenum error = alGetError(); | |
47 printf("%s\n", GetALCErrorString(error)); | |
48 printf("%s\n", GetALErrorString(error)); | |
49 } | |
50 | |
51 | |
52 | |
53 char* GetALCErrorString(ALenum err) | |
54 { | |
55 switch(err) | |
56 { | |
57 case ALC_NO_ERROR: | |
58 return "AL_NO_ERROR"; | |
59 break; | |
60 | |
61 case ALC_INVALID_DEVICE: | |
62 return "ALC_INVALID_DEVICE"; | |
63 break; | |
64 | |
65 case ALC_INVALID_CONTEXT: | |
66 return "ALC_INVALID_CONTEXT"; | |
67 break; | |
68 | |
69 case ALC_INVALID_ENUM: | |
70 return "ALC_INVALID_ENUM"; | |
71 break; | |
72 | |
73 case ALC_INVALID_VALUE: | |
74 return "ALC_INVALID_VALUE"; | |
75 break; | |
76 | |
77 case ALC_OUT_OF_MEMORY: | |
78 return "ALC_OUT_OF_MEMORY"; | |
79 break; | |
80 }; | |
81 return "UNknown error."; | |
82 } | |
83 | |
84 | |
85 | |
86 | |
87 | |
88 | |
89 | |
90 char* GetALErrorString(ALenum err) | |
91 { | |
92 switch(err) | |
93 { | |
94 case AL_NO_ERROR: | |
95 return "AL_NO_ERROR"; | |
96 break; | |
97 | |
98 case AL_INVALID_NAME: | |
99 return "AL_INVALID_NAME"; | |
100 break; | |
101 | |
102 case AL_INVALID_ENUM: | |
103 return "AL_INVALID_ENUM"; | |
104 break; | |
105 | |
106 case AL_INVALID_VALUE: | |
107 return "AL_INVALID_VALUE"; | |
108 break; | |
109 | |
110 case AL_INVALID_OPERATION: | |
111 return "AL_INVALID_OPERATION"; | |
112 break; | |
113 | |
114 case AL_OUT_OF_MEMORY: | |
115 return "AL_OUT_OF_MEMORY"; | |
116 break; | |
117 }; | |
118 return "UNknown error."; | |
119 } | |
120 | |
121 | |
122 | |
123 |