fixes from ioq3

This commit is contained in:
Richard Allen 2012-03-16 20:42:16 +00:00
parent dd658094c5
commit 4d69dbb4d9

View file

@ -47,9 +47,9 @@ cvar_t *s_alDevice;
cvar_t *s_alInputDevice; cvar_t *s_alInputDevice;
cvar_t *s_alAvailableDevices; cvar_t *s_alAvailableDevices;
cvar_t *s_alAvailableInputDevices; cvar_t *s_alAvailableInputDevices;
// Makro
cvar_t *s_alEffectsLevel; cvar_t *s_alEffectsLevel;
static qboolean enumeration_ext = qfalse; static qboolean enumeration_ext = qfalse;
static qboolean enumeration_all_ext = qfalse; static qboolean enumeration_all_ext = qfalse;
#ifdef USE_VOIP #ifdef USE_VOIP
@ -2348,7 +2348,7 @@ void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int
orientation[3] = axis[2][0]; orientation[4] = axis[2][1]; orientation[5] = axis[2][2]; orientation[3] = axis[2][0]; orientation[4] = axis[2][1]; orientation[5] = axis[2][2];
VectorCopy( sorigin, lastListenerOrigin ); VectorCopy( sorigin, lastListenerOrigin );
// Makro
contents = CM_PointContents(sorigin, 0); contents = CM_PointContents(sorigin, 0);
changedContents = contents ^ s_alEffects.lastContents; changedContents = contents ^ s_alEffects.lastContents;
s_alEffects.lastContents = contents; s_alEffects.lastContents = contents;
@ -2369,6 +2369,7 @@ void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int
qalListenerfv(AL_ORIENTATION, orientation); qalListenerfv(AL_ORIENTATION, orientation);
} }
// Makro
static void S_AL_LerpReverb(const reverb_t* from, const reverb_t* to, float fraction, reverb_t* out) static void S_AL_LerpReverb(const reverb_t* from, const reverb_t* to, float fraction, reverb_t* out)
{ {
# define LERP_FIELD(field) out->field = from->field + (to->field - from->field) * fraction # define LERP_FIELD(field) out->field = from->field + (to->field - from->field) * fraction
@ -2615,6 +2616,30 @@ void S_AL_ClearSoundBuffer( void )
{ {
} }
static void S_AL_ShutDownEffects(void)
{
if (!s_alEffects.initialized)
return;
// Delete Effect
if (s_alEffects.env.alEffect)
qalDeleteEffects(1, &s_alEffects.env.alEffect);
// Delete Auxiliary Effect Slot
if (s_alEffects.env.alEffectSlot)
qalDeleteAuxiliaryEffectSlots(1, &s_alEffects.env.alEffectSlot);
// Delete filter
if (s_alEffects.water.alFilter)
qalDeleteFilters(1, &s_alEffects.water.alFilter);
Com_Memset(&s_alEffects, 0, sizeof(s_alEffects));
Cmd_RemoveCommand("s_alTestReverb");
Cmd_RemoveCommand("writesoundshader");
Cmd_RemoveCommand("writecustinfoparms");
}
/* /*
================= =================
S_AL_SoundList S_AL_SoundList
@ -2674,54 +2699,31 @@ S_AL_SoundInfo
static void S_AL_SoundInfo(void) static void S_AL_SoundInfo(void)
{ {
Com_Printf( "OpenAL info:\n" ); Com_Printf( "OpenAL info:\n" );
Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) ); Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) );
Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) ); Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) );
Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) ); Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) );
Com_Printf( " AL Extensions: %s\n", qalGetString( AL_EXTENSIONS ) ); Com_Printf( " AL Extensions: %s\n", qalGetString( AL_EXTENSIONS ) );
Com_Printf( " ALC Extensions: %s\n", qalcGetString( alDevice, ALC_EXTENSIONS ) ); Com_Printf( " ALC Extensions: %s\n", qalcGetString( alDevice, ALC_EXTENSIONS ) );
if(enumeration_all_ext) if(enumeration_all_ext)
Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_ALL_DEVICES_SPECIFIER)); Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_ALL_DEVICES_SPECIFIER));
else if(enumeration_ext) else if(enumeration_ext)
Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER)); Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
if(enumeration_all_ext || enumeration_ext) if(enumeration_all_ext || enumeration_ext)
Com_Printf("Available Devices:\n%s", s_alAvailableDevices->string); Com_Printf(" Available Devices:\n%s", s_alAvailableDevices->string);
#ifdef USE_VOIP #ifdef USE_VOIP
if(capture_ext) if(capture_ext)
{ {
Com_Printf(" Input Device: %s\n", qalcGetString(alCaptureDevice, ALC_CAPTURE_DEVICE_SPECIFIER)); Com_Printf(" Input Device: %s\n", qalcGetString(alCaptureDevice, ALC_CAPTURE_DEVICE_SPECIFIER));
Com_Printf("Available Input Devices:\n%s", s_alAvailableInputDevices->string); Com_Printf(" Available Input Devices:\n%s", s_alAvailableInputDevices->string);
} }
#endif #endif
} }
static void S_AL_ShutDownEffects(void)
{
if (!s_alEffects.initialized)
return;
// Delete Effect
if (s_alEffects.env.alEffect)
qalDeleteEffects(1, &s_alEffects.env.alEffect);
// Delete Auxiliary Effect Slot
if (s_alEffects.env.alEffectSlot)
qalDeleteAuxiliaryEffectSlots(1, &s_alEffects.env.alEffectSlot);
// Delete filter
if (s_alEffects.water.alFilter)
qalDeleteFilters(1, &s_alEffects.water.alFilter);
Com_Memset(&s_alEffects, 0, sizeof(s_alEffects));
Cmd_RemoveCommand("s_alTestReverb");
Cmd_RemoveCommand("writesoundshader");
Cmd_RemoveCommand("writecustinfoparms");
}
/* /*
================= =================
S_AL_Shutdown S_AL_Shutdown
@ -3144,8 +3146,8 @@ qboolean S_AL_Init( soundInterface_t *si )
s_alGraceDistance = Cvar_Get("s_alGraceDistance", "512", CVAR_CHEAT); s_alGraceDistance = Cvar_Get("s_alGraceDistance", "512", CVAR_CHEAT);
s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH ); s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH );
s_alInputDevice = Cvar_Get( "s_alInputDevice", "", CVAR_ARCHIVE | CVAR_LATCH );
s_alInputDevice = Cvar_Get( "s_alInputDevice", "", CVAR_ARCHIVE | CVAR_LATCH );
s_alDevice = Cvar_Get("s_alDevice", "", CVAR_ARCHIVE | CVAR_LATCH); s_alDevice = Cvar_Get("s_alDevice", "", CVAR_ARCHIVE | CVAR_LATCH);
s_alEffectsLevel = Cvar_Get("s_alEffects", "1", CVAR_ARCHIVE | CVAR_LATCH ); s_alEffectsLevel = Cvar_Get("s_alEffects", "1", CVAR_ARCHIVE | CVAR_LATCH );
@ -3260,6 +3262,7 @@ qboolean S_AL_Init( soundInterface_t *si )
qalDopplerFactor( s_alDopplerFactor->value ); qalDopplerFactor( s_alDopplerFactor->value );
qalDopplerVelocity( s_alDopplerSpeed->value ); qalDopplerVelocity( s_alDopplerSpeed->value );
#ifdef USE_VOIP #ifdef USE_VOIP
// !!! FIXME: some of these alcCaptureOpenDevice() values should be cvars. // !!! FIXME: some of these alcCaptureOpenDevice() values should be cvars.
// !!! FIXME: add support for capture device enumeration. // !!! FIXME: add support for capture device enumeration.