AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum eParam, ALint* plValue1, ALint* plValue2, ALint* plValue3) { ALCcontext *pContext; ALCdevice *device; pContext = GetContextSuspended(); if(!pContext) return; device = pContext->Device; if(!plValue1 || !plValue2 || !plValue3) alSetError(pContext, AL_INVALID_VALUE); else if(LookupBuffer(device->BufferMap, buffer) == NULL) alSetError(pContext, AL_INVALID_NAME); else { switch(eParam) { default: alSetError(pContext, AL_INVALID_ENUM); break; } } ProcessContext(pContext); }
ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum param, ALint *piValues) { ALCcontext *Context; Context = GetContextSuspended(); if(!Context) return; if (alIsAuxiliaryEffectSlot(effectslot)) { switch(param) { case AL_EFFECTSLOT_EFFECT: case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: alAuxiliaryEffectSloti(effectslot, param, piValues[0]); break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue) { ALCcontext *Context; Context = GetContextSuspended(); if(!Context) return; if (alIsAuxiliaryEffectSlot(effectslot)) { ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot); switch(param) { case AL_EFFECTSLOT_GAIN: *pflValue = ALEffectSlot->Gain; break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data) { ALCcontext *pContext; ALdatabuffer *pBuffer; ALCdevice *Device; pContext = GetContextSuspended(); if(!pContext) return; Device = pContext->Device; if((pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL) { if(start >= 0 && length >= 0 && start+length <= pBuffer->size) { if(pBuffer->state == UNMAPPED) memcpy(data, pBuffer->data+start, length); else alSetError(pContext, AL_INVALID_OPERATION); } else alSetError(pContext, AL_INVALID_VALUE); } else alSetError(pContext, AL_INVALID_NAME); ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues) { ALCcontext *pContext; ALCdevice *Device; pContext = GetContextSuspended(); if(!pContext) return; if(plValues) { Device = pContext->Device; if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL) { switch (eParam) { case AL_SIZE: alGetDatabufferiEXT(buffer, eParam, plValues); break; default: alSetError(pContext, AL_INVALID_ENUM); break; } } else alSetError(pContext, AL_INVALID_NAME); } else alSetError(pContext, AL_INVALID_VALUE); ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value >= 0.0f) { Context->DopplerFactor = float2ALfp(value); updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); // Force updating the sources for these parameters, since even head- // relative sources are affected if(updateSources) { ALsizei pos; for(pos = 0;pos < Context->SourceMap.size;pos++) { ALsource *source = Context->SourceMap.array[pos].value; source->NeedsUpdate = AL_TRUE; } } ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound) { ALCcontext *pContext; ALboolean updateSources = AL_FALSE; pContext = GetContextSuspended(); if(!pContext) return; if(flSpeedOfSound > 0.0f) { pContext->flSpeedOfSound = float2ALfp(flSpeedOfSound); updateSources = AL_TRUE; } else alSetError(pContext, AL_INVALID_VALUE); if(updateSources) { ALsizei pos; for(pos = 0;pos < pContext->SourceMap.size;pos++) { ALsource *source = pContext->SourceMap.array[pos].value; source->NeedsUpdate = AL_TRUE; } } ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value >= 0.0f) { Context->DopplerFactor = value; updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); // Force updating the sources for these parameters, since even head- // relative sources are affected if(updateSources) { ALsource *source = Context->SourceList; while(source) { source->NeedsUpdate = AL_TRUE; source = source->next; } } ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value > 0.0f) { Context->DopplerVelocity=value; updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); if(updateSources) { ALsource *source = Context->SourceList; while(source) { source->NeedsUpdate = AL_TRUE; source = source->next; } } ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue) { ALCcontext *Context; ALCdevice *Device; ALfilter *ALFilter; Context = GetContextSuspended(); if(!Context) return; Device = Context->Device; if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL) { switch(param) { case AL_FILTER_TYPE: if(iValue == AL_FILTER_NULL || iValue == AL_FILTER_LOWPASS) InitFilterParams(ALFilter, iValue); else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues) { ALCcontext *Context; ALCdevice *Device; Context = GetContextSuspended(); if(!Context) return; Device = Context->Device; if(LookupFilter(Device->FilterMap, filter) != NULL) { switch(param) { case AL_FILTER_TYPE: alGetFilteri(filter, param, piValues); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
AL_API void AL_APIENTRY alGetListener3i(ALenum eParam, ALint *plValue1, ALint *plValue2, ALint *plValue3) { ALCcontext *pContext; pContext = GetContextSuspended(); if(!pContext) return; if(plValue1 && plValue2 && plValue3) { switch (eParam) { case AL_POSITION: *plValue1 = (ALint)pContext->Listener.Position[0]; *plValue2 = (ALint)pContext->Listener.Position[1]; *plValue3 = (ALint)pContext->Listener.Position[2]; break; case AL_VELOCITY: *plValue1 = (ALint)pContext->Listener.Velocity[0]; *plValue2 = (ALint)pContext->Listener.Velocity[1]; *plValue3 = (ALint)pContext->Listener.Velocity[2]; break; default: alSetError(pContext, AL_INVALID_ENUM); break; } } else alSetError(pContext, AL_INVALID_VALUE); ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum eParam, ALfloat *pflValue) { ALCcontext *pContext; pContext = GetContextSuspended(); if(!pContext) return; if(pflValue) { switch(eParam) { case AL_GAIN: *pflValue = pContext->Listener.Gain; break; case AL_METERS_PER_UNIT: *pflValue = pContext->Listener.MetersPerUnit; break; default: alSetError(pContext, AL_INVALID_ENUM); break; } } else alSetError(pContext, AL_INVALID_VALUE); ProcessContext(pContext); }
/* alcMakeContextCurrent Makes the given Context the active Context */ ALCAPI ALCboolean ALCAPIENTRY alcMakeContextCurrent(ALCcontext *context) { ALCcontext *ALContext; ALboolean bReturn = AL_TRUE; SuspendContext(NULL); // context must be a valid Context or NULL if(context == NULL || IsContext(context)) { if((ALContext=GetContextSuspended()) != NULL) { ALContext->InUse=AL_FALSE; ProcessContext(ALContext); } if((ALContext=context) != NULL && ALContext->Device) { SuspendContext(ALContext); ALContext->InUse=AL_TRUE; ProcessContext(ALContext); } tls_set(LocalContext, NULL); } else { alcSetError(ALC_INVALID_CONTEXT); bReturn = AL_FALSE; } ProcessContext(NULL); return bReturn; }
AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) { ALCcontext *Context; ALfloat value = 0.0f; Context = GetContextSuspended(); if(!Context) return 0.0f; switch(pname) { case AL_DOPPLER_FACTOR: value = ALfp2float(Context->DopplerFactor); break; case AL_DOPPLER_VELOCITY: value = ALfp2float(Context->DopplerVelocity); break; case AL_DISTANCE_MODEL: value = (float)Context->DistanceModel; break; case AL_SPEED_OF_SOUND: value = ALfp2float(Context->flSpeedOfSound); break; default: alSetError(Context, AL_INVALID_ENUM); break; } ProcessContext(Context); return value; }
AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat flSpeedOfSound) { ALCcontext *pContext; ALboolean updateSources = AL_FALSE; pContext = GetContextSuspended(); if(!pContext) return; if(flSpeedOfSound > 0.0f) { pContext->flSpeedOfSound = flSpeedOfSound; updateSources = AL_TRUE; } else alSetError(pContext, AL_INVALID_VALUE); if(updateSources) { ALsource *source = pContext->SourceList; while(source) { source->NeedsUpdate = AL_TRUE; source = source->next; } } ProcessContext(pContext); }
AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname) { const ALchar *value; ALCcontext *pContext; pContext = GetContextSuspended(); if(!pContext) return NULL; switch(pname) { case AL_VENDOR: value=alVendor; break; case AL_VERSION: value=alVersion; break; case AL_RENDERER: value=alRenderer; break; case AL_EXTENSIONS: value=pContext->ExtensionList;//alExtensions; break; case AL_NO_ERROR: value=alNoError; break; case AL_INVALID_NAME: value=alErrInvalidName; break; case AL_INVALID_ENUM: value=alErrInvalidEnum; break; case AL_INVALID_VALUE: value=alErrInvalidValue; break; case AL_INVALID_OPERATION: value=alErrInvalidOp; break; case AL_OUT_OF_MEMORY: value=alErrOutOfMemory; break; default: value=NULL; alSetError(pContext, AL_INVALID_ENUM); break; } ProcessContext(pContext); return value; }
AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: Context->SourceDistanceModel = AL_FALSE; updateSources = AL_TRUE; break; default: alSetError(Context, AL_INVALID_ENUM); break; } if(updateSources) { ALsource *source = Context->SourceList; while(source) { source->NeedsUpdate = AL_TRUE; source = source->next; } } ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; if(value > 0.0f) { Context->DopplerVelocity=float2ALfp(value); updateSources = AL_TRUE; } else alSetError(Context, AL_INVALID_VALUE); if(updateSources) { ALsizei pos; for(pos = 0;pos < Context->SourceMap.size;pos++) { ALsource *source = Context->SourceMap.array[pos].value; source->NeedsUpdate = AL_TRUE; } } ProcessContext(Context); }
ALAPI ALdouble ALAPIENTRY alGetDouble(ALenum pname) { ALCcontext *Context; ALdouble value = 0.0; Context = GetContextSuspended(); if(!Context) return 0.0; switch(pname) { case AL_DOPPLER_FACTOR: value = (double)Context->DopplerFactor; break; case AL_DOPPLER_VELOCITY: value = (double)Context->DopplerVelocity; break; case AL_DISTANCE_MODEL: value = (double)Context->DistanceModel; break; case AL_SPEED_OF_SOUND: value = (double)Context->flSpeedOfSound; break; default: alSetError(AL_INVALID_ENUM); break; } ProcessContext(Context); return value; }
AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) { ALCcontext *Context; ALboolean updateSources = AL_FALSE; Context = GetContextSuspended(); if(!Context) return; switch(capability) { case AL_SOURCE_DISTANCE_MODEL: Context->SourceDistanceModel = AL_FALSE; updateSources = AL_TRUE; break; default: alSetError(Context, AL_INVALID_ENUM); break; } if(updateSources) { ALsizei pos; for(pos = 0;pos < Context->SourceMap.size;pos++) { ALsource *source = Context->SourceMap.array[pos].value; source->NeedsUpdate = AL_TRUE; } } ProcessContext(Context); }
ALAPI ALvoid ALAPIENTRY alDistanceModel(ALenum value) { ALCcontext *Context; ALsource *Source; Context = GetContextSuspended(); if(!Context) return; switch(value) { case AL_NONE: case AL_INVERSE_DISTANCE: case AL_INVERSE_DISTANCE_CLAMPED: case AL_LINEAR_DISTANCE: case AL_LINEAR_DISTANCE_CLAMPED: case AL_EXPONENT_DISTANCE: case AL_EXPONENT_DISTANCE_CLAMPED: Context->DistanceModel = value; for(Source = Context->Source;Source != NULL;Source = Source->next) Source->DistanceModel = value; break; default: alSetError(AL_INVALID_VALUE); break; } ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue) { ALCcontext *pContext; ALCdevice *Device; (void)lValue; pContext = GetContextSuspended(); if(!pContext) return; Device = pContext->Device; if(LookupDatabuffer(Device->DatabufferMap, buffer) != NULL) { switch(eParam) { default: alSetError(pContext, AL_INVALID_ENUM); break; } } else alSetError(pContext, AL_INVALID_NAME); ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat flArg) { ALCcontext *Context; ALeffectslot *EffectSlot; ALfp flValue = float2ALfp(flArg); Context = GetContextSuspended(); if(!Context) return; if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL) { switch(param) { case AL_EFFECTSLOT_GAIN: if(flValue >= int2ALfp(0) && flValue <= int2ALfp(1)) EffectSlot->Gain = flValue; else alSetError(Context, AL_INVALID_VALUE); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer) { ALCcontext *pContext; ALdatabuffer *pBuffer = NULL; ALCdevice *Device; pContext = GetContextSuspended(); if(!pContext) return; Device = pContext->Device; if(uiBuffer == 0 || (pBuffer=LookupDatabuffer(Device->DatabufferMap, uiBuffer)) != NULL) { if(target == AL_SAMPLE_SOURCE_EXT) pContext->SampleSource = pBuffer; else if(target == AL_SAMPLE_SINK_EXT) pContext->SampleSink = pBuffer; else alSetError(pContext, AL_INVALID_VALUE); } else alSetError(pContext, AL_INVALID_NAME); ProcessContext(pContext); }
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue) { ALCcontext *Context; ALeffectslot *EffectSlot; Context = GetContextSuspended(); if(!Context) return; if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL) { switch(param) { case AL_EFFECTSLOT_EFFECT: *piValue = EffectSlot->effect.effect; break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: *piValue = EffectSlot->AuxSendAuto; break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum param, ALint *piValue) { ALCcontext *Context; Context = GetContextSuspended(); if(!Context) return; if (alIsAuxiliaryEffectSlot(effectslot)) { ALeffectslot *ALEffectSlot = (ALeffectslot*)ALTHUNK_LOOKUPENTRY(effectslot); switch(param) { case AL_EFFECTSLOT_EFFECT: *piValue = ALEffectSlot->effect.effect; break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: *piValue = ALEffectSlot->AuxSendAuto; break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, ALfloat *pflValue) { ALCcontext *Context; ALeffectslot *EffectSlot; Context = GetContextSuspended(); if(!Context) return; if((EffectSlot=LookupEffectSlot(Context->EffectSlotMap, effectslot)) != NULL) { switch(param) { case AL_EFFECTSLOT_GAIN: *pflValue = ALfp2float(EffectSlot->Gain); break; default: alSetError(Context, AL_INVALID_ENUM); break; } } else alSetError(Context, AL_INVALID_NAME); ProcessContext(Context); }
ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum param, ALfloat *pflValues) { ALCcontext *Context; Context = GetContextSuspended(); if(!Context) return; if (alIsAuxiliaryEffectSlot(effectslot)) { switch(param) { case AL_EFFECTSLOT_GAIN: alGetAuxiliaryEffectSlotf(effectslot, param, pflValues); break; default: alSetError(AL_INVALID_ENUM); break; } } else alSetError(AL_INVALID_NAME); ProcessContext(Context); }
ALAPI ALvoid ALAPIENTRY alListener3f(ALenum eParam, ALfloat flValue1, ALfloat flValue2, ALfloat flValue3) { ALCcontext *pContext; pContext = GetContextSuspended(); if(!pContext) return; switch(eParam) { case AL_POSITION: pContext->Listener.Position[0] = flValue1; pContext->Listener.Position[1] = flValue2; pContext->Listener.Position[2] = flValue3; break; case AL_VELOCITY: pContext->Listener.Velocity[0] = flValue1; pContext->Listener.Velocity[1] = flValue2; pContext->Listener.Velocity[2] = flValue3; break; default: alSetError(AL_INVALID_ENUM); break; } ProcessContext(pContext); }