2007-12-17 15:43:35 -08:00
|
|
|
/**
|
|
|
|
* OpenAL cross platform audio library
|
|
|
|
* Copyright (C) 1999-2007 by authors.
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
* Or go to http://www.gnu.org/copyleft/lgpl.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2008-01-16 14:09:04 -08:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
#include "AL/al.h"
|
|
|
|
#include "AL/alc.h"
|
|
|
|
#include "alMain.h"
|
|
|
|
#include "alFilter.h"
|
2007-12-31 19:34:52 -08:00
|
|
|
#include "alThunk.h"
|
|
|
|
#include "alError.h"
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
|
|
|
|
static void InitFilterParams(ALfilter *filter, ALenum type);
|
|
|
|
|
2010-05-18 17:54:45 -07:00
|
|
|
#define LookupFilter(m, k) ((ALfilter*)LookupUIntMapKey(&(m), (k)))
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-20 21:38:05 -07:00
|
|
|
ALsizei i=0;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-09-21 15:12:08 -07:00
|
|
|
if(n < 0 || IsBadWritePtr((void*)filters, n * sizeof(ALuint)))
|
|
|
|
alSetError(Context, AL_INVALID_VALUE);
|
|
|
|
else
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2009-08-15 09:39:18 -07:00
|
|
|
ALCdevice *device = Context->Device;
|
2010-09-21 15:12:08 -07:00
|
|
|
ALenum err;
|
2009-08-15 09:39:18 -07:00
|
|
|
|
2010-09-21 15:12:08 -07:00
|
|
|
while(i < n)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-09-21 15:12:08 -07:00
|
|
|
ALfilter *filter = calloc(1, sizeof(ALfilter));
|
|
|
|
if(!filter)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-09-21 15:12:08 -07:00
|
|
|
alSetError(Context, AL_OUT_OF_MEMORY);
|
|
|
|
alDeleteFilters(i, filters);
|
|
|
|
break;
|
|
|
|
}
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-09-21 15:12:08 -07:00
|
|
|
filter->filter = ALTHUNK_ADDENTRY(filter);
|
|
|
|
err = InsertUIntMapEntry(&device->FilterMap, filter->filter, filter);
|
|
|
|
if(err != AL_NO_ERROR)
|
|
|
|
{
|
|
|
|
ALTHUNK_REMOVEENTRY(filter->filter);
|
|
|
|
memset(filter, 0, sizeof(ALfilter));
|
|
|
|
free(filter);
|
2008-01-15 16:24:12 -08:00
|
|
|
|
2010-09-21 15:12:08 -07:00
|
|
|
alSetError(Context, err);
|
|
|
|
alDeleteFilters(i, filters);
|
|
|
|
break;
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
2010-09-21 15:12:08 -07:00
|
|
|
|
|
|
|
filters[i++] = filter->filter;
|
|
|
|
InitFilterParams(filter, AL_FILTER_NULL);
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, ALuint *filters)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-09-21 16:54:33 -07:00
|
|
|
ALCdevice *device;
|
2007-12-17 15:43:35 -08:00
|
|
|
ALfilter *ALFilter;
|
2010-09-21 16:54:33 -07:00
|
|
|
ALboolean Failed;
|
2007-12-17 15:43:35 -08:00
|
|
|
ALsizei i;
|
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-09-21 16:54:33 -07:00
|
|
|
Failed = AL_TRUE;
|
|
|
|
device = Context->Device;
|
|
|
|
if(n < 0)
|
|
|
|
alSetError(Context, AL_INVALID_VALUE);
|
|
|
|
else
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-09-21 16:54:33 -07:00
|
|
|
Failed = AL_FALSE;
|
2007-12-17 15:43:35 -08:00
|
|
|
// Check that all filters are valid
|
2010-09-21 16:54:33 -07:00
|
|
|
for(i = 0;i < n;i++)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-03-16 20:29:01 -07:00
|
|
|
if(!filters[i])
|
|
|
|
continue;
|
|
|
|
|
2010-09-21 16:54:33 -07:00
|
|
|
if(LookupFilter(device->FilterMap, filters[i]) == NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2010-09-21 16:54:33 -07:00
|
|
|
Failed = AL_TRUE;
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2010-09-21 16:54:33 -07:00
|
|
|
}
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-09-21 16:54:33 -07:00
|
|
|
if(!Failed)
|
|
|
|
{
|
|
|
|
// All filters are valid
|
|
|
|
for(i = 0;i < n;i++)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2010-09-21 16:54:33 -07:00
|
|
|
// Recheck that the filter is valid, because there could be duplicated names
|
|
|
|
if((ALFilter=LookupFilter(device->FilterMap, filters[i])) == NULL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
RemoveUIntMapKey(&device->FilterMap, ALFilter->filter);
|
|
|
|
ALTHUNK_REMOVEENTRY(ALFilter->filter);
|
|
|
|
|
|
|
|
memset(ALFilter, 0, sizeof(ALfilter));
|
|
|
|
free(ALFilter);
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-05-18 17:54:45 -07:00
|
|
|
ALboolean result;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return AL_FALSE;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-05-18 17:54:45 -07:00
|
|
|
result = ((!filter || LookupFilter(Context->Device->FilterMap, filter)) ?
|
|
|
|
AL_TRUE : AL_FALSE);
|
2010-03-16 19:14:05 -07:00
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
ProcessContext(Context);
|
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
return result;
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint iValue)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
|
|
|
ALfilter *ALFilter;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2007-12-17 22:42:38 -08:00
|
|
|
case AL_FILTER_TYPE:
|
|
|
|
if(iValue == AL_FILTER_NULL ||
|
|
|
|
iValue == AL_FILTER_LOWPASS)
|
|
|
|
InitFilterParams(ALFilter, iValue);
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_VALUE);
|
2007-12-17 22:42:38 -08:00
|
|
|
break;
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, ALint *piValues)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2011-06-16 09:14:41 -07:00
|
|
|
switch(param)
|
|
|
|
{
|
|
|
|
case AL_FILTER_TYPE:
|
|
|
|
alFilteri(filter, param, piValues[0]);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if(LookupFilter(Device->FilterMap, filter) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat flValue)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
|
|
|
ALfilter *ALFilter;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
switch(ALFilter->type)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_FILTER_LOWPASS:
|
|
|
|
switch(param)
|
2007-12-17 22:42:38 -08:00
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_LOWPASS_GAIN:
|
2011-06-16 10:53:01 -07:00
|
|
|
if(flValue >= AL_LOWPASS_MIN_GAIN &&
|
|
|
|
flValue <= AL_LOWPASS_MAX_GAIN)
|
2007-12-17 22:42:38 -08:00
|
|
|
ALFilter->Gain = flValue;
|
2008-07-26 18:32:45 -07:00
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_VALUE);
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
2007-12-17 22:42:38 -08:00
|
|
|
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_LOWPASS_GAINHF:
|
2011-06-16 10:53:01 -07:00
|
|
|
if(flValue >= AL_LOWPASS_MIN_GAINHF &&
|
|
|
|
flValue <= AL_LOWPASS_MAX_GAINHF)
|
2007-12-17 22:42:38 -08:00
|
|
|
ALFilter->GainHF = flValue;
|
2008-07-26 18:32:45 -07:00
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_VALUE);
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
|
|
|
}
|
2007-12-17 22:42:38 -08:00
|
|
|
break;
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2011-06-16 14:40:37 -07:00
|
|
|
/* There are currently no multi-value filter parameters */
|
|
|
|
alFilterf(filter, param, pflValues[0]);
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *piValue)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
|
|
|
ALfilter *ALFilter;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_FILTER_TYPE:
|
|
|
|
*piValue = ALFilter->type;
|
|
|
|
break;
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *piValues)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2011-06-16 09:14:41 -07:00
|
|
|
switch(param)
|
|
|
|
{
|
|
|
|
case AL_FILTER_TYPE:
|
|
|
|
alGetFilteri(filter, param, piValues);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if(LookupFilter(Device->FilterMap, filter) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
switch(param)
|
|
|
|
{
|
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *pflValue)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
|
|
|
ALCcontext *Context;
|
2010-03-16 18:54:36 -07:00
|
|
|
ALCdevice *Device;
|
|
|
|
ALfilter *ALFilter;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2009-08-16 14:09:23 -07:00
|
|
|
Context = GetContextSuspended();
|
2009-09-12 20:22:03 -07:00
|
|
|
if(!Context) return;
|
2007-12-17 15:43:35 -08:00
|
|
|
|
2010-03-16 18:54:36 -07:00
|
|
|
Device = Context->Device;
|
2010-05-18 17:54:45 -07:00
|
|
|
if((ALFilter=LookupFilter(Device->FilterMap, filter)) != NULL)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
switch(ALFilter->type)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_FILTER_LOWPASS:
|
|
|
|
switch(param)
|
|
|
|
{
|
|
|
|
case AL_LOWPASS_GAIN:
|
2007-12-17 22:42:38 -08:00
|
|
|
*pflValue = ALFilter->Gain;
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
2007-12-17 22:42:38 -08:00
|
|
|
|
2008-07-26 18:32:45 -07:00
|
|
|
case AL_LOWPASS_GAINHF:
|
2007-12-17 22:42:38 -08:00
|
|
|
*pflValue = ALFilter->GainHF;
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2008-07-26 18:32:45 -07:00
|
|
|
break;
|
|
|
|
}
|
2007-12-17 22:42:38 -08:00
|
|
|
break;
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
default:
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_ENUM);
|
2007-12-17 15:43:35 -08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
2010-03-16 17:35:51 -07:00
|
|
|
alSetError(Context, AL_INVALID_NAME);
|
2007-12-17 15:43:35 -08:00
|
|
|
|
|
|
|
ProcessContext(Context);
|
|
|
|
}
|
|
|
|
|
2010-03-23 17:44:01 -07:00
|
|
|
AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *pflValues)
|
2007-12-17 15:43:35 -08:00
|
|
|
{
|
2011-06-16 14:40:37 -07:00
|
|
|
/* There are currently no multi-value filter parameters */
|
|
|
|
alGetFilterf(filter, param, pflValues);
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-05-18 18:42:25 -07:00
|
|
|
ALfloat lpCoeffCalc(ALfloat g, ALfloat cw)
|
|
|
|
{
|
|
|
|
ALfloat a = 0.0f;
|
|
|
|
|
|
|
|
/* Be careful with gains < 0.01, as that causes the coefficient
|
|
|
|
* head towards 1, which will flatten the signal */
|
|
|
|
g = __max(g, 0.01f);
|
|
|
|
if(g < 0.9999f) /* 1-epsilon */
|
|
|
|
a = (1 - g*cw - aluSqrt(2*g*(1-cw) - g*g*(1 - cw*cw))) /
|
|
|
|
(1 - g);
|
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
2009-08-15 09:39:18 -07:00
|
|
|
ALvoid ReleaseALFilters(ALCdevice *device)
|
2007-12-17 17:08:44 -08:00
|
|
|
{
|
2010-05-18 17:54:45 -07:00
|
|
|
ALsizei i;
|
|
|
|
for(i = 0;i < device->FilterMap.size;i++)
|
2007-12-17 17:08:44 -08:00
|
|
|
{
|
2010-05-18 17:54:45 -07:00
|
|
|
ALfilter *temp = device->FilterMap.array[i].value;
|
|
|
|
device->FilterMap.array[i].value = NULL;
|
2007-12-17 17:08:44 -08:00
|
|
|
|
2007-12-17 17:20:55 -08:00
|
|
|
// Release filter structure
|
2010-03-20 21:49:02 -07:00
|
|
|
ALTHUNK_REMOVEENTRY(temp->filter);
|
2007-12-17 17:08:44 -08:00
|
|
|
memset(temp, 0, sizeof(ALfilter));
|
|
|
|
free(temp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-17 15:43:35 -08:00
|
|
|
static void InitFilterParams(ALfilter *filter, ALenum type)
|
|
|
|
{
|
|
|
|
filter->type = type;
|
2007-12-17 22:42:38 -08:00
|
|
|
|
2011-06-16 10:53:01 -07:00
|
|
|
filter->Gain = AL_LOWPASS_DEFAULT_GAIN;
|
|
|
|
filter->GainHF = AL_LOWPASS_DEFAULT_GAINHF;
|
2007-12-17 15:43:35 -08:00
|
|
|
}
|