File: EFXPresets.h

package info (click to toggle)
spring 106.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 55,316 kB
  • sloc: cpp: 543,954; ansic: 44,800; python: 12,575; java: 12,201; awk: 5,889; sh: 1,796; asm: 1,546; xml: 655; perl: 405; php: 211; objc: 194; makefile: 76; sed: 2
file content (91 lines) | stat: -rw-r--r-- 3,048 bytes parent folder | download | duplicates (4)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */

#ifndef _EFX_PRESETS_H_
#define _EFX_PRESETS_H_

#include <string>

#include <al.h>
#include <efx.h>

#include "System/float3.h"
#include "System/UnorderedMap.hpp"

struct EAXSfxProps {
	EAXSfxProps() {}
	EAXSfxProps(
		ALfloat _density,
		ALfloat _diffusion,
		ALfloat _gain,
		ALfloat _gainHF,
		ALfloat _gainLF,
		ALfloat _decayTime,
		ALfloat _decayHFRatio,
		ALfloat _decayLFRatio,
		ALfloat _reflectionGain,
		ALfloat _reflectionDelay,
		float3 _reflectionPan,
		ALfloat _lateReverbGain,
		ALfloat _lateReverbDelay,
		float3 _lateReverbPan,
		ALfloat _echoTime,
		ALfloat _echoDepth,
		ALfloat _modTime,
		ALfloat _modDepth,
		ALfloat _airAbsorptionGainHF,
		ALfloat _hfReference,
		ALfloat _lfReference,
		ALfloat _roomRollOffFactor,
		ALboolean _decayHFLimit
	) {
		reverb_props_f[AL_EAXREVERB_DENSITY] = _density;
		reverb_props_f[AL_EAXREVERB_DIFFUSION] = _diffusion;
		reverb_props_f[AL_EAXREVERB_GAIN] = _gain;
		reverb_props_f[AL_EAXREVERB_GAINHF] = _gainHF;
		reverb_props_f[AL_EAXREVERB_GAINLF] = _gainLF;
		reverb_props_f[AL_EAXREVERB_DECAY_TIME] = _decayTime;
		reverb_props_i[AL_EAXREVERB_DECAY_HFLIMIT] = _decayHFLimit;
		reverb_props_f[AL_EAXREVERB_DECAY_HFRATIO] = _decayHFRatio;
		reverb_props_f[AL_EAXREVERB_DECAY_LFRATIO] = _decayLFRatio;
		reverb_props_f[AL_EAXREVERB_REFLECTIONS_GAIN] = _reflectionGain;
		reverb_props_f[AL_EAXREVERB_REFLECTIONS_DELAY] = _reflectionDelay;
		reverb_props_v[AL_EAXREVERB_REFLECTIONS_PAN] = _reflectionPan;
		reverb_props_f[AL_EAXREVERB_LATE_REVERB_GAIN] = _lateReverbGain;
		reverb_props_f[AL_EAXREVERB_LATE_REVERB_DELAY] = _lateReverbDelay;
		reverb_props_v[AL_EAXREVERB_LATE_REVERB_PAN] = _lateReverbPan;
		reverb_props_f[AL_EAXREVERB_ECHO_TIME] = _echoTime;
		reverb_props_f[AL_EAXREVERB_ECHO_DEPTH] = _echoDepth;
		reverb_props_f[AL_EAXREVERB_MODULATION_TIME] = _modTime;
		reverb_props_f[AL_EAXREVERB_MODULATION_DEPTH] = _modDepth;
		reverb_props_f[AL_EAXREVERB_AIR_ABSORPTION_GAINHF] = _airAbsorptionGainHF;
		reverb_props_f[AL_EAXREVERB_HFREFERENCE] = _hfReference;
		reverb_props_f[AL_EAXREVERB_LFREFERENCE] = _lfReference;
		reverb_props_f[AL_EAXREVERB_ROOM_ROLLOFF_FACTOR] = _roomRollOffFactor;

		filter_props_f[AL_LOWPASS_GAIN] = 1.0f;
		filter_props_f[AL_LOWPASS_GAINHF] = 1.0f;
	}

	spring::unsynced_map<ALuint, ALfloat> reverb_props_f;
	spring::unsynced_map<ALuint, ALint>   reverb_props_i;
	spring::unsynced_map<ALuint, float3>  reverb_props_v;
	spring::unsynced_map<ALuint, ALfloat> filter_props_f;
};

namespace EFXParamTypes {
	enum {
		FLOAT,
		VECTOR,
		BOOL
	};
}

extern spring::unsynced_map<std::string, EAXSfxProps> eaxPresets;

extern spring::unsynced_map<ALuint, unsigned> alParamType;
extern spring::unsynced_map<std::string, ALuint> nameToALParam;
extern spring::unsynced_map<ALuint, std::string> alParamToName;
extern spring::unsynced_map<std::string, ALuint> nameToALFilterParam;
extern spring::unsynced_map<ALuint, std::string> alFilterParamToName;

#endif // _EFX_PRESETS_H_