-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFilter.cpp
More file actions
61 lines (46 loc) · 1.1 KB
/
Filter.cpp
File metadata and controls
61 lines (46 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "Common.h"
ALuint Extension::FilterGetFromID(int ID)
{
map<int, ALuint>::iterator FoundFilter = FilterMap.find(ID);
//A filter with the ID was found, return its handle.
if(FoundFilter != FilterMap.end())
return FoundFilter->second;
//Nothing found, return zero.
return 0;
}
/* Actions */
void Extension::FilterCreateLowPass()
{
//Generate the filter object.
alGenFilters(1, &Filter);
int ID = ++LastFilterIndex;
if(Filter)
{
//Delete the old filter in the map.
//if(FilterMap.find(Name) != FilterMap.end())
// alDeleteFilters(1, &FilterMap[Name]);
//Store the filter in the map.
FilterMap[ID] = Filter;
//Attach a low-pass.
alFilteri(Filter, AL_FILTER_TYPE, AL_FILTER_LOWPASS);
}
}
void Extension::FilterSelectByID(int ID)
{
Filter = FilterGetFromID(ID);
}
void Extension::FilterSetGain(float Gain)
{
if(alIsFilter(Filter))
alFilterf(Filter, AL_LOWPASS_GAIN, Gain);
}
void Extension::FilterSetGainHF(float GainHF)
{
if(alIsFilter(Filter))
alFilterf(Filter, AL_LOWPASS_GAINHF, GainHF);
}
/* Expressions */
int Extension::FilterGetLast()
{
return LastFilterIndex;
}