예제 #1
0
void EAX_CommitDeferred()
{
    if(!eaxListener) return;
    if(FAILED(IKsPropertySet_Set(eaxListener, &DSPROPSETID_EAX_ListenerProperties,
        DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS, NULL, 0,
        NULL, 0)))
    {
        I_error("EAX_CommitDeferred failed.\n");
    }
}
예제 #2
0
void EAX_fSet(DWORD prop, float value)
{
    if(FAILED(hr = IKsPropertySet_Set(eaxListener,
        &DSPROPSETID_EAX_ListenerProperties,
        prop | DSPROPERTY_EAXLISTENER_DEFERRED, NULL, 0, &value, sizeof(float))))
    {
        I_error("EAX_fSet (prop:%i value:%f) failed. Result: %i.\n",
            prop, value, hr&0xffff);
    }
}
예제 #3
0
/*
    Test for support of appropriate EAX Version
*/
ALboolean CheckEAXSupport(const ALchar *szEAXName)
{
    ALCcontext        *ALContext;
    ALCdevice        *ALCDevice;
    ALsource        *ALSource;
    LPKSPROPERTYSET    lpPropertySet = NULL;
    GUID            ListenerGuid, BufferGuid;
    ALuint            ListenerProperty, BufferProperty;
    ALuint            i, ulSupport;
    ALuint            property, size;
    ALint            value = 0xFFFFFFFF;
    ALfloat            fvalue;
    ALboolean        bSourceGenerated = AL_FALSE;
    ALboolean        bEAXSupported = AL_FALSE;
    ALint            iSWReverbMixer = 0;

    ALContext = alcGetCurrentContext();
    ALCDevice = alcGetContextsDevice(ALContext);
    SuspendContext(ALContext);


    if (iSWReverbMixer)
    {
    }
    else
    {
        // To test for EAX support we will need a valid Source
        ALSource = ALContext->Source;

        // See if one has already been created
        for (i=0;i<ALContext->SourceCount;i++)
        {
            if (ALSource->uservalue3)
            {
                lpPropertySet = ALSource->uservalue3;
                break;
            }
            ALSource = ALSource->next;
        }

        // If we didn't find a valid source, create one now
        if (lpPropertySet == NULL)
        {
            ALuint alsource = 0;
            alGenSources(1, ((ALuint *)(&alsource)));
            if (alGetError() == AL_NO_ERROR)
            {
                ALSource = (ALsource*)ALTHUNK_LOOKUPENTRY(alsource);
                lpPropertySet = ALSource->uservalue3;
                bSourceGenerated = AL_TRUE;
            }
        }

        // If Property Set Interface hasn't been obtained, EAX support is not available
        if (lpPropertySet)
        {
            if ( (_stricmp(szEAXName, "EAX") == 0) || (_stricmp(szEAXName, "EAX2.0") == 0) )
            {
                ListenerGuid = DSPROPSETID_EAX20_ListenerProperties;
                BufferGuid = DSPROPSETID_EAX20_BufferProperties;
                ListenerProperty = 1;    // LISTENER_ALL
                BufferProperty = 1;        // BUFFER_ALL
                property = 2;            // ROOM
                size = sizeof(ALint);
                value = -10000;
            }
            else
            {
                // Unknown EAX Name
                if (bSourceGenerated)
                    alDeleteSources(1, ((ALuint *)&ALSource->source));

                ProcessContext(ALContext);
                return AL_FALSE;
            }

            if (SUCCEEDED(IKsPropertySet_QuerySupport(lpPropertySet, &ListenerGuid, ListenerProperty, &ulSupport)))
            {
                if ( (ulSupport & KSPROPERTY_SUPPORT_GET) && (ulSupport & KSPROPERTY_SUPPORT_SET))
                {
                    if (SUCCEEDED(IKsPropertySet_QuerySupport(lpPropertySet, &BufferGuid, BufferProperty, &ulSupport)))
                    {
                        if ( (ulSupport & KSPROPERTY_SUPPORT_GET) && (ulSupport & KSPROPERTY_SUPPORT_SET) )
                        {
                            // Fully supported !
                            bEAXSupported = AL_TRUE;

                            // Set Default Property
                            if (value != 0xFFFFFFFF)
                                IKsPropertySet_Set(lpPropertySet, &ListenerGuid, property, NULL, 0, &value, sizeof(ALint));
                            else
                                IKsPropertySet_Set(lpPropertySet, &ListenerGuid, property, NULL, 0, &fvalue, sizeof(ALfloat));
                        }
                    }
                }
            }
        }

        if (bSourceGenerated)
            alDeleteSources(1, ((ALuint *)&ALSource->source));
    }

    ProcessContext(ALContext);
    return bEAXSupported;
}
예제 #4
0
/*
	EAXSet(propertySetID, property, source, value, size)

	propertySetID : GUID of EAX Property Set (defined in eax.h files)
	property	  : Property in Property Set to affect (enumerations defined in eax.h files)
	source		  : Source to apply EAX affects to (this can be NULL for Listener Property Sets)
	value		  : Pointer to value to set
	size		  : Size of data pointed to by value

	Returns AL_INVALID_NAME if a valid Source name was required but not given
	Returns AL_INVALID_OPERATION if the Source is 2D or the EAX call fails
	Returns AL_INVALID_VALUE if the GUID is not recognized
*/
ALAPI ALenum ALAPIENTRY EAXSet(const GUID *propertySetID,ALuint property,ALuint source,ALvoid *pValue,ALuint size)
{
	ALsource	*ALSource;
	ALCcontext	*ALCContext;
	ALuint		i, ulBytesReturned;
	ALenum		ALErrorCode = AL_NO_ERROR;
	EAXGUID		eaxGuid;
	ALboolean	bGenSource = AL_FALSE;
	ALboolean	bSetValue = AL_FALSE;
	ALboolean	bGetValue = AL_FALSE;
	
	ALCContext=alcGetCurrentContext();
	SuspendContext(ALCContext);

	// Determine which EAX Property is being set
	if ( IsEqualGUID(propertySetID, &DSPROPSETID_EAX20_BufferProperties) )
		eaxGuid = EAX2B;
	else if ( IsEqualGUID(propertySetID, &DSPROPSETID_EAX20_ListenerProperties) )
		eaxGuid = EAX2L;
	else
		ALErrorCode = AL_INVALID_VALUE;

	// Process EAX Buffer related calls
	if (eaxGuid & EAXBUFFERGUID)
	{
		if (alIsSource(source))
		{
			ALSource = (ALsource*)source;
			if (ALSource->uservalue3)
			{
				// EAX 2.0 Buffer call
				if (eaxGuid == EAX2B)
				{
					switch(property & ~DSPROPERTY_EAXBUFFER_DEFERRED)
					{
					case DSPROPERTY_EAXBUFFER_NONE:
						bSetValue = AL_TRUE;
						break;

					case DSPROPERTY_EAXBUFFER_ALLPARAMETERS:
						if ((pValue) && (size >= sizeof(EAXBUFFERPROPERTIES)))
						{
							if (memcmp((void*)(&ALSource->EAX20BP), pValue, sizeof(EAXBUFFERPROPERTIES)))
							{
								if ( (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lDirect, EAXBUFFER_MINDIRECT, EAXBUFFER_MAXDIRECT)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lDirectHF, EAXBUFFER_MINDIRECTHF, EAXBUFFER_MAXDIRECTHF)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lRoom, EAXBUFFER_MINROOM, EAXBUFFER_MAXROOM)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lRoomHF, EAXBUFFER_MINROOMHF, EAXBUFFER_MAXROOMHF)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lObstruction, EAXBUFFER_MINOBSTRUCTION, EAXBUFFER_MAXOBSTRUCTION)) &&
									 (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flObstructionLFRatio, EAXBUFFER_MINOBSTRUCTIONLFRATIO, EAXBUFFER_MAXOBSTRUCTIONLFRATIO)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lOcclusion, EAXBUFFER_MINOCCLUSION, EAXBUFFER_MAXOCCLUSION)) &&
									 (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flOcclusionLFRatio, EAXBUFFER_MINOCCLUSIONLFRATIO, EAXBUFFER_MAXOCCLUSIONLFRATIO)) &&
									 (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flOcclusionRoomRatio, EAXBUFFER_MINOCCLUSIONROOMRATIO, EAXBUFFER_MAXOCCLUSIONROOMRATIO)) &&
									 (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lOutsideVolumeHF, EAXBUFFER_MINOUTSIDEVOLUMEHF, EAXBUFFER_MAXOUTSIDEVOLUMEHF)) &&
									 (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flRoomRolloffFactor, EAXBUFFER_MINROOMROLLOFFFACTOR, EAXBUFFER_MAXROOMROLLOFFFACTOR)) &&
									 (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flAirAbsorptionFactor, EAXBUFFER_MINAIRABSORPTIONFACTOR, EAXBUFFER_MAXAIRABSORPTIONFACTOR)) &&
									 (ULongInRange(((LPEAXBUFFERPROPERTIES)pValue)->dwFlags, 0, ~EAXBUFFERFLAGS_RESERVED)) )
								{
									memcpy((void*)(&ALSource->EAX20BP), pValue, sizeof(EAXBUFFERPROPERTIES));
									bSetValue = AL_TRUE;
								}
								else
								{
									ALErrorCode = AL_INVALID_OPERATION;
								}
							}
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_DIRECT:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long*)pValue), EAXBUFFER_MINDIRECT, EAXBUFFER_MAXDIRECT)))
						{
							bSetValue = (ALSource->EAX20BP.lDirect != (*(long*)pValue));
							ALSource->EAX20BP.lDirect = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_DIRECTHF:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINDIRECTHF, EAXBUFFER_MAXDIRECTHF)))
						{
							bSetValue = (ALSource->EAX20BP.lDirectHF != (*(long*)pValue));
							ALSource->EAX20BP.lDirectHF = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_ROOM:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINROOM, EAXBUFFER_MAXROOM)))
						{
							bSetValue = (ALSource->EAX20BP.lRoom != (*(long*)pValue));
							ALSource->EAX20BP.lRoom = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_ROOMHF:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINROOMHF, EAXBUFFER_MAXROOMHF)))
						{
							bSetValue = (ALSource->EAX20BP.lRoomHF != (*(long*)pValue));
							ALSource->EAX20BP.lRoomHF = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OBSTRUCTION:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOBSTRUCTION, EAXBUFFER_MAXOBSTRUCTION)))
						{
							bSetValue = (ALSource->EAX20BP.lObstruction != (*(long*)pValue));
							ALSource->EAX20BP.lObstruction = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO:
						if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOBSTRUCTIONLFRATIO, EAXBUFFER_MAXOBSTRUCTIONLFRATIO)))
						{
							bSetValue = (ALSource->EAX20BP.flObstructionLFRatio != (*(float*)pValue));
							ALSource->EAX20BP.flObstructionLFRatio = (*(float*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OCCLUSION:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOCCLUSION, EAXBUFFER_MAXOCCLUSION)))
						{
							bSetValue = (ALSource->EAX20BP.lOcclusion != (*(long*)pValue));
							ALSource->EAX20BP.lOcclusion = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO:
						if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOCCLUSIONLFRATIO, EAXBUFFER_MAXOCCLUSIONLFRATIO)))
						{
							bSetValue = (ALSource->EAX20BP.flOcclusionLFRatio != (*(float*)pValue));
							ALSource->EAX20BP.flOcclusionLFRatio = (*(float*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO:
						if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOCCLUSIONROOMRATIO, EAXBUFFER_MAXOCCLUSIONROOMRATIO)))
						{
							bSetValue = (ALSource->EAX20BP.flOcclusionRoomRatio != (*(float*)pValue));
							ALSource->EAX20BP.flOcclusionRoomRatio = (*(float*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF:
						if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOUTSIDEVOLUMEHF, EAXBUFFER_MAXOUTSIDEVOLUMEHF)))
						{
							bSetValue = (ALSource->EAX20BP.lOutsideVolumeHF != (*(long*)pValue));
							ALSource->EAX20BP.lOutsideVolumeHF = (*(long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR:
						if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINROOMROLLOFFFACTOR, EAXBUFFER_MAXROOMROLLOFFFACTOR)))
						{
							bSetValue = (ALSource->EAX20BP.flRoomRolloffFactor != (*(float*)pValue));
							ALSource->EAX20BP.flRoomRolloffFactor = (*(float*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR:
						if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINAIRABSORPTIONFACTOR, EAXBUFFER_MAXAIRABSORPTIONFACTOR)))
						{
							bSetValue = (ALSource->EAX20BP.flAirAbsorptionFactor != (*(float*)pValue));
							ALSource->EAX20BP.flAirAbsorptionFactor = (*(float*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					case DSPROPERTY_EAXBUFFER_FLAGS:
						if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*((unsigned long *)pValue), 0, ~EAXBUFFERFLAGS_RESERVED)))
						{
							bSetValue = (ALSource->EAX20BP.dwFlags != (*(unsigned long*)pValue));
							ALSource->EAX20BP.dwFlags = (*(unsigned long*)pValue);
						}
						else
						{
							ALErrorCode = AL_INVALID_OPERATION;
						}
						break;

					default:
						ALErrorCode = AL_INVALID_OPERATION;
					}

					if (bSetValue)
					{
						if (FAILED(IKsPropertySet_Set((LPKSPROPERTYSET)ALSource->uservalue3, propertySetID, property, NULL, 0, pValue, size)))
							ALErrorCode = AL_INVALID_OPERATION;
					}
				}
			}
			else
				ALErrorCode = AL_INVALID_OPERATION;
		}
		else
			ALErrorCode = AL_INVALID_NAME;
	}
	else if (eaxGuid & EAXLISTENERGUID)
	{
		// If source is valid use that, otherwise find a source
		if (alIsSource(source) && ((ALsource*)(source))->uservalue3)
		{
			ALSource = (ALsource*)source;
		}
		else
		{
			ALSource = ALCContext->Source;

			// See if one has already been created
			for (i=0;i<ALCContext->SourceCount;i++)
			{
				if (alIsSource((ALuint)ALSource))
				{
					if (ALSource->uservalue3)
						break;
				}
				ALSource = ALSource->next;
			}

			// If an appropriate source wasn't created, generate one now
			if (ALSource == NULL)
			{
				alGenSources(1, (ALuint *)&ALSource);
				if (alGetError() == AL_NO_ERROR)
					bGenSource = AL_TRUE;
			}
		}

		if (alIsSource((ALuint)ALSource) && ALSource->uservalue3)
		{
			// EAX 2.0 Listener call
			if (eaxGuid == EAX2L)
			{
				switch(property & ~DSPROPERTY_EAXLISTENER_DEFERRED)
				{
				case DSPROPERTY_EAXLISTENER_NONE:
					bSetValue = AL_TRUE;
					break;

				case DSPROPERTY_EAXLISTENER_ALLPARAMETERS:
					if ((pValue) && (size >= sizeof(EAXLISTENERPROPERTIES)))
					{
						if (memcmp((void*)(&ALCContext->Listener.EAX20LP), pValue, sizeof(EAXLISTENERPROPERTIES)))
						{
							if ( (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lRoom, EAXLISTENER_MINROOM, EAXLISTENER_MAXROOM)) &&
								 (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lRoomHF, EAXLISTENER_MINROOMHF, EAXLISTENER_MAXROOMHF)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flRoomRolloffFactor, EAXLISTENER_MINROOMROLLOFFFACTOR, EAXLISTENER_MAXROOMROLLOFFFACTOR)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flDecayTime, EAXLISTENER_MINDECAYTIME, EAXLISTENER_MAXDECAYTIME)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flDecayHFRatio, EAXLISTENER_MINDECAYHFRATIO, EAXLISTENER_MAXDECAYHFRATIO)) &&
								 (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lReflections, EAXLISTENER_MINREFLECTIONS, EAXLISTENER_MAXREFLECTIONS)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flReflectionsDelay, EAXLISTENER_MINREFLECTIONSDELAY, EAXLISTENER_MAXREFLECTIONSDELAY)) &&
								 (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lReverb, EAXLISTENER_MINREVERB, EAXLISTENER_MAXREVERB)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flReverbDelay, EAXLISTENER_MINREVERBDELAY, EAXLISTENER_MAXREVERBDELAY)) &&
								 (ULongInRange(((LPEAXLISTENERPROPERTIES)pValue)->dwEnvironment, 0, EAX_ENVIRONMENT_COUNT)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flEnvironmentSize, EAXLISTENER_MINENVIRONMENTSIZE, EAXLISTENER_MAXENVIRONMENTSIZE)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flEnvironmentDiffusion, EAXLISTENER_MINENVIRONMENTDIFFUSION, EAXLISTENER_MAXENVIRONMENTDIFFUSION)) &&
								 (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flAirAbsorptionHF, EAXLISTENER_MINAIRABSORPTIONHF, EAXLISTENER_MAXAIRABSORPTIONHF)) &&
								 (ULongInRange(((LPEAXLISTENERPROPERTIES)pValue)->dwFlags, 0, ~EAXLISTENERFLAGS_RESERVED)) )
							{
								memcpy((void*)(&ALCContext->Listener.EAX20LP), pValue, sizeof(EAXLISTENERPROPERTIES));
								bSetValue = AL_TRUE;
							}
							else
							{
								ALErrorCode = AL_INVALID_OPERATION;
							}
						}
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ROOM:
					if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINROOM, EAXLISTENER_MAXROOM)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.lRoom != (*(long*)pValue));
						ALCContext->Listener.EAX20LP.lRoom = (*(long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ROOMHF:
					if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINROOMHF, EAXLISTENER_MAXROOMHF)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.lRoomHF != (*(long*)pValue));
						ALCContext->Listener.EAX20LP.lRoomHF = (*(long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINROOMROLLOFFFACTOR, EAXLISTENER_MAXROOMROLLOFFFACTOR)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flRoomRolloffFactor != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flRoomRolloffFactor = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_DECAYTIME:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINDECAYTIME, EAXLISTENER_MAXDECAYTIME)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flDecayTime != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flDecayTime = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_DECAYHFRATIO:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINDECAYHFRATIO, EAXLISTENER_MAXDECAYHFRATIO)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flDecayHFRatio != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flDecayHFRatio = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_REFLECTIONS:
					if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINREFLECTIONS, EAXLISTENER_MAXREFLECTIONS)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.lReflections != (*(long*)pValue));
						ALCContext->Listener.EAX20LP.lReflections = (*(long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINREFLECTIONSDELAY, EAXLISTENER_MAXREFLECTIONSDELAY)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flReflectionsDelay != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flReflectionsDelay = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_REVERB:
					if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINREVERB, EAXLISTENER_MAXREVERB)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.lReverb != (*(long*)pValue));
						ALCContext->Listener.EAX20LP.lReverb = (*(long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_REVERBDELAY:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINREVERBDELAY, EAXLISTENER_MAXREVERBDELAY)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flReverbDelay != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flReverbDelay = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ENVIRONMENT:
					if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*(unsigned long*)pValue, 0, EAX_ENVIRONMENT_COUNT)))
					{
						bGetValue = bSetValue = (ALCContext->Listener.EAX20LP.dwEnvironment != (*(unsigned long*)pValue));
						ALCContext->Listener.EAX20LP.dwEnvironment = (*(unsigned long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINENVIRONMENTSIZE, EAXLISTENER_MAXENVIRONMENTSIZE)))
					{
						bGetValue = bSetValue = (ALCContext->Listener.EAX20LP.flEnvironmentSize != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flEnvironmentSize = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINENVIRONMENTDIFFUSION, EAXLISTENER_MAXENVIRONMENTDIFFUSION)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flEnvironmentDiffusion != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flEnvironmentDiffusion = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF:
					if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINAIRABSORPTIONHF, EAXLISTENER_MAXAIRABSORPTIONHF)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.flAirAbsorptionHF != (*(float*)pValue));
						ALCContext->Listener.EAX20LP.flAirAbsorptionHF = (*(float*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				case DSPROPERTY_EAXLISTENER_FLAGS:
					if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*(unsigned long*)pValue, 0, ~EAXLISTENERFLAGS_RESERVED)))
					{
						bSetValue = (ALCContext->Listener.EAX20LP.dwFlags != (*(unsigned long*)pValue));
						ALCContext->Listener.EAX20LP.dwFlags = (*(unsigned long*)pValue);
					}
					else
					{
						ALErrorCode = AL_INVALID_OPERATION;
					}
					break;

				default:
					ALErrorCode = AL_INVALID_OPERATION;
					break;
				}

				if (bSetValue)
				{
					if (FAILED(IKsPropertySet_Set((LPKSPROPERTYSET)ALSource->uservalue3, propertySetID, property, NULL, 0, pValue, size)))
						ALErrorCode = AL_INVALID_OPERATION;

					if (bGetValue)
						IKsPropertySet_Get((LPKSPROPERTYSET)ALSource->uservalue3, propertySetID, DSPROPERTY_EAXLISTENER_ALLPARAMETERS, NULL, 0,
							&ALCContext->Listener.EAX20LP, sizeof(ALCContext->Listener.EAX20LP), &ulBytesReturned);
				}
			}
		}
		else
			ALErrorCode = AL_INVALID_OPERATION;
	}

	// If we generated a source to set the EAX Listener property, release it now
	if (bGenSource)
		alDeleteSources(1, (ALuint *)&ALSource);
	
	ProcessContext(ALCContext);
	return ALErrorCode;
}
예제 #5
0
ALenum eax2BufferSet(ALuint property, ALuint source, ALvoid *pValue, ALuint size, ALint iSWMixer)
{
    ALsource    *pSource;
    ALboolean    bSetValue = AL_FALSE;
    ALenum        ALErrorCode = AL_NO_ERROR;

    pSource = (ALsource*)ALTHUNK_LOOKUPENTRY(source);

    if (!bEAX2Initialized)
    {
        bEAX2Initialized = AL_TRUE;
    }

    switch(property & ~DSPROPERTY_EAXBUFFER_DEFERRED)
    {
    case DSPROPERTY_EAXBUFFER_NONE:
        bSetValue = AL_TRUE;
        break;

    case DSPROPERTY_EAXBUFFER_ALLPARAMETERS:
        if ((pValue) && (size >= sizeof(EAXBUFFERPROPERTIES)))
        {
            if (memcmp((void*)(&pSource->EAX20BP), pValue, sizeof(EAXBUFFERPROPERTIES)))
            {
                if ( (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lDirect, EAXBUFFER_MINDIRECT, EAXBUFFER_MAXDIRECT)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lDirectHF, EAXBUFFER_MINDIRECTHF, EAXBUFFER_MAXDIRECTHF)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lRoom, EAXBUFFER_MINROOM, EAXBUFFER_MAXROOM)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lRoomHF, EAXBUFFER_MINROOMHF, EAXBUFFER_MAXROOMHF)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lObstruction, EAXBUFFER_MINOBSTRUCTION, EAXBUFFER_MAXOBSTRUCTION)) &&
                     (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flObstructionLFRatio, EAXBUFFER_MINOBSTRUCTIONLFRATIO, EAXBUFFER_MAXOBSTRUCTIONLFRATIO)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lOcclusion, EAXBUFFER_MINOCCLUSION, EAXBUFFER_MAXOCCLUSION)) &&
                     (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flOcclusionLFRatio, EAXBUFFER_MINOCCLUSIONLFRATIO, EAXBUFFER_MAXOCCLUSIONLFRATIO)) &&
                     (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flOcclusionRoomRatio, EAXBUFFER_MINOCCLUSIONROOMRATIO, EAXBUFFER_MAXOCCLUSIONROOMRATIO)) &&
                     (LongInRange(((LPEAXBUFFERPROPERTIES)pValue)->lOutsideVolumeHF, EAXBUFFER_MINOUTSIDEVOLUMEHF, EAXBUFFER_MAXOUTSIDEVOLUMEHF)) &&
                     (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flRoomRolloffFactor, EAXBUFFER_MINROOMROLLOFFFACTOR, EAXBUFFER_MAXROOMROLLOFFFACTOR)) &&
                     (FloatInRange(((LPEAXBUFFERPROPERTIES)pValue)->flAirAbsorptionFactor, EAXBUFFER_MINAIRABSORPTIONFACTOR, EAXBUFFER_MAXAIRABSORPTIONFACTOR)) &&
                     (ULongInRange(((LPEAXBUFFERPROPERTIES)pValue)->dwFlags, 0, ~EAXBUFFERFLAGS_RESERVED)) )
                {
                    memcpy((void*)(&pSource->EAX20BP), pValue, sizeof(EAXBUFFERPROPERTIES));
                    bSetValue = AL_TRUE;
                }
                else
                {
                    ALErrorCode = AL_INVALID_OPERATION;
                }
            }
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_DIRECT:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long*)pValue), EAXBUFFER_MINDIRECT, EAXBUFFER_MAXDIRECT)))
        {
            bSetValue = (pSource->EAX20BP.lDirect != (*(long*)pValue));
            pSource->EAX20BP.lDirect = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_DIRECTHF:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINDIRECTHF, EAXBUFFER_MAXDIRECTHF)))
        {
            bSetValue = (pSource->EAX20BP.lDirectHF != (*(long*)pValue));
            pSource->EAX20BP.lDirectHF = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_ROOM:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINROOM, EAXBUFFER_MAXROOM)))
        {
            bSetValue = (pSource->EAX20BP.lRoom != (*(long*)pValue));
            pSource->EAX20BP.lRoom = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_ROOMHF:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINROOMHF, EAXBUFFER_MAXROOMHF)))
        {
            bSetValue = (pSource->EAX20BP.lRoomHF != (*(long*)pValue));
            pSource->EAX20BP.lRoomHF = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OBSTRUCTION:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOBSTRUCTION, EAXBUFFER_MAXOBSTRUCTION)))
        {
            bSetValue = (pSource->EAX20BP.lObstruction != (*(long*)pValue));
            pSource->EAX20BP.lObstruction = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OBSTRUCTIONLFRATIO:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOBSTRUCTIONLFRATIO, EAXBUFFER_MAXOBSTRUCTIONLFRATIO)))
        {
            bSetValue = (pSource->EAX20BP.flObstructionLFRatio != (*(float*)pValue));
            pSource->EAX20BP.flObstructionLFRatio = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OCCLUSION:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOCCLUSION, EAXBUFFER_MAXOCCLUSION)))
        {
            bSetValue = (pSource->EAX20BP.lOcclusion != (*(long*)pValue));
            pSource->EAX20BP.lOcclusion = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOCCLUSIONLFRATIO, EAXBUFFER_MAXOCCLUSIONLFRATIO)))
        {
            bSetValue = (pSource->EAX20BP.flOcclusionLFRatio != (*(float*)pValue));
            pSource->EAX20BP.flOcclusionLFRatio = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINOCCLUSIONROOMRATIO, EAXBUFFER_MAXOCCLUSIONROOMRATIO)))
        {
            bSetValue = (pSource->EAX20BP.flOcclusionRoomRatio != (*(float*)pValue));
            pSource->EAX20BP.flOcclusionRoomRatio = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_OUTSIDEVOLUMEHF:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*((long *)pValue), EAXBUFFER_MINOUTSIDEVOLUMEHF, EAXBUFFER_MAXOUTSIDEVOLUMEHF)))
        {
            bSetValue = (pSource->EAX20BP.lOutsideVolumeHF != (*(long*)pValue));
            pSource->EAX20BP.lOutsideVolumeHF = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_ROOMROLLOFFFACTOR:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINROOMROLLOFFFACTOR, EAXBUFFER_MAXROOMROLLOFFFACTOR)))
        {
            bSetValue = (pSource->EAX20BP.flRoomRolloffFactor != (*(float*)pValue));
            pSource->EAX20BP.flRoomRolloffFactor = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_AIRABSORPTIONFACTOR:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*((float *)pValue), EAXBUFFER_MINAIRABSORPTIONFACTOR, EAXBUFFER_MAXAIRABSORPTIONFACTOR)))
        {
            bSetValue = (pSource->EAX20BP.flAirAbsorptionFactor != (*(float*)pValue));
            pSource->EAX20BP.flAirAbsorptionFactor = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXBUFFER_FLAGS:
        if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*((unsigned long *)pValue), 0, ~EAXBUFFERFLAGS_RESERVED)))
        {
            bSetValue = (pSource->EAX20BP.dwFlags != (*(unsigned long*)pValue));
            pSource->EAX20BP.dwFlags = (*(unsigned long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    default:
        ALErrorCode = AL_INVALID_OPERATION;
    }

    if (bSetValue)
    {
        if (pSource->uservalue3)
        {
            if (FAILED(IKsPropertySet_Set((LPKSPROPERTYSET)pSource->uservalue3, &DSPROPSETID_EAX20_BufferProperties, property, NULL, 0, pValue, size)))
                ALErrorCode = AL_INVALID_OPERATION;
        }
    }

    return ALErrorCode;
}
예제 #6
0
ALenum eax2ListenerSet(ALuint property, ALsource *pSource, ALvoid *pValue, ALuint size, ALint iSWMixer)
{
    ALCcontext    *pContext;
    ALenum        ALErrorCode = AL_NO_ERROR;
    ALboolean    bSetValue = AL_FALSE;
    ALboolean    bGetValue = AL_FALSE;
    ALuint        ulBytesReturned;

    pContext = alcGetCurrentContext();

    if (!bEAX2Initialized)
    {
        bEAX2Initialized = AL_TRUE;
    }

    switch(property & ~DSPROPERTY_EAXLISTENER_DEFERRED)
    {
    case DSPROPERTY_EAXLISTENER_NONE:
        bSetValue = AL_TRUE;
        break;

    case DSPROPERTY_EAXLISTENER_ALLPARAMETERS:
        if ((pValue) && (size >= sizeof(EAXLISTENERPROPERTIES)))
        {
            if (memcmp((void*)(&pContext->Listener.EAX20LP), pValue, sizeof(EAXLISTENERPROPERTIES)))
            {
                if ( (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lRoom, EAXLISTENER_MINROOM, EAXLISTENER_MAXROOM)) &&
                     (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lRoomHF, EAXLISTENER_MINROOMHF, EAXLISTENER_MAXROOMHF)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flRoomRolloffFactor, EAXLISTENER_MINROOMROLLOFFFACTOR, EAXLISTENER_MAXROOMROLLOFFFACTOR)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flDecayTime, EAXLISTENER_MINDECAYTIME, EAXLISTENER_MAXDECAYTIME)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flDecayHFRatio, EAXLISTENER_MINDECAYHFRATIO, EAXLISTENER_MAXDECAYHFRATIO)) &&
                     (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lReflections, EAXLISTENER_MINREFLECTIONS, EAXLISTENER_MAXREFLECTIONS)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flReflectionsDelay, EAXLISTENER_MINREFLECTIONSDELAY, EAXLISTENER_MAXREFLECTIONSDELAY)) &&
                     (LongInRange(((LPEAXLISTENERPROPERTIES)pValue)->lReverb, EAXLISTENER_MINREVERB, EAXLISTENER_MAXREVERB)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flReverbDelay, EAXLISTENER_MINREVERBDELAY, EAXLISTENER_MAXREVERBDELAY)) &&
                     (ULongInRange(((LPEAXLISTENERPROPERTIES)pValue)->dwEnvironment, 0, EAX_ENVIRONMENT_COUNT)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flEnvironmentSize, EAXLISTENER_MINENVIRONMENTSIZE, EAXLISTENER_MAXENVIRONMENTSIZE)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flEnvironmentDiffusion, EAXLISTENER_MINENVIRONMENTDIFFUSION, EAXLISTENER_MAXENVIRONMENTDIFFUSION)) &&
                     (FloatInRange(((LPEAXLISTENERPROPERTIES)pValue)->flAirAbsorptionHF, EAXLISTENER_MINAIRABSORPTIONHF, EAXLISTENER_MAXAIRABSORPTIONHF)) &&
                     (ULongInRange(((LPEAXLISTENERPROPERTIES)pValue)->dwFlags, 0, ~EAXLISTENERFLAGS_RESERVED)) )
                {
                    memcpy((void*)(&pContext->Listener.EAX20LP), pValue, sizeof(EAXLISTENERPROPERTIES));
                    bSetValue = AL_TRUE;
                }
                else
                {
                    ALErrorCode = AL_INVALID_OPERATION;
                }
            }
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ROOM:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINROOM, EAXLISTENER_MAXROOM)))
        {
            bSetValue = (pContext->Listener.EAX20LP.lRoom != (*(long*)pValue));
            pContext->Listener.EAX20LP.lRoom = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ROOMHF:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINROOMHF, EAXLISTENER_MAXROOMHF)))
        {
            bSetValue = (pContext->Listener.EAX20LP.lRoomHF != (*(long*)pValue));
            pContext->Listener.EAX20LP.lRoomHF = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINROOMROLLOFFFACTOR, EAXLISTENER_MAXROOMROLLOFFFACTOR)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flRoomRolloffFactor != (*(float*)pValue));
            pContext->Listener.EAX20LP.flRoomRolloffFactor = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_DECAYTIME:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINDECAYTIME, EAXLISTENER_MAXDECAYTIME)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flDecayTime != (*(float*)pValue));
            pContext->Listener.EAX20LP.flDecayTime = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_DECAYHFRATIO:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINDECAYHFRATIO, EAXLISTENER_MAXDECAYHFRATIO)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flDecayHFRatio != (*(float*)pValue));
            pContext->Listener.EAX20LP.flDecayHFRatio = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_REFLECTIONS:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINREFLECTIONS, EAXLISTENER_MAXREFLECTIONS)))
        {
            bSetValue = (pContext->Listener.EAX20LP.lReflections != (*(long*)pValue));
            pContext->Listener.EAX20LP.lReflections = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_REFLECTIONSDELAY:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINREFLECTIONSDELAY, EAXLISTENER_MAXREFLECTIONSDELAY)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flReflectionsDelay != (*(float*)pValue));
            pContext->Listener.EAX20LP.flReflectionsDelay = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_REVERB:
        if ((pValue) && (size >= sizeof(long)) && (LongInRange(*(long*)pValue, EAXLISTENER_MINREVERB, EAXLISTENER_MAXREVERB)))
        {
            bSetValue = (pContext->Listener.EAX20LP.lReverb != (*(long*)pValue));
            pContext->Listener.EAX20LP.lReverb = (*(long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_REVERBDELAY:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINREVERBDELAY, EAXLISTENER_MAXREVERBDELAY)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flReverbDelay != (*(float*)pValue));
            pContext->Listener.EAX20LP.flReverbDelay = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ENVIRONMENT:
        if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*(unsigned long*)pValue, 0, EAX_ENVIRONMENT_COUNT)))
        {
            // Always Set this property
            bGetValue = bSetValue = TRUE;
            memcpy((void*)(&pContext->Listener.EAX20LP), &EAX20Preset[*(unsigned long*)pValue], sizeof(EAXLISTENERPROPERTIES));
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ENVIRONMENTSIZE:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINENVIRONMENTSIZE, EAXLISTENER_MAXENVIRONMENTSIZE)))
        {
            bGetValue = bSetValue = (pContext->Listener.EAX20LP.flEnvironmentSize != (*(float*)pValue));
            pContext->Listener.EAX20LP.flEnvironmentSize = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_ENVIRONMENTDIFFUSION:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINENVIRONMENTDIFFUSION, EAXLISTENER_MAXENVIRONMENTDIFFUSION)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flEnvironmentDiffusion != (*(float*)pValue));
            pContext->Listener.EAX20LP.flEnvironmentDiffusion = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_AIRABSORPTIONHF:
        if ((pValue) && (size >= sizeof(float)) && (FloatInRange(*(float*)pValue, EAXLISTENER_MINAIRABSORPTIONHF, EAXLISTENER_MAXAIRABSORPTIONHF)))
        {
            bSetValue = (pContext->Listener.EAX20LP.flAirAbsorptionHF != (*(float*)pValue));
            pContext->Listener.EAX20LP.flAirAbsorptionHF = (*(float*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    case DSPROPERTY_EAXLISTENER_FLAGS:
        if ((pValue) && (size >= sizeof(unsigned long)) && (ULongInRange(*(unsigned long*)pValue, 0, ~EAXLISTENERFLAGS_RESERVED)))
        {
            bSetValue = (pContext->Listener.EAX20LP.dwFlags != (*(unsigned long*)pValue));
            pContext->Listener.EAX20LP.dwFlags = (*(unsigned long*)pValue);
        }
        else
        {
            ALErrorCode = AL_INVALID_OPERATION;
        }
        break;

    default:
        ALErrorCode = AL_INVALID_OPERATION;
        break;
    }

    if (bSetValue)
    {
        if (pSource->uservalue3)
        {
            if (FAILED(IKsPropertySet_Set((LPKSPROPERTYSET)pSource->uservalue3, &DSPROPSETID_EAX20_ListenerProperties, property, NULL, 0, pValue, size)))
                ALErrorCode = AL_INVALID_OPERATION;

            if (bGetValue)
                IKsPropertySet_Get((LPKSPROPERTYSET)pSource->uservalue3, &DSPROPSETID_EAX20_ListenerProperties, DSPROPERTY_EAXLISTENER_ALLPARAMETERS, NULL, 0,
                    &pContext->Listener.EAX20LP, sizeof(pContext->Listener.EAX20LP), &ulBytesReturned);
        }
    }

    return ALErrorCode;
}