18 AuxiliaryEffectSlotImpl
*mSlot
;
21 SendProps(ALuint send
, AuxiliaryEffectSlotImpl
*slot
)
22 : mSendIdx(send
), mSlot(slot
), mFilter(AL_FILTER_NULL
)
24 SendProps(ALuint send
, ALuint filter
) : mSendIdx(send
), mSlot(0), mFilter(filter
)
26 SendProps(ALuint send
, AuxiliaryEffectSlotImpl
*slot
, ALuint filter
)
27 : mSendIdx(send
), mSlot(slot
), mFilter(filter
)
32 ContextImpl
*const mContext
;
36 UniquePtr
<ALBufferStream
> mStream
;
38 SourceGroupImpl
*mGroup
;
42 std::chrono::steady_clock::time_point mLastFadeTime
;
43 std::chrono::steady_clock::time_point mFadeTimeTarget
;
44 ALfloat mFadeGainTarget
;
47 mutable std::mutex mMutex
;
48 std::atomic
<bool> mIsAsync
;
50 std::atomic
<bool> mPaused
;
54 ALfloat mMinGain
, mMaxGain
;
55 ALfloat mRefDist
, mMaxDist
;
59 Vector3 mOrientation
[2];
60 ALfloat mConeInnerAngle
, mConeOuterAngle
;
61 ALfloat mConeOuterGain
, mConeOuterGainHF
;
62 ALfloat mRolloffFactor
, mRoomRolloffFactor
;
63 ALfloat mDopplerFactor
;
64 ALfloat mAirAbsorptionFactor
;
66 ALfloat mStereoAngles
[2];
67 Spatialize mSpatialize
;
71 bool mDryGainHFAuto
: 1;
72 bool mWetGainAuto
: 1;
73 bool mWetGainHFAuto
: 1;
76 Vector
<SendProps
> mEffectSlots
;
80 void resetProperties();
81 void applyProperties(bool looping
, ALuint offset
) const;
83 ALint
refillBufferStream();
85 void setFilterParams(ALuint
&filterid
, const FilterParams
¶ms
);
88 SourceImpl(ContextImpl
*context
);
91 ALuint
getId() const { return mId
; }
93 bool checkPending(SharedFuture
<Buffer
> &future
);
94 bool fadeUpdate(std::chrono::steady_clock::time_point cur_fade_time
);
95 bool playUpdate(ALuint id
);
100 void groupPropUpdate(ALfloat gain
, ALfloat pitch
);
103 void unsetPaused() { mPaused
= false; }
104 void makeStopped(bool dolock
=true);
106 void play(Buffer buffer
);
107 void play(SharedPtr
<Decoder
>&& decoder
, ALuint chunk_len
, ALuint queue_size
);
108 void play(SharedFuture
<Buffer
>&& future_buffer
);
110 void fadeOutToStop(ALfloat gain
, std::chrono::milliseconds duration
);
114 bool isPending() const;
115 bool isPlaying() const;
116 bool isPaused() const;
118 void setGroup(SourceGroup group
);
119 SourceGroup
getGroup() const { return SourceGroup(mGroup
); }
121 void setPriority(ALuint priority
);
122 ALuint
getPriority() const { return mPriority
; }
124 void setOffset(uint64_t offset
);
125 std::pair
<uint64_t,std::chrono::nanoseconds
> getSampleOffsetLatency() const;
126 std::pair
<Seconds
,Seconds
> getSecOffsetLatency() const;
128 void setLooping(bool looping
);
129 bool getLooping() const { return mLooping
; }
131 void setPitch(ALfloat pitch
);
132 ALfloat
getPitch() const { return mPitch
; }
134 void setGain(ALfloat gain
);
135 ALfloat
getGain() const { return mGain
; }
137 void setGainRange(ALfloat mingain
, ALfloat maxgain
);
138 std::pair
<ALfloat
,ALfloat
> getGainRange() const
139 { return {mMinGain
, mMaxGain
}; }
141 void setDistanceRange(ALfloat refdist
, ALfloat maxdist
);
142 std::pair
<ALfloat
,ALfloat
> getDistanceRange() const
143 { return {mRefDist
, mMaxDist
}; }
145 void set3DParameters(const Vector3
&position
, const Vector3
&velocity
, const Vector3
&direction
);
146 void set3DParameters(const Vector3
&position
, const Vector3
&velocity
, const std::pair
<Vector3
,Vector3
> &orientation
);
148 void setPosition(ALfloat x
, ALfloat y
, ALfloat z
);
149 void setPosition(const ALfloat
*pos
);
150 Vector3
getPosition() const { return mPosition
; }
152 void setVelocity(ALfloat x
, ALfloat y
, ALfloat z
);
153 void setVelocity(const ALfloat
*vel
);
154 Vector3
getVelocity() const { return mVelocity
; }
156 void setDirection(ALfloat x
, ALfloat y
, ALfloat z
);
157 void setDirection(const ALfloat
*dir
);
158 Vector3
getDirection() const { return mDirection
; }
160 void setOrientation(ALfloat x1
, ALfloat y1
, ALfloat z1
, ALfloat x2
, ALfloat y2
, ALfloat z2
);
161 void setOrientation(const ALfloat
*at
, const ALfloat
*up
);
162 void setOrientation(const ALfloat
*ori
);
163 std::pair
<Vector3
,Vector3
> getOrientation() const
164 { return {mOrientation
[0], mOrientation
[1]}; }
166 void setConeAngles(ALfloat inner
, ALfloat outer
);
167 std::pair
<ALfloat
,ALfloat
> getConeAngles() const
168 { return {mConeInnerAngle
, mConeOuterAngle
}; }
170 void setOuterConeGains(ALfloat gain
, ALfloat gainhf
=1.0f
);
171 std::pair
<ALfloat
,ALfloat
> getOuterConeGains() const
172 { return {mConeOuterGain
, mConeOuterGainHF
}; }
174 void setRolloffFactors(ALfloat factor
, ALfloat roomfactor
=0.0f
);
175 std::pair
<ALfloat
,ALfloat
> getRolloffFactors() const
176 { return {mRolloffFactor
, mRoomRolloffFactor
}; }
178 void setDopplerFactor(ALfloat factor
);
179 ALfloat
getDopplerFactor() const { return mDopplerFactor
; }
181 void setRelative(bool relative
);
182 bool getRelative() const { return mRelative
; }
184 void setRadius(ALfloat radius
);
185 ALfloat
getRadius() const { return mRadius
; }
187 void setStereoAngles(ALfloat leftAngle
, ALfloat rightAngle
);
188 std::pair
<ALfloat
,ALfloat
> getStereoAngles() const
189 { return std::make_pair(mStereoAngles
[0], mStereoAngles
[1]); }
191 void set3DSpatialize(Spatialize spatialize
);
192 Spatialize
get3DSpatialize() const { return mSpatialize
; }
194 void setResamplerIndex(ALsizei index
);
195 ALsizei
getResamplerIndex() const { return mResampler
; }
197 void setAirAbsorptionFactor(ALfloat factor
);
198 ALfloat
getAirAbsorptionFactor() const { return mAirAbsorptionFactor
; }
200 void setGainAuto(bool directhf
, bool send
, bool sendhf
);
201 std::tuple
<bool,bool,bool> getGainAuto() const
202 { return std::make_tuple(mDryGainHFAuto
, mWetGainAuto
, mWetGainHFAuto
); }
204 void setDirectFilter(const FilterParams
&filter
);
205 void setSendFilter(ALuint send
, const FilterParams
&filter
);
206 void setAuxiliarySend(AuxiliaryEffectSlot slot
, ALuint send
);
207 void setAuxiliarySendFilter(AuxiliaryEffectSlot slot
, ALuint send
, const FilterParams
&filter
);
213 struct SourceBufferUpdateEntry
{
217 struct SourceStreamUpdateEntry
{
223 #endif /* SOURCE_H */