1 /**
2  * Copyright (c) 2006-2019 LOVE Development Team
3  *
4  * This software is provided 'as-is', without any express or implied
5  * warranty.  In no event will the authors be held liable for any damages
6  * arising from the use of this software.
7  *
8  * Permission is granted to anyone to use this software for any purpose,
9  * including commercial applications, and to alter it and redistribute it
10  * freely, subject to the following restrictions:
11  *
12  * 1. The origin of this software must not be misrepresented; you must not
13  *    claim that you wrote the original software. If you use this software
14  *    in a product, an acknowledgment in the product documentation would be
15  *    appreciated but is not required.
16  * 2. Altered source versions must be plainly marked as such, and must not be
17  *    misrepresented as being the original software.
18  * 3. This notice may not be removed or altered from any source distribution.
19  **/
20 
21 #ifndef LOVE_AUDIO_OPENAL_FILTERS_H
22 #define LOVE_AUDIO_OPENAL_FILTERS_H
23 
24 #include "common/config.h"
25 
26 // OpenAL
27 #ifdef LOVE_APPLE_USE_FRAMEWORKS // Frameworks have different include paths.
28 #ifdef LOVE_IOS
29 #include <OpenAL/alc.h>
30 #include <OpenAL/al.h>
31 #else
32 #include <OpenAL-Soft/alc.h>
33 #include <OpenAL-Soft/al.h>
34 #include <OpenAL-Soft/alext.h>
35 #endif
36 #else
37 #include <AL/alc.h>
38 #include <AL/al.h>
39 #include <AL/alext.h>
40 #endif
41 
42 #include <vector>
43 
44 #include "audio/Filter.h"
45 #include "Audio.h"
46 
47 #ifndef AL_FILTER_NULL
48 #define AL_FILTER_NULL (0)
49 #endif
50 
51 namespace love
52 {
53 namespace audio
54 {
55 namespace openal
56 {
57 
58 class Filter : public love::audio::Filter
59 {
60 public:
61 	Filter();
62 	Filter(const Filter &s);
63 	virtual ~Filter();
64 	virtual Filter *clone();
65 	ALuint getFilter() const;
66 	virtual bool setParams(const std::map<Parameter, float> &params);
67 	virtual const std::map<Parameter, float> &getParams() const;
68 
69 private:
70 	bool generateFilter();
71 	void deleteFilter();
72 	float getValue(Parameter in, float def) const;
73 	int getValue(Parameter in, int def) const;
74 	ALuint filter = AL_FILTER_NULL;
75 	std::map<Parameter, float> params;
76 };
77 
78 } //openal
79 } //audio
80 } //love
81 
82 #endif //LOVE_AUDIO_OPENAL_FILTERS_H
83