PDA

View Full Version : Setting EAX at runtime..



M109uk
20-05-2005, 11:42 AM
Hi all,
Im having problems setting the EAX environment, i have the following code:

procedure SetupEAX;
var
EAXFunction: PALubyte;
begin
EAXAvailable := alIsExtensionPresent('EAX2.0');
EAXFunction := 'EAXSet';
eaxSet := alGetProcAddress(EAXFunction);
EAXFunction := 'EAXGet';
eaxGet := alGetProcAddress(EAXFunction);
end;

procedure SetEAXEnvironment(Value: TALuInt; const Source: TALuInt);
begin
eaxSet(DSPROPSETID_EAX20_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT or DSPROPERTY_EAXLISTENER_DEFERRED, 0, @Value, SizeOf(TAluInt));
eaxSet(DSPROPSETID_EAX20_BufferProperties, DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS, Source, Nil, 0);
eaxSet(DSPROPSETID_EAX20_ListenerProperties, DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS, 0, Nil, 0);
end;

But when i try to set the environment the value changes from EAX_ENVIRONMENT_BATHROOM (3) to 65536 and the i get an Error.

I cant understand what causes the value to change? does any one know?

Edit:
I changed the SetEAXEnvironment to:

var
Env: TAluInt;

procedure SetEAXEnvironment(Value: TALuInt; const Source: TALuInt);
begin
Env := Value;
eaxSet(DSPROPSETID_EAX20_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT or DSPROPERTY_EAXLISTENER_DEFERRED, 0, @Env, SizeOf(TAluInt));
eaxSet(DSPROPSETID_EAX20_BufferProperties, DSPROPERTY_EAXBUFFER_COMMITDEFERREDSETTINGS, Source, Nil, 0);
eaxSet(DSPROPSETID_EAX20_ListenerProperties, DSPROPERTY_EAXLISTENER_COMMITDEFERREDSETTINGS, 0, Nil, 0);
end;


and thats works, however i still get an access violation, im guessing that it is in the DLL, because the address is 00000000 and is the same when i had problems with my own librarys..
But i do not have the same problem when i run the EAX sample from Noeska's site..

Thanx