Use return value optimization for getSec/SampleOffsetLatency
[alure.git] / src / auxeffectslot.h
blob52c1527778725287036b52c84c2daa5be6edc5c9
1 #ifndef AUXEFFECTSLOT_H
2 #define AUXEFFECTSLOT_H
4 #include <algorithm>
6 #include "main.h"
8 #include "al.h"
10 #include "refcount.h"
12 namespace alure {
14 class ContextImpl;
16 inline bool operator==(const SourceSend &lhs, const SourceSend &rhs)
17 { return lhs.mSource == rhs.mSource && lhs.mSend == rhs.mSend; }
19 class AuxiliaryEffectSlotImpl {
20 ContextImpl *const mContext;
21 ALuint mId;
23 Vector<SourceSend> mSourceSends;
25 public:
26 AuxiliaryEffectSlotImpl(ContextImpl *context, ALuint id)
27 : mContext(context), mId(id)
28 { }
30 void addSourceSend(Source source, ALuint send)
31 { mSourceSends.emplace_back((SourceSend){source, send}); }
32 void removeSourceSend(Source source, ALuint send)
34 auto iter = std::find(mSourceSends.cbegin(), mSourceSends.cend(), SourceSend{source, send});
35 if(iter != mSourceSends.cend()) mSourceSends.erase(iter);
38 ContextImpl *getContext() { return mContext; }
39 const ALuint &getId() const { return mId; }
41 void setGain(ALfloat gain);
42 void setSendAuto(bool sendauto);
44 void applyEffect(Effect effect);
46 void release();
48 Vector<SourceSend> getSourceSends() const { return mSourceSends; }
50 bool isInUse() const { return (mSourceSends.size() > 0); }
53 } // namespace alure
55 #endif /* AUXEFFECTSLOT_H */