6 #include <unordered_map>
18 AuxiliaryEffectSlotImpl
*mSlot
;
21 SendProps(AuxiliaryEffectSlotImpl
*slot
) : mSlot(slot
), mFilter(AL_FILTER_NULL
)
23 SendProps(ALuint filter
) : mSlot(0), mFilter(filter
)
25 SendProps(AuxiliaryEffectSlotImpl
*slot
, ALuint filter
) : mSlot(slot
), mFilter(filter
)
28 typedef std::unordered_map
<ALuint
,SendProps
> SendPropMap
;
31 ContextImpl
*const mContext
;
35 UniquePtr
<ALBufferStream
> mStream
;
37 SourceGroupImpl
*mGroup
;
41 mutable std::mutex mMutex
;
42 std::atomic
<bool> mIsAsync
;
44 std::atomic
<bool> mPaused
;
48 ALfloat mMinGain
, mMaxGain
;
49 ALfloat mRefDist
, mMaxDist
;
53 Vector3 mOrientation
[2];
54 ALfloat mConeInnerAngle
, mConeOuterAngle
;
55 ALfloat mConeOuterGain
, mConeOuterGainHF
;
56 ALfloat mRolloffFactor
, mRoomRolloffFactor
;
57 ALfloat mDopplerFactor
;
58 ALfloat mAirAbsorptionFactor
;
60 ALfloat mStereoAngles
[2];
61 Spatialize mSpatialize
;
65 bool mDryGainHFAuto
: 1;
66 bool mWetGainAuto
: 1;
67 bool mWetGainHFAuto
: 1;
70 SendPropMap mEffectSlots
;
74 void resetProperties();
75 void applyProperties(bool looping
, ALuint offset
) const;
77 ALint
refillBufferStream();
79 void setFilterParams(ALuint
&filterid
, const FilterParams
¶ms
);
82 SourceImpl(ContextImpl
*context
);
85 ALuint
getId() const { return mId
; }
87 bool playUpdate(ALuint id
);
91 void setGroup(SourceGroupImpl
*group
);
93 void groupPropUpdate(ALfloat gain
, ALfloat pitch
);
96 void unsetPaused() { mPaused
= false; }
97 void makeStopped(bool dolock
=true);
99 void play(Buffer buffer
);
100 void play(SharedPtr
<Decoder
> decoder
, ALuint updatelen
, ALuint queuesize
);
105 bool isPlaying() const;
106 bool isPaused() const;
108 void setPriority(ALuint priority
);
109 ALuint
getPriority() const { return mPriority
; }
111 void setOffset(uint64_t offset
);
112 std::pair
<uint64_t,std::chrono::nanoseconds
> getSampleOffsetLatency() const;
113 std::pair
<Seconds
,Seconds
> getSecOffsetLatency() const;
115 void setLooping(bool looping
);
116 bool getLooping() const { return mLooping
; }
118 void setPitch(ALfloat pitch
);
119 ALfloat
getPitch() const { return mPitch
; }
121 void setGain(ALfloat gain
);
122 ALfloat
getGain() const { return mGain
; }
124 void setGainRange(ALfloat mingain
, ALfloat maxgain
);
125 std::pair
<ALfloat
,ALfloat
> getGainRange() const
126 { return {mMinGain
, mMaxGain
}; }
128 void setDistanceRange(ALfloat refdist
, ALfloat maxdist
);
129 std::pair
<ALfloat
,ALfloat
> getDistanceRange() const
130 { return {mRefDist
, mMaxDist
}; }
132 void set3DParameters(const Vector3
&position
, const Vector3
&velocity
, const Vector3
&direction
);
133 void set3DParameters(const Vector3
&position
, const Vector3
&velocity
, std::pair
<Vector3
,Vector3
> orientation
);
135 void setPosition(ALfloat x
, ALfloat y
, ALfloat z
);
136 void setPosition(const ALfloat
*pos
);
137 Vector3
getPosition() const { return mPosition
; }
139 void setVelocity(ALfloat x
, ALfloat y
, ALfloat z
);
140 void setVelocity(const ALfloat
*vel
);
141 Vector3
getVelocity() const { return mVelocity
; }
143 void setDirection(ALfloat x
, ALfloat y
, ALfloat z
);
144 void setDirection(const ALfloat
*dir
);
145 Vector3
getDirection() const { return mDirection
; }
147 void setOrientation(ALfloat x1
, ALfloat y1
, ALfloat z1
, ALfloat x2
, ALfloat y2
, ALfloat z2
);
148 void setOrientation(const ALfloat
*at
, const ALfloat
*up
);
149 void setOrientation(const ALfloat
*ori
);
150 std::pair
<Vector3
,Vector3
> getOrientation() const
151 { return {mOrientation
[0], mOrientation
[1]}; }
153 void setConeAngles(ALfloat inner
, ALfloat outer
);
154 std::pair
<ALfloat
,ALfloat
> getConeAngles() const
155 { return {mConeInnerAngle
, mConeOuterAngle
}; }
157 void setOuterConeGains(ALfloat gain
, ALfloat gainhf
=1.0f
);
158 std::pair
<ALfloat
,ALfloat
> getOuterConeGains() const
159 { return {mConeOuterGain
, mConeOuterGainHF
}; }
161 void setRolloffFactors(ALfloat factor
, ALfloat roomfactor
=0.0f
);
162 std::pair
<ALfloat
,ALfloat
> getRolloffFactors() const
163 { return {mRolloffFactor
, mRoomRolloffFactor
}; }
165 void setDopplerFactor(ALfloat factor
);
166 ALfloat
getDopplerFactor() const { return mDopplerFactor
; }
168 void setRelative(bool relative
);
169 bool getRelative() const { return mRelative
; }
171 void setRadius(ALfloat radius
);
172 ALfloat
getRadius() const { return mRadius
; }
174 void setStereoAngles(ALfloat leftAngle
, ALfloat rightAngle
);
175 std::pair
<ALfloat
,ALfloat
> getStereoAngles() const
176 { return std::make_pair(mStereoAngles
[0], mStereoAngles
[1]); }
178 void set3DSpatialize(Spatialize spatialize
);
179 Spatialize
get3DSpatialize() const { return mSpatialize
; }
181 void setResamplerIndex(ALsizei index
);
182 ALsizei
getResamplerIndex() const { return mResampler
; }
184 void setAirAbsorptionFactor(ALfloat factor
);
185 ALfloat
getAirAbsorptionFactor() const { return mAirAbsorptionFactor
; }
187 void setGainAuto(bool directhf
, bool send
, bool sendhf
);
188 std::tuple
<bool,bool,bool> getGainAuto() const
189 { return std::make_tuple(mDryGainHFAuto
, mWetGainAuto
, mWetGainHFAuto
); }
191 void setDirectFilter(const FilterParams
&filter
);
192 void setSendFilter(ALuint send
, const FilterParams
&filter
);
193 void setAuxiliarySend(AuxiliaryEffectSlot slot
, ALuint send
);
194 void setAuxiliarySendFilter(AuxiliaryEffectSlot slot
, ALuint send
, const FilterParams
&filter
);
200 struct SourceBufferUpdateEntry
{
204 struct SourceStreamUpdateEntry
{
210 #endif /* SOURCE_H */