1 /* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */
2 
3 #ifndef _EFX_H_
4 #define _EFX_H_
5 
6 #include <string>
7 #include <map>
8 #include <al.h>
9 #include <alc.h>
10 #include <efx.h>
11 
12 struct EAXSfxProps;
13 
14 /// Default sound effects system implementation
15 class CEFX
16 {
17 public:
18 	CEFX(ALCdevice* device);
19 	~CEFX();
20 
21 	void SetPreset(std::string name, bool verbose = true, bool commit = true);
22 	void CommitEffects();
23 
24 	void Enable();
25 	void Disable();
26 
27 	void SetHeightRolloffModifer(const float& mod);
28 
29 public:
30 	/// @see ConfigHandler::ConfigNotifyCallback
31 	void ConfigNotify(const std::string& key, const std::string& value);
32 
33 	void SetAirAbsorptionFactor(ALfloat value);
GetAirAbsorptionFactor()34 	ALfloat GetAirAbsorptionFactor() const { return airAbsorptionFactor; }
35 
36 
37 	bool enabled;
38 	bool supported;
39 
40 	EAXSfxProps* sfxProperties;
41 	ALuint sfxSlot;
42 	ALuint sfxReverb;
43 	ALuint sfxFilter;
44 private:
45 	ALfloat airAbsorptionFactor;
46 public:
47 
48 	int updates;
49 
50 private:
51 	//! reduce the rolloff when the camera is height above the ground (so we still hear something in tab mode or far zoom)
52 	static float heightRolloffModifier;
53 
54 private:
55 	//! some more information about the supported features
56 	std::map<ALuint, bool> effectsSupported;
57 	std::map<ALuint, bool> filtersSupported;
58 	int maxSlots;
59 	ALuint maxSlotsPerSource;
60 };
61 
62 //! init in Sound.cpp
63 extern CEFX* efx;
64 
65 #endif // _EFX_H_
66