1 | /** |
2 | * Copyright (c) 2006-2023 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_EFFECTS_H |
22 | #define LOVE_AUDIO_OPENAL_EFFECTS_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 | #include <map> |
44 | |
45 | #include "audio/Effect.h" |
46 | #include "Audio.h" |
47 | |
48 | #ifndef AL_EFFECT_NULL |
49 | #define AL_EFFECT_NULL (0) |
50 | #endif |
51 | |
52 | #ifndef AL_EFFECTSLOT_NULL |
53 | #define AL_EFFECTSLOT_NULL (0) |
54 | #endif |
55 | |
56 | namespace love |
57 | { |
58 | namespace audio |
59 | { |
60 | namespace openal |
61 | { |
62 | |
63 | class Effect : public love::audio::Effect |
64 | { |
65 | public: |
66 | Effect(); |
67 | Effect(const Effect &s); |
68 | virtual ~Effect(); |
69 | virtual Effect *clone(); |
70 | ALuint getEffect() const; |
71 | virtual bool setParams(const std::map<Parameter, float> ¶ms); |
72 | virtual const std::map<Parameter, float> &getParams() const; |
73 | |
74 | private: |
75 | bool generateEffect(); |
76 | void deleteEffect(); |
77 | float getValue(Parameter in, float def) const; |
78 | int getValue(Parameter in, int def) const; |
79 | |
80 | ALuint effect = AL_EFFECT_NULL; |
81 | std::map<Parameter, float> params; |
82 | //static std::map<Phoneme, ALint> phonemeMap; |
83 | }; |
84 | |
85 | } //openal |
86 | } //audio |
87 | } //love |
88 | |
89 | #endif //LOVE_AUDIO_OPENAL_EFFECTS_H |
90 | |