Mercurial > audio-send
view Alc/utils.c @ 29:cdf320cb5949
updated test suite
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 10 Dec 2011 21:42:50 -0600 |
parents | f9476ff7637e |
children |
line wrap: on
line source
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 }20 #define RUNONLY(n) \21 {static int __runonce = n; \22 if (__runonce-- <= 0){__runonce = 0;return;}}24 #define RUNAT(n) \25 {static int __runat = n; \26 if (0 != __runat--){return;}}29 #define DsyncSourcei(sourceID1, sourceID2, ctx1, ctx2, param) \30 {/*printf("synci : " #param "\n");*/ \31 syncSourcei(sourceID1, sourceID2, ctx1, ctx2, param);}33 #define DsyncSourcef(sourceID1, sourceID2, ctx1, ctx2, param) \34 {/*printf("syncf : " #param "\n");*/ \35 syncSourcef(sourceID1, sourceID2, ctx1, ctx2, param);}37 #define DsyncSource3i(sourceID1, sourceID2, ctx1, ctx2, param) \38 {/*printf("sync3i : " #param "\n");*/ \39 syncSource3i(sourceID1, sourceID2, ctx1, ctx2, param);}41 #define DsyncSource3f(sourceID1, sourceID2, ctx1, ctx2, param) \42 {/*printf("sync3f : " #param "\n");*/ \43 syncSource3f(sourceID1, sourceID2, ctx1, ctx2, param);}45 void printError(void){46 ALenum error = alGetError();47 printf("%s\n", GetALCErrorString(error));48 printf("%s\n", GetALErrorString(error));49 }53 char* GetALCErrorString(ALenum err)54 {55 switch(err)56 {57 case ALC_NO_ERROR:58 return "AL_NO_ERROR";59 break;61 case ALC_INVALID_DEVICE:62 return "ALC_INVALID_DEVICE";63 break;65 case ALC_INVALID_CONTEXT:66 return "ALC_INVALID_CONTEXT";67 break;69 case ALC_INVALID_ENUM:70 return "ALC_INVALID_ENUM";71 break;73 case ALC_INVALID_VALUE:74 return "ALC_INVALID_VALUE";75 break;77 case ALC_OUT_OF_MEMORY:78 return "ALC_OUT_OF_MEMORY";79 break;80 };81 return "UNknown error.";82 }90 char* GetALErrorString(ALenum err)91 {92 switch(err)93 {94 case AL_NO_ERROR:95 return "AL_NO_ERROR";96 break;98 case AL_INVALID_NAME:99 return "AL_INVALID_NAME";100 break;102 case AL_INVALID_ENUM:103 return "AL_INVALID_ENUM";104 break;106 case AL_INVALID_VALUE:107 return "AL_INVALID_VALUE";108 break;110 case AL_INVALID_OPERATION:111 return "AL_INVALID_OPERATION";112 break;114 case AL_OUT_OF_MEMORY:115 return "AL_OUT_OF_MEMORY";116 break;117 };118 return "UNknown error.";119 }