openalbridge/wrappers.c
changeset 2213 bd51bbf06033
parent 2212 6b5da1a2765a
child 2216 82e7da49c26a
equal deleted inserted replaced
2212:6b5da1a2765a 2213:bd51bbf06033
    22 extern "C" {
    22 extern "C" {
    23 #endif 
    23 #endif 
    24 	
    24 	
    25 	extern ALint *Sources;
    25 	extern ALint *Sources;
    26 	
    26 	
    27 	void *Malloc (size_t nbytes){
    27 	void *Malloc (size_t nbytes) {
    28 		void *aptr;
    28 		void *aptr;
    29 		if ((aptr = malloc(nbytes)) == NULL) {
    29 		if ((aptr = malloc(nbytes)) == NULL) {
    30 			fprintf(stderr, "ERROR: not enough memory! malloc() failed\n");
    30 			fprintf(stderr, "ERROR: not enough memory! malloc() failed\n");
       
    31 			exit(-1);
       
    32 		}
       
    33 		return aptr;
       
    34 	}
       
    35 	
       
    36 	
       
    37 	void *Realloc (void *aptr, size_t nbytes) {
       
    38 #ifndef _WIN32
       
    39 		aptr = reallocf(aptr, nbytes);
       
    40 #else
       
    41 		aptr = realloc(aptr, nbytes);
       
    42 #endif
       
    43 		if (aptr == NULL) {
       
    44 			fprintf(stderr, "ERROR: not enough memory! realloc() failed\n");
       
    45 #ifdef _WIN32
       
    46 			free(aptr);
       
    47 #endif
    31 			exit(-1);
    48 			exit(-1);
    32 		}
    49 		}
    33 		return aptr;
    50 		return aptr;
    34 	}
    51 	}
    35 	
    52 	
    55 	
    72 	
    56 	
    73 	
    57 #ifndef _WIN32
    74 #ifndef _WIN32
    58 	void *helper_fadein(void *tmp) 
    75 	void *helper_fadein(void *tmp) 
    59 #else
    76 #else
    60 	void WINAPI helper_fadein(void *tmp) 
    77 	void *helper_fadein(void *tmp) 
    61 #endif
    78 #endif
    62 	{
    79 	{
    63 		ALfloat gain;
    80 		ALfloat gain;
    64 		ALfloat target_gain;
    81 		ALfloat target_gain;
    65 		fade_t *fade;
    82 		fade_t *fade;
   101 	
   118 	
   102 	
   119 	
   103 #ifndef _WIN32
   120 #ifndef _WIN32
   104 	void *helper_fadeout(void *tmp) 
   121 	void *helper_fadeout(void *tmp) 
   105 #else
   122 #else
   106 	void WINAPI helper_fadeout(void *tmp) 	
   123 	void *helper_fadeout(void *tmp) 	
   107 #endif
   124 #endif
   108 	{
   125 	{
   109 		ALfloat gain;
   126 		ALfloat gain;
   110 		ALfloat old_gain;
   127 		ALfloat old_gain;
   111 		fade_t *fade;
   128 		fade_t *fade;
   142 #else
   159 #else
   143 		_endthread();
   160 		_endthread();
   144 #endif
   161 #endif
   145 	}
   162 	}
   146 	
   163 	
       
   164 	
   147 #ifdef __CPLUSPLUS
   165 #ifdef __CPLUSPLUS
   148 }
   166 }
   149 #endif
   167 #endif