-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathaudioeffect.cpp
More file actions
71 lines (61 loc) · 1.46 KB
/
audioeffect.cpp
File metadata and controls
71 lines (61 loc) · 1.46 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
62
63
64
65
66
67
68
69
70
71
#include <fea/audio/audioeffect.hpp>
#include <fea/assert.hpp>
#include <utility>
#if !defined(FEA_NO_EFX)
#include "efx.h"
#endif
namespace fea
{
AudioEffect::AudioEffect() :
mGain(1.0f),
mAutoSend(true)
{
#if !defined(FEA_NO_EFX)
alGenEffects(1, &mEffectId);
#endif
}
AudioEffect::AudioEffect(AudioEffect&& other) :
mEffectId(0),
mGain(1.0f),
mAutoSend(true)
{
std::swap(mEffectId, other.mEffectId);
std::swap(mGain, other.mGain);
std::swap(mAutoSend, other.mAutoSend);
}
AudioEffect& AudioEffect::operator=(AudioEffect&& other)
{
std::swap(mEffectId, other.mEffectId);
std::swap(mGain, other.mGain);
std::swap(mAutoSend, other.mAutoSend);
return *this;
}
AudioEffect::~AudioEffect()
{
#if !defined(FEA_NO_EFX)
if(mEffectId != 0)
alDeleteEffects(1, &mEffectId);
#endif
}
ALuint AudioEffect::getEffectId() const
{
return mEffectId;
}
void AudioEffect::setEffectGain(float gain)
{
FEA_ASSERT(gain >= 0.0f && gain <= 1.0f, "Effect gain must be in the range of 0.0f and 1.0f");
mGain = gain;
}
float AudioEffect::getEffectGain() const
{
return mGain;
}
void AudioEffect::setAutoAdjustments(bool enabled)
{
mAutoSend = enabled;
}
bool AudioEffect::getAutoAdjustments() const
{
return mAutoSend;
}
}