18 #include "auxeffectslot.h"
19 #include "sourcegroup.h"
24 class ALBufferStream
{
25 SharedPtr
<Decoder
> mDecoder
;
37 Vector
<ALuint
> mBufferIds
;
41 std::pair
<uint64_t,uint64_t> mLoopPts
;
43 std::atomic
<bool> mDone
;
46 ALBufferStream(SharedPtr
<Decoder
> decoder
, ALuint updatelen
, ALuint numupdates
)
47 : mDecoder(decoder
), mUpdateLen(updatelen
), mNumUpdates(numupdates
),
48 mFormat(AL_NONE
), mFrequency(0), mFrameSize(0), mSilence(0),
49 mCurrentIdx(0), mSamplePos(0), mLoopPts
{0,0}, mHasLooped(false),
54 if(!mBufferIds
.empty())
56 alDeleteBuffers(mBufferIds
.size(), mBufferIds
.data());
61 uint64_t getLength() const { return mDecoder
->getLength(); }
62 uint64_t getPosition() const { return mSamplePos
; }
64 ALuint
getNumUpdates() const { return mNumUpdates
; }
65 ALuint
getUpdateLength() const { return mUpdateLen
; }
67 ALuint
getFrequency() const { return mFrequency
; }
69 bool seek(uint64_t pos
)
71 if(!mDecoder
->seek(pos
))
75 mDone
.store(false, std::memory_order_release
);
81 ALuint srate
= mDecoder
->getFrequency();
82 ChannelConfig chans
= mDecoder
->getChannelConfig();
83 SampleType type
= mDecoder
->getSampleType();
85 mLoopPts
= mDecoder
->getLoopPoints();
86 if(mLoopPts
.first
>= mLoopPts
.second
)
89 mLoopPts
.second
= std::numeric_limits
<uint64_t>::max();
93 mFrameSize
= FramesToBytes(1, chans
, type
);
94 mFormat
= GetFormat(chans
, type
);
95 if(mFormat
== AL_NONE
)
97 std::stringstream sstr
;
98 sstr
<< "Format not supported ("<<GetSampleTypeName(type
)<<", "<<GetChannelConfigName(chans
)<<")";
99 throw std::runtime_error(sstr
.str());
102 mData
.resize(mUpdateLen
* mFrameSize
);
103 if(type
== SampleType::UInt8
) mSilence
= 0x80;
104 else if(type
== SampleType::Mulaw
) mSilence
= 0x7f;
105 else mSilence
= 0x00;
107 mBufferIds
.assign(mNumUpdates
, 0);
108 alGenBuffers(mBufferIds
.size(), mBufferIds
.data());
111 int64_t getLoopStart() const { return mLoopPts
.first
; }
112 int64_t getLoopEnd() const { return mLoopPts
.second
; }
114 bool hasLooped() const { return mHasLooped
; }
115 bool hasMoreData() const { return !mDone
.load(std::memory_order_acquire
); }
116 bool streamMoreData(ALuint srcid
, bool loop
)
118 if(mDone
.load(std::memory_order_acquire
))
122 ALuint len
= mUpdateLen
;
123 if(loop
&& mSamplePos
<= mLoopPts
.second
)
124 len
= std::min
<uint64_t>(len
, mLoopPts
.second
- mSamplePos
);
128 frames
= mDecoder
->read(mData
.data(), len
);
129 mSamplePos
+= frames
;
130 if(frames
< mUpdateLen
&& loop
&& mSamplePos
> 0)
132 if(mSamplePos
< mLoopPts
.second
)
134 mLoopPts
.second
= mSamplePos
;
135 mLoopPts
.first
= std::min(mLoopPts
.first
, mLoopPts
.second
-1);
139 if(!mDecoder
->seek(mLoopPts
.first
))
141 mSamplePos
= mLoopPts
.first
;
144 len
= std::min
<uint64_t>(mUpdateLen
-frames
, mLoopPts
.second
-mLoopPts
.first
);
145 ALuint got
= mDecoder
->read(&mData
[frames
*mFrameSize
], len
);
149 } while(frames
< mUpdateLen
);
151 if(frames
< mUpdateLen
)
153 mDone
.store(true, std::memory_order_release
);
154 if(frames
== 0) return false;
155 mSamplePos
+= mUpdateLen
- frames
;
156 std::fill(mData
.begin() + frames
*mFrameSize
, mData
.end(), mSilence
);
159 alBufferData(mBufferIds
[mCurrentIdx
], mFormat
, mData
.data(), mData
.size(), mFrequency
);
160 alSourceQueueBuffers(srcid
, 1, &mBufferIds
[mCurrentIdx
]);
161 mCurrentIdx
= (mCurrentIdx
+1) % mBufferIds
.size();
167 SourceImpl::SourceImpl(ContextImpl
*context
)
168 : mContext(context
), mId(0), mBuffer(0), mGroup(nullptr), mIsAsync(false),
169 mDirectFilter(AL_FILTER_NULL
)
174 SourceImpl::~SourceImpl()
179 void SourceImpl::resetProperties()
182 mGroup
->removeSource(Source(this));
187 mFadeGainTarget
= 1.0f
;
190 mPaused
.store(false, std::memory_order_release
);
197 mMaxDist
= std::numeric_limits
<float>::max();
198 mPosition
= Vector3(0.0f
);
199 mVelocity
= Vector3(0.0f
);
200 mDirection
= Vector3(0.0f
);
201 mOrientation
[0] = Vector3(0.0f
, 0.0f
, -1.0f
);
202 mOrientation
[1] = Vector3(0.0f
, 1.0f
, 0.0f
);
203 mConeInnerAngle
= 360.0f
;
204 mConeOuterAngle
= 360.0f
;
205 mConeOuterGain
= 0.0f
;
206 mConeOuterGainHF
= 1.0f
;
207 mRolloffFactor
= 1.0f
;
208 mRoomRolloffFactor
= 0.0f
;
209 mDopplerFactor
= 1.0f
;
210 mAirAbsorptionFactor
= 0.0f
;
212 mStereoAngles
[0] = F_PI
/ 6.0f
;
213 mStereoAngles
[1] = -F_PI
/ 6.0f
;
214 mSpatialize
= Spatialize::Auto
;
215 mResampler
= mContext
->hasExtension(AL::SOFT_source_resampler
) ?
216 alGetInteger(AL_DEFAULT_RESAMPLER_SOFT
) : 0;
219 mDryGainHFAuto
= true;
221 mWetGainHFAuto
= true;
223 mContext
->alDeleteFilters(1, &mDirectFilter
);
225 for(auto &i
: mEffectSlots
)
228 i
.second
.mSlot
->removeSourceSend({Source(this), i
.first
});
230 mContext
->alDeleteFilters(1, &i
.second
.mFilter
);
232 mEffectSlots
.clear();
237 void SourceImpl::applyProperties(bool looping
, ALuint offset
) const
239 alSourcei(mId
, AL_LOOPING
, looping
? AL_TRUE
: AL_FALSE
);
240 alSourcei(mId
, AL_SAMPLE_OFFSET
, offset
);
241 alSourcef(mId
, AL_PITCH
, mPitch
* mGroupPitch
);
242 alSourcef(mId
, AL_GAIN
, mGain
* mGroupGain
* mFadeGain
);
243 alSourcef(mId
, AL_MIN_GAIN
, mMinGain
);
244 alSourcef(mId
, AL_MAX_GAIN
, mMaxGain
);
245 alSourcef(mId
, AL_REFERENCE_DISTANCE
, mRefDist
);
246 alSourcef(mId
, AL_MAX_DISTANCE
, mMaxDist
);
247 alSourcefv(mId
, AL_POSITION
, mPosition
.getPtr());
248 alSourcefv(mId
, AL_VELOCITY
, mVelocity
.getPtr());
249 alSourcefv(mId
, AL_DIRECTION
, mDirection
.getPtr());
250 if(mContext
->hasExtension(AL::EXT_BFORMAT
))
251 alSourcefv(mId
, AL_ORIENTATION
, &mOrientation
[0][0]);
252 alSourcef(mId
, AL_CONE_INNER_ANGLE
, mConeInnerAngle
);
253 alSourcef(mId
, AL_CONE_OUTER_ANGLE
, mConeOuterAngle
);
254 alSourcef(mId
, AL_CONE_OUTER_GAIN
, mConeOuterGain
);
255 alSourcef(mId
, AL_ROLLOFF_FACTOR
, mRolloffFactor
);
256 alSourcef(mId
, AL_DOPPLER_FACTOR
, mDopplerFactor
);
257 if(mContext
->hasExtension(AL::EXT_SOURCE_RADIUS
))
258 alSourcef(mId
, AL_SOURCE_RADIUS
, mRadius
);
259 if(mContext
->hasExtension(AL::EXT_STEREO_ANGLES
))
260 alSourcefv(mId
, AL_STEREO_ANGLES
, mStereoAngles
);
261 if(mContext
->hasExtension(AL::SOFT_source_spatialize
))
262 alSourcei(mId
, AL_SOURCE_SPATIALIZE_SOFT
, (ALint
)mSpatialize
);
263 if(mContext
->hasExtension(AL::SOFT_source_resampler
))
264 alSourcei(mId
, AL_SOURCE_RESAMPLER_SOFT
, mResampler
);
265 alSourcei(mId
, AL_SOURCE_RELATIVE
, mRelative
? AL_TRUE
: AL_FALSE
);
266 if(mContext
->hasExtension(AL::EXT_EFX
))
268 alSourcef(mId
, AL_CONE_OUTER_GAINHF
, mConeOuterGainHF
);
269 alSourcef(mId
, AL_ROOM_ROLLOFF_FACTOR
, mRoomRolloffFactor
);
270 alSourcef(mId
, AL_AIR_ABSORPTION_FACTOR
, mAirAbsorptionFactor
);
271 alSourcei(mId
, AL_DIRECT_FILTER_GAINHF_AUTO
, mDryGainHFAuto
? AL_TRUE
: AL_FALSE
);
272 alSourcei(mId
, AL_AUXILIARY_SEND_FILTER_GAIN_AUTO
, mWetGainAuto
? AL_TRUE
: AL_FALSE
);
273 alSourcei(mId
, AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO
, mWetGainHFAuto
? AL_TRUE
: AL_FALSE
);
274 alSourcei(mId
, AL_DIRECT_FILTER
, mDirectFilter
);
275 for(const auto &i
: mEffectSlots
)
277 ALuint slotid
= (i
.second
.mSlot
? i
.second
.mSlot
->getId() : 0);
278 alSource3i(mId
, AL_AUXILIARY_SEND_FILTER
, slotid
, i
.first
, i
.second
.mFilter
);
284 void SourceImpl::setGroup(SourceGroupImpl
*group
)
287 mGroup
->removeSource(Source(this));
289 mGroupPitch
= mGroup
->getAppliedPitch();
290 mGroupGain
= mGroup
->getAppliedGain();
293 alSourcef(mId
, AL_PITCH
, mPitch
* mGroupPitch
);
294 alSourcef(mId
, AL_GAIN
, mGain
* mGroupGain
* mFadeGain
);
298 void SourceImpl::unsetGroup()
305 alSourcef(mId
, AL_PITCH
, mPitch
* mGroupPitch
);
306 alSourcef(mId
, AL_GAIN
, mGain
* mGroupGain
* mFadeGain
);
310 void SourceImpl::groupPropUpdate(ALfloat gain
, ALfloat pitch
)
314 alSourcef(mId
, AL_PITCH
, mPitch
* pitch
);
315 alSourcef(mId
, AL_GAIN
, mGain
* gain
* mFadeGain
);
322 void SourceImpl::play(Buffer buffer
)
324 BufferImpl
*albuf
= buffer
.getHandle();
325 if(!albuf
) throw std::runtime_error("Buffer is not valid");
326 CheckContext(mContext
);
327 CheckContext(albuf
->getContext());
330 mContext
->removeStream(this);
331 mIsAsync
.store(false, std::memory_order_release
);
333 mFadeGainTarget
= mFadeGain
= 1.0f
;
334 mFadeTimeTarget
= mLastFadeTime
= std::chrono::steady_clock::now();
338 mId
= mContext
->getSourceId(mPriority
);
339 applyProperties(mLooping
, (ALuint
)std::min
<uint64_t>(mOffset
, std::numeric_limits
<ALint
>::max()));
343 mContext
->removeFadingSource(this);
344 mContext
->removePlayingSource(this);
346 alSourcei(mId
, AL_BUFFER
, 0);
347 alSourcei(mId
, AL_LOOPING
, mLooping
? AL_TRUE
: AL_FALSE
);
348 alSourcei(mId
, AL_SAMPLE_OFFSET
, (ALuint
)std::min
<uint64_t>(mOffset
, std::numeric_limits
<ALint
>::max()));
354 mBuffer
->removeSource(Source(this));
356 mBuffer
->addSource(Source(this));
358 alSourcei(mId
, AL_BUFFER
, mBuffer
->getId());
360 mPaused
.store(false, std::memory_order_release
);
361 mContext
->removePendingSource(this);
362 mContext
->addPlayingSource(this, mId
);
365 void SourceImpl::play(SharedPtr
<Decoder
> decoder
, ALuint chunk_len
, ALuint queue_size
)
368 throw std::runtime_error("Update length out of range");
370 throw std::runtime_error("Queue size out of range");
371 CheckContext(mContext
);
373 auto stream
= MakeUnique
<ALBufferStream
>(decoder
, chunk_len
, queue_size
);
377 mContext
->removeStream(this);
378 mIsAsync
.store(false, std::memory_order_release
);
380 mFadeGainTarget
= mFadeGain
= 1.0f
;
381 mFadeTimeTarget
= mLastFadeTime
= std::chrono::steady_clock::now();
385 mId
= mContext
->getSourceId(mPriority
);
386 applyProperties(false, 0);
390 mContext
->removeFadingSource(this);
391 mContext
->removePlayingSource(this);
393 alSourcei(mId
, AL_BUFFER
, 0);
394 alSourcei(mId
, AL_LOOPING
, AL_FALSE
);
395 alSourcei(mId
, AL_SAMPLE_OFFSET
, 0);
400 mBuffer
->removeSource(Source(this));
403 mStream
= std::move(stream
);
405 mStream
->seek(mOffset
);
408 for(ALuint i
= 0;i
< mStream
->getNumUpdates();i
++)
410 if(!mStream
->streamMoreData(mId
, mLooping
))
414 mPaused
.store(false, std::memory_order_release
);
416 mContext
->addStream(this);
417 mIsAsync
.store(true, std::memory_order_release
);
418 mContext
->removePendingSource(this);
419 mContext
->addPlayingSource(this);
422 void SourceImpl::play(SharedFuture
<Buffer
> future_buffer
)
424 if(!future_buffer
.valid())
425 throw std::runtime_error("Invalid future buffer");
426 if(future_buffer
.wait_for(std::chrono::milliseconds::zero()) == std::future_status::ready
)
428 play(future_buffer
.get());
432 CheckContext(mContext
);
434 mContext
->removeFadingSource(this);
435 mContext
->removePlayingSource(this);
438 mFadeGainTarget
= mFadeGain
= 1.0f
;
439 mFadeTimeTarget
= mLastFadeTime
= std::chrono::steady_clock::now();
441 mContext
->addPendingSource(this, std::move(future_buffer
));
445 void SourceImpl::makeStopped(bool dolock
)
450 mContext
->removeStream(this);
452 mContext
->removeStreamNoLock(this);
454 mIsAsync
.store(false, std::memory_order_release
);
459 alSourcei(mId
, AL_BUFFER
, 0);
460 if(mContext
->hasExtension(AL::EXT_EFX
))
462 alSourcei(mId
, AL_DIRECT_FILTER
, AL_FILTER_NULL
);
463 for(auto &i
: mEffectSlots
)
464 alSource3i(mId
, AL_AUXILIARY_SEND_FILTER
, 0, i
.first
, AL_FILTER_NULL
);
466 mContext
->insertSourceId(mId
);
472 mBuffer
->removeSource(Source(this));
475 mPaused
.store(false, std::memory_order_release
);
478 void SourceImpl::stop()
480 CheckContext(mContext
);
481 mContext
->removePendingSource(this);
482 mContext
->removeFadingSource(this);
483 mContext
->removePlayingSource(this);
488 void SourceImpl::fadeOutToStop(ALfloat gain
, std::chrono::milliseconds duration
)
490 if(!(gain
< 1.0f
&& gain
>= 0.0f
))
491 throw std::runtime_error("Fade gain target out of range");
492 if(duration
.count() <= 0)
493 throw std::runtime_error("Fade duration out of range");
494 CheckContext(mContext
);
496 mFadeGainTarget
= std::max
<ALfloat
>(gain
, 0.0001f
);
497 mLastFadeTime
= std::chrono::steady_clock::now();
498 mFadeTimeTarget
= mLastFadeTime
+ duration
;
500 mContext
->addFadingSource(this);
504 void SourceImpl::checkPaused()
506 if(mPaused
.load(std::memory_order_acquire
) || mId
== 0)
510 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
511 // Streaming sources may be in a stopped or initial state if underrun
512 mPaused
.store(state
== AL_PAUSED
|| (mStream
&& mStream
->hasMoreData()),
513 std::memory_order_release
);
516 void SourceImpl::pause()
518 CheckContext(mContext
);
519 if(mPaused
.load(std::memory_order_acquire
))
524 std::lock_guard
<std::mutex
> lock(mMutex
);
527 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
528 // Streaming sources may be in a stopped or initial state if underrun
529 mPaused
.store(state
== AL_PAUSED
|| (mStream
&& mStream
->hasMoreData()),
530 std::memory_order_release
);
534 void SourceImpl::resume()
536 CheckContext(mContext
);
537 if(!mPaused
.load(std::memory_order_acquire
))
542 mPaused
.store(false, std::memory_order_release
);
546 bool SourceImpl::isPending() const
548 CheckContext(mContext
);
549 return mContext
->isPendingSource(this);
552 bool SourceImpl::isPlaying() const
554 CheckContext(mContext
);
555 if(mId
== 0) return false;
558 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
560 throw std::runtime_error("Source state error");
562 return state
== AL_PLAYING
|| (!mPaused
.load(std::memory_order_acquire
) &&
563 mStream
&& mStream
->hasMoreData());
566 bool SourceImpl::isPaused() const
568 CheckContext(mContext
);
569 return mId
!= 0 && mPaused
.load(std::memory_order_acquire
);
573 bool SourceImpl::checkPending(SharedFuture
<Buffer
> &future
)
575 if(future
.wait_for(std::chrono::milliseconds::zero()) != std::future_status::ready
)
578 BufferImpl
*buffer
= future
.get().getHandle();
579 if(Expect
<false>(buffer
->getContext() != mContext
))
584 mId
= mContext
->getSourceId(mPriority
);
585 applyProperties(mLooping
, (ALuint
)std::min
<uint64_t>(mOffset
, std::numeric_limits
<ALint
>::max()));
590 alSourcei(mId
, AL_BUFFER
, 0);
591 alSourcei(mId
, AL_LOOPING
, mLooping
? AL_TRUE
: AL_FALSE
);
592 alSourcei(mId
, AL_SAMPLE_OFFSET
, (ALuint
)std::min
<uint64_t>(mOffset
, std::numeric_limits
<ALint
>::max()));
597 mBuffer
->addSource(Source(this));
599 alSourcei(mId
, AL_BUFFER
, mBuffer
->getId());
601 mPaused
.store(false, std::memory_order_release
);
602 mContext
->addPlayingSource(this, mId
);
606 bool SourceImpl::fadeUpdate(std::chrono::steady_clock::time_point cur_fade_time
)
608 if((cur_fade_time
- mFadeTimeTarget
).count() >= 0)
610 mLastFadeTime
= mFadeTimeTarget
;
612 if(mFadeGainTarget
>= 1.0f
)
615 alSourcef(mId
, AL_GAIN
, mGain
* mGroupGain
);
618 mContext
->removePendingSource(this);
619 mContext
->removePlayingSource(this);
624 float mult
= std::pow(mFadeGainTarget
/mFadeGain
,
625 float(1.0/Seconds(mFadeTimeTarget
-mLastFadeTime
).count())
628 std::chrono::steady_clock::duration duration
= cur_fade_time
- mLastFadeTime
;
629 mLastFadeTime
= cur_fade_time
;
631 float gain
= mFadeGain
* std::pow(mult
, (float)Seconds(duration
).count());
632 if(Expect
<false>(gain
== mFadeGain
))
634 // Ensure the gain keeps moving toward its target, in case precision
635 // loss results in no change with small steps.
636 gain
= std::nextafter(gain
, mFadeGainTarget
);
641 alSourcef(mId
, AL_GAIN
, mGain
* mGroupGain
* mFadeGain
);
645 bool SourceImpl::playUpdate(ALuint id
)
648 alGetSourcei(id
, AL_SOURCE_STATE
, &state
);
649 if(Expect
<true>(state
== AL_PLAYING
|| state
== AL_PAUSED
))
653 mContext
->send(&MessageHandler::sourceStopped
, Source(this));
657 bool SourceImpl::playUpdate()
659 if(Expect
<true>(mIsAsync
.load(std::memory_order_acquire
)))
663 mContext
->send(&MessageHandler::sourceStopped
, Source(this));
668 ALint
SourceImpl::refillBufferStream()
671 alGetSourcei(mId
, AL_BUFFERS_PROCESSED
, &processed
);
675 alSourceUnqueueBuffers(mId
, 1, &buf
);
680 alGetSourcei(mId
, AL_BUFFERS_QUEUED
, &queued
);
681 for(;(ALuint
)queued
< mStream
->getNumUpdates();queued
++)
683 if(!mStream
->streamMoreData(mId
, mLooping
))
690 bool SourceImpl::updateAsync()
692 std::lock_guard
<std::mutex
> lock(mMutex
);
694 ALint queued
= refillBufferStream();
697 mIsAsync
.store(false, std::memory_order_release
);
702 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
703 if(!mPaused
.load(std::memory_order_acquire
))
705 // Make sure the source is still playing if it's not paused.
706 if(state
!= AL_PLAYING
)
711 // Rewind the source to an initial state if it underrun as it was
713 if(state
== AL_STOPPED
)
720 void SourceImpl::setPriority(ALuint priority
)
722 mPriority
= priority
;
726 void SourceImpl::setOffset(uint64_t offset
)
728 CheckContext(mContext
);
737 if(offset
>= std::numeric_limits
<ALint
>::max())
738 throw std::runtime_error("Offset out of range");
740 alSourcei(mId
, AL_SAMPLE_OFFSET
, (ALint
)offset
);
741 if(alGetError() != AL_NO_ERROR
)
742 throw std::runtime_error("Offset out of range");
746 std::lock_guard
<std::mutex
> lock(mMutex
);
747 if(!mStream
->seek(offset
))
748 throw std::runtime_error("Failed to seek to offset");
750 alSourcei(mId
, AL_BUFFER
, 0);
751 ALint queued
= refillBufferStream();
752 if(queued
> 0 && !mPaused
.load(std::memory_order_acquire
))
757 std::pair
<uint64_t,std::chrono::nanoseconds
> SourceImpl::getSampleOffsetLatency() const
759 std::pair
<uint64_t,std::chrono::nanoseconds
> ret
{0, std::chrono::nanoseconds::zero()};
760 CheckContext(mContext
);
761 if(mId
== 0) return ret
;
765 std::lock_guard
<std::mutex
> lock(mMutex
);
766 ALint queued
= 0, state
= -1, srcpos
= 0;
768 alGetSourcei(mId
, AL_BUFFERS_QUEUED
, &queued
);
769 if(mContext
->hasExtension(AL::SOFT_source_latency
))
772 mContext
->alGetSourcei64vSOFT(mId
, AL_SAMPLE_OFFSET_LATENCY_SOFT
, val
);
774 ret
.second
= std::chrono::nanoseconds(val
[1]);
777 alGetSourcei(mId
, AL_SAMPLE_OFFSET
, &srcpos
);
778 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
780 int64_t streampos
= mStream
->getPosition();
781 if(state
!= AL_STOPPED
)
783 // The amount of samples in the queue waiting to play
784 ALuint inqueue
= queued
*mStream
->getUpdateLength() - srcpos
;
785 if(!mStream
->hasLooped())
787 // A non-looped stream should never have more samples queued
788 // than have been read...
789 streampos
= std::max
<int64_t>(streampos
, inqueue
) - inqueue
;
793 streampos
-= inqueue
;
794 int64_t looplen
= mStream
->getLoopEnd() - mStream
->getLoopStart();
795 while(streampos
< mStream
->getLoopStart())
796 streampos
+= looplen
;
800 ret
.first
= streampos
;
805 if(mContext
->hasExtension(AL::SOFT_source_latency
))
808 mContext
->alGetSourcei64vSOFT(mId
, AL_SAMPLE_OFFSET_LATENCY_SOFT
, val
);
810 ret
.second
= std::chrono::nanoseconds(val
[1]);
813 alGetSourcei(mId
, AL_SAMPLE_OFFSET
, &srcpos
);
818 std::pair
<Seconds
,Seconds
> SourceImpl::getSecOffsetLatency() const
820 std::pair
<Seconds
,Seconds
> ret
{Seconds::zero(), Seconds::zero()};
821 CheckContext(mContext
);
822 if(mId
== 0) return ret
;
826 std::lock_guard
<std::mutex
> lock(mMutex
);
827 ALint queued
= 0, state
= -1;
830 alGetSourcei(mId
, AL_BUFFERS_QUEUED
, &queued
);
831 if(mContext
->hasExtension(AL::SOFT_source_latency
))
834 mContext
->alGetSourcedvSOFT(mId
, AL_SEC_OFFSET_LATENCY_SOFT
, val
);
836 ret
.second
= Seconds(val
[1]);
841 alGetSourcef(mId
, AL_SEC_OFFSET
, &f
);
844 alGetSourcei(mId
, AL_SOURCE_STATE
, &state
);
847 int64_t streampos
= mStream
->getPosition();
848 if(state
!= AL_STOPPED
)
851 frac
= std::modf(srcpos
* mStream
->getFrequency(), &ipos
);
853 // The amount of samples in the queue waiting to play
854 ALuint inqueue
= queued
*mStream
->getUpdateLength() - (ALuint
)ipos
;
855 if(!mStream
->hasLooped())
857 // A non-looped stream should never have more samples queued
858 // than have been read...
859 streampos
= std::max
<int64_t>(streampos
, inqueue
) - inqueue
;
863 streampos
-= inqueue
;
864 int64_t looplen
= mStream
->getLoopEnd() - mStream
->getLoopStart();
865 while(streampos
< mStream
->getLoopStart())
866 streampos
+= looplen
;
870 ret
.first
= Seconds((streampos
+frac
) / mStream
->getFrequency());
874 if(mContext
->hasExtension(AL::SOFT_source_latency
))
877 mContext
->alGetSourcedvSOFT(mId
, AL_SEC_OFFSET_LATENCY_SOFT
, val
);
878 ret
.first
= Seconds(val
[0]);
879 ret
.second
= Seconds(val
[1]);
884 alGetSourcef(mId
, AL_SEC_OFFSET
, &f
);
885 ret
.first
= Seconds(f
);
891 void SourceImpl::setLooping(bool looping
)
893 CheckContext(mContext
);
896 alSourcei(mId
, AL_LOOPING
, looping
? AL_TRUE
: AL_FALSE
);
901 void SourceImpl::setPitch(ALfloat pitch
)
904 throw std::runtime_error("Pitch out of range");
905 CheckContext(mContext
);
907 alSourcef(mId
, AL_PITCH
, pitch
* mGroupPitch
);
912 void SourceImpl::setGain(ALfloat gain
)
915 throw std::runtime_error("Gain out of range");
916 CheckContext(mContext
);
918 alSourcef(mId
, AL_GAIN
, gain
* mGroupGain
* mFadeGain
);
922 void SourceImpl::setGainRange(ALfloat mingain
, ALfloat maxgain
)
924 if(!(mingain
>= 0.0f
&& maxgain
<= 1.0f
&& maxgain
>= mingain
))
925 throw std::runtime_error("Gain range out of range");
926 CheckContext(mContext
);
929 alSourcef(mId
, AL_MIN_GAIN
, mingain
);
930 alSourcef(mId
, AL_MAX_GAIN
, maxgain
);
937 void SourceImpl::setDistanceRange(ALfloat refdist
, ALfloat maxdist
)
939 if(!(refdist
>= 0.0f
&& maxdist
<= std::numeric_limits
<float>::max() && refdist
<= maxdist
))
940 throw std::runtime_error("Distance range out of range");
941 CheckContext(mContext
);
944 alSourcef(mId
, AL_REFERENCE_DISTANCE
, refdist
);
945 alSourcef(mId
, AL_MAX_DISTANCE
, maxdist
);
952 void SourceImpl::set3DParameters(const Vector3
&position
, const Vector3
&velocity
, const Vector3
&direction
)
954 CheckContext(mContext
);
957 Batcher batcher
= mContext
->getBatcher();
958 alSourcefv(mId
, AL_POSITION
, position
.getPtr());
959 alSourcefv(mId
, AL_VELOCITY
, velocity
.getPtr());
960 alSourcefv(mId
, AL_DIRECTION
, direction
.getPtr());
962 mPosition
= position
;
963 mVelocity
= velocity
;
964 mDirection
= direction
;
967 void SourceImpl::set3DParameters(const Vector3
&position
, const Vector3
&velocity
, std::pair
<Vector3
,Vector3
> orientation
)
969 static_assert(sizeof(orientation
) == sizeof(ALfloat
[6]), "Invalid Vector3 pair size");
970 CheckContext(mContext
);
973 Batcher batcher
= mContext
->getBatcher();
974 alSourcefv(mId
, AL_POSITION
, position
.getPtr());
975 alSourcefv(mId
, AL_VELOCITY
, velocity
.getPtr());
976 if(mContext
->hasExtension(AL::EXT_BFORMAT
))
977 alSourcefv(mId
, AL_ORIENTATION
, orientation
.first
.getPtr());
978 alSourcefv(mId
, AL_DIRECTION
, orientation
.first
.getPtr());
980 mPosition
= position
;
981 mVelocity
= velocity
;
982 mDirection
= mOrientation
[0] = orientation
.first
;
983 mOrientation
[1] = orientation
.second
;
987 void SourceImpl::setPosition(ALfloat x
, ALfloat y
, ALfloat z
)
989 CheckContext(mContext
);
991 alSource3f(mId
, AL_POSITION
, x
, y
, z
);
997 void SourceImpl::setPosition(const ALfloat
*pos
)
999 CheckContext(mContext
);
1001 alSourcefv(mId
, AL_POSITION
, pos
);
1002 mPosition
[0] = pos
[0];
1003 mPosition
[1] = pos
[1];
1004 mPosition
[2] = pos
[2];
1007 void SourceImpl::setVelocity(ALfloat x
, ALfloat y
, ALfloat z
)
1009 CheckContext(mContext
);
1011 alSource3f(mId
, AL_VELOCITY
, x
, y
, z
);
1017 void SourceImpl::setVelocity(const ALfloat
*vel
)
1019 CheckContext(mContext
);
1021 alSourcefv(mId
, AL_VELOCITY
, vel
);
1022 mVelocity
[0] = vel
[0];
1023 mVelocity
[1] = vel
[1];
1024 mVelocity
[2] = vel
[2];
1027 void SourceImpl::setDirection(ALfloat x
, ALfloat y
, ALfloat z
)
1029 CheckContext(mContext
);
1031 alSource3f(mId
, AL_DIRECTION
, x
, y
, z
);
1037 void SourceImpl::setDirection(const ALfloat
*dir
)
1039 CheckContext(mContext
);
1041 alSourcefv(mId
, AL_DIRECTION
, dir
);
1042 mDirection
[0] = dir
[0];
1043 mDirection
[1] = dir
[1];
1044 mDirection
[2] = dir
[2];
1047 void SourceImpl::setOrientation(ALfloat x1
, ALfloat y1
, ALfloat z1
, ALfloat x2
, ALfloat y2
, ALfloat z2
)
1049 CheckContext(mContext
);
1052 ALfloat ori
[6] = { x1
, y1
, z1
, x2
, y2
, z2
};
1053 if(mContext
->hasExtension(AL::EXT_BFORMAT
))
1054 alSourcefv(mId
, AL_ORIENTATION
, ori
);
1055 alSourcefv(mId
, AL_DIRECTION
, ori
);
1057 mDirection
[0] = mOrientation
[0][0] = x1
;
1058 mDirection
[1] = mOrientation
[0][1] = y1
;
1059 mDirection
[2] = mOrientation
[0][2] = z1
;
1060 mOrientation
[1][0] = x2
;
1061 mOrientation
[1][1] = y2
;
1062 mOrientation
[1][2] = z2
;
1065 void SourceImpl::setOrientation(const ALfloat
*at
, const ALfloat
*up
)
1067 CheckContext(mContext
);
1070 ALfloat ori
[6] = { at
[0], at
[1], at
[2], up
[0], up
[1], up
[2] };
1071 if(mContext
->hasExtension(AL::EXT_BFORMAT
))
1072 alSourcefv(mId
, AL_ORIENTATION
, ori
);
1073 alSourcefv(mId
, AL_DIRECTION
, ori
);
1075 mDirection
[0] = mOrientation
[0][0] = at
[0];
1076 mDirection
[1] = mOrientation
[0][1] = at
[1];
1077 mDirection
[2] = mOrientation
[0][2] = at
[2];
1078 mOrientation
[1][0] = up
[0];
1079 mOrientation
[1][1] = up
[1];
1080 mOrientation
[1][2] = up
[2];
1083 void SourceImpl::setOrientation(const ALfloat
*ori
)
1085 CheckContext(mContext
);
1088 if(mContext
->hasExtension(AL::EXT_BFORMAT
))
1089 alSourcefv(mId
, AL_ORIENTATION
, ori
);
1090 alSourcefv(mId
, AL_DIRECTION
, ori
);
1092 mDirection
[0] = mOrientation
[0][0] = ori
[0];
1093 mDirection
[1] = mOrientation
[0][1] = ori
[1];
1094 mDirection
[2] = mOrientation
[0][2] = ori
[2];
1095 mOrientation
[1][0] = ori
[3];
1096 mOrientation
[1][1] = ori
[4];
1097 mOrientation
[1][2] = ori
[5];
1101 void SourceImpl::setConeAngles(ALfloat inner
, ALfloat outer
)
1103 if(!(inner
>= 0.0f
&& outer
<= 360.0f
&& outer
>= inner
))
1104 throw std::runtime_error("Cone angles out of range");
1105 CheckContext(mContext
);
1108 alSourcef(mId
, AL_CONE_INNER_ANGLE
, inner
);
1109 alSourcef(mId
, AL_CONE_OUTER_ANGLE
, outer
);
1111 mConeInnerAngle
= inner
;
1112 mConeOuterAngle
= outer
;
1115 void SourceImpl::setOuterConeGains(ALfloat gain
, ALfloat gainhf
)
1117 if(!(gain
>= 0.0f
&& gain
<= 1.0f
&& gainhf
>= 0.0f
&& gainhf
<= 1.0f
))
1118 throw std::runtime_error("Outer cone gain out of range");
1119 CheckContext(mContext
);
1122 alSourcef(mId
, AL_CONE_OUTER_GAIN
, gain
);
1123 if(mContext
->hasExtension(AL::EXT_EFX
))
1124 alSourcef(mId
, AL_CONE_OUTER_GAINHF
, gainhf
);
1126 mConeOuterGain
= gain
;
1127 mConeOuterGainHF
= gainhf
;
1131 void SourceImpl::setRolloffFactors(ALfloat factor
, ALfloat roomfactor
)
1133 if(!(factor
>= 0.0f
&& roomfactor
>= 0.0f
))
1134 throw std::runtime_error("Rolloff factor out of range");
1135 CheckContext(mContext
);
1138 alSourcef(mId
, AL_ROLLOFF_FACTOR
, factor
);
1139 if(mContext
->hasExtension(AL::EXT_EFX
))
1140 alSourcef(mId
, AL_ROOM_ROLLOFF_FACTOR
, roomfactor
);
1142 mRolloffFactor
= factor
;
1143 mRoomRolloffFactor
= roomfactor
;
1146 void SourceImpl::setDopplerFactor(ALfloat factor
)
1148 if(!(factor
>= 0.0f
&& factor
<= 1.0f
))
1149 throw std::runtime_error("Doppler factor out of range");
1150 CheckContext(mContext
);
1152 alSourcef(mId
, AL_DOPPLER_FACTOR
, factor
);
1153 mDopplerFactor
= factor
;
1156 void SourceImpl::setAirAbsorptionFactor(ALfloat factor
)
1158 if(!(factor
>= 0.0f
&& factor
<= 10.0f
))
1159 throw std::runtime_error("Absorption factor out of range");
1160 CheckContext(mContext
);
1161 if(mId
!= 0 && mContext
->hasExtension(AL::EXT_EFX
))
1162 alSourcef(mId
, AL_AIR_ABSORPTION_FACTOR
, factor
);
1163 mAirAbsorptionFactor
= factor
;
1166 void SourceImpl::setRadius(ALfloat radius
)
1168 if(!(mRadius
>= 0.0f
))
1169 throw std::runtime_error("Radius out of range");
1170 CheckContext(mContext
);
1171 if(mId
!= 0 && mContext
->hasExtension(AL::EXT_SOURCE_RADIUS
))
1172 alSourcef(mId
, AL_SOURCE_RADIUS
, radius
);
1176 void SourceImpl::setStereoAngles(ALfloat leftAngle
, ALfloat rightAngle
)
1178 CheckContext(mContext
);
1179 if(mId
!= 0 && mContext
->hasExtension(AL::EXT_STEREO_ANGLES
))
1181 ALfloat angles
[2] = { leftAngle
, rightAngle
};
1182 alSourcefv(mId
, AL_STEREO_ANGLES
, angles
);
1184 mStereoAngles
[0] = leftAngle
;
1185 mStereoAngles
[1] = rightAngle
;
1188 void SourceImpl::set3DSpatialize(Spatialize spatialize
)
1190 CheckContext(mContext
);
1191 if(mId
!= 0 && mContext
->hasExtension(AL::SOFT_source_spatialize
))
1192 alSourcei(mId
, AL_SOURCE_SPATIALIZE_SOFT
, (ALint
)spatialize
);
1193 mSpatialize
= spatialize
;
1196 void SourceImpl::setResamplerIndex(ALsizei index
)
1199 throw std::runtime_error("Resampler index out of range");
1200 index
= std::min
<ALsizei
>(index
, mContext
->getAvailableResamplers().size());
1201 if(mId
!= 0 && mContext
->hasExtension(AL::SOFT_source_resampler
))
1202 alSourcei(mId
, AL_SOURCE_RESAMPLER_SOFT
, index
);
1206 void SourceImpl::setRelative(bool relative
)
1208 CheckContext(mContext
);
1210 alSourcei(mId
, AL_SOURCE_RELATIVE
, relative
? AL_TRUE
: AL_FALSE
);
1211 mRelative
= relative
;
1214 void SourceImpl::setGainAuto(bool directhf
, bool send
, bool sendhf
)
1216 CheckContext(mContext
);
1217 if(mId
!= 0 && mContext
->hasExtension(AL::EXT_EFX
))
1219 alSourcei(mId
, AL_DIRECT_FILTER_GAINHF_AUTO
, directhf
? AL_TRUE
: AL_FALSE
);
1220 alSourcei(mId
, AL_AUXILIARY_SEND_FILTER_GAIN_AUTO
, send
? AL_TRUE
: AL_FALSE
);
1221 alSourcei(mId
, AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO
, sendhf
? AL_TRUE
: AL_FALSE
);
1223 mDryGainHFAuto
= directhf
;
1224 mWetGainAuto
= send
;
1225 mWetGainHFAuto
= sendhf
;
1229 void SourceImpl::setFilterParams(ALuint
&filterid
, const FilterParams
¶ms
)
1231 if(!mContext
->hasExtension(AL::EXT_EFX
))
1234 if(!(params
.mGain
< 1.0f
|| params
.mGainHF
< 1.0f
|| params
.mGainLF
< 1.0f
))
1237 mContext
->alFilteri(filterid
, AL_FILTER_TYPE
, AL_FILTER_NULL
);
1244 mContext
->alGenFilters(1, &filterid
);
1245 if(alGetError() != AL_NO_ERROR
)
1246 throw std::runtime_error("Failed to create Filter");
1248 bool filterset
= false;
1249 if(params
.mGainHF
< 1.0f
&& params
.mGainLF
< 1.0f
)
1251 mContext
->alFilteri(filterid
, AL_FILTER_TYPE
, AL_FILTER_BANDPASS
);
1252 if(alGetError() == AL_NO_ERROR
)
1254 mContext
->alFilterf(filterid
, AL_BANDPASS_GAIN
, std::min(params
.mGain
, 1.0f
));
1255 mContext
->alFilterf(filterid
, AL_BANDPASS_GAINHF
, std::min(params
.mGainHF
, 1.0f
));
1256 mContext
->alFilterf(filterid
, AL_BANDPASS_GAINLF
, std::min(params
.mGainLF
, 1.0f
));
1260 if(!filterset
&& !(params
.mGainHF
< 1.0f
) && params
.mGainLF
< 1.0f
)
1262 mContext
->alFilteri(filterid
, AL_FILTER_TYPE
, AL_FILTER_HIGHPASS
);
1263 if(alGetError() == AL_NO_ERROR
)
1265 mContext
->alFilterf(filterid
, AL_HIGHPASS_GAIN
, std::min(params
.mGain
, 1.0f
));
1266 mContext
->alFilterf(filterid
, AL_HIGHPASS_GAINLF
, std::min(params
.mGainLF
, 1.0f
));
1272 mContext
->alFilteri(filterid
, AL_FILTER_TYPE
, AL_FILTER_LOWPASS
);
1273 if(alGetError() == AL_NO_ERROR
)
1275 mContext
->alFilterf(filterid
, AL_LOWPASS_GAIN
, std::min(params
.mGain
, 1.0f
));
1276 mContext
->alFilterf(filterid
, AL_LOWPASS_GAINHF
, std::min(params
.mGainHF
, 1.0f
));
1283 void SourceImpl::setDirectFilter(const FilterParams
&filter
)
1285 if(!(filter
.mGain
>= 0.0f
&& filter
.mGainHF
>= 0.0f
&& filter
.mGainLF
>= 0.0f
))
1286 throw std::runtime_error("Gain value out of range");
1287 CheckContext(mContext
);
1289 setFilterParams(mDirectFilter
, filter
);
1291 alSourcei(mId
, AL_DIRECT_FILTER
, mDirectFilter
);
1294 void SourceImpl::setSendFilter(ALuint send
, const FilterParams
&filter
)
1296 if(!(filter
.mGain
>= 0.0f
&& filter
.mGainHF
>= 0.0f
&& filter
.mGainLF
>= 0.0f
))
1297 throw std::runtime_error("Gain value out of range");
1298 CheckContext(mContext
);
1300 SendPropMap::iterator siter
= mEffectSlots
.find(send
);
1301 if(siter
== mEffectSlots
.end())
1303 ALuint filterid
= 0;
1305 setFilterParams(filterid
, filter
);
1306 if(!filterid
) return;
1308 siter
= mEffectSlots
.insert(std::make_pair(send
, SendProps(filterid
))).first
;
1311 setFilterParams(siter
->second
.mFilter
, filter
);
1315 ALuint slotid
= (siter
->second
.mSlot
? siter
->second
.mSlot
->getId() : 0);
1316 alSource3i(mId
, AL_AUXILIARY_SEND_FILTER
, slotid
, send
, siter
->second
.mFilter
);
1320 void SourceImpl::setAuxiliarySend(AuxiliaryEffectSlot auxslot
, ALuint send
)
1322 AuxiliaryEffectSlotImpl
*slot
= auxslot
.getHandle();
1323 if(slot
) CheckContext(slot
->getContext());
1324 CheckContext(mContext
);
1326 SendPropMap::iterator siter
= mEffectSlots
.find(send
);
1327 if(siter
== mEffectSlots
.end())
1330 slot
->addSourceSend({Source(this), send
});
1331 siter
= mEffectSlots
.insert(std::make_pair(send
, SendProps(slot
))).first
;
1333 else if(siter
->second
.mSlot
!= slot
)
1335 if(slot
) slot
->addSourceSend({Source(this), send
});
1336 if(siter
->second
.mSlot
)
1337 siter
->second
.mSlot
->removeSourceSend({Source(this), send
});
1338 siter
->second
.mSlot
= slot
;
1343 ALuint slotid
= (siter
->second
.mSlot
? siter
->second
.mSlot
->getId() : 0);
1344 alSource3i(mId
, AL_AUXILIARY_SEND_FILTER
, slotid
, send
, siter
->second
.mFilter
);
1348 void SourceImpl::setAuxiliarySendFilter(AuxiliaryEffectSlot auxslot
, ALuint send
, const FilterParams
&filter
)
1350 if(!(filter
.mGain
>= 0.0f
&& filter
.mGainHF
>= 0.0f
&& filter
.mGainLF
>= 0.0f
))
1351 throw std::runtime_error("Gain value out of range");
1352 AuxiliaryEffectSlotImpl
*slot
= auxslot
.getHandle();
1353 if(slot
) CheckContext(slot
->getContext());
1354 CheckContext(mContext
);
1356 SendPropMap::iterator siter
= mEffectSlots
.find(send
);
1357 if(siter
== mEffectSlots
.end())
1359 ALuint filterid
= 0;
1361 setFilterParams(filterid
, filter
);
1362 if(!filterid
&& !slot
)
1365 if(slot
) slot
->addSourceSend({Source(this), send
});
1366 siter
= mEffectSlots
.insert(std::make_pair(send
, SendProps(slot
, filterid
))).first
;
1370 if(siter
->second
.mSlot
!= slot
)
1372 if(slot
) slot
->addSourceSend({Source(this), send
});
1373 if(siter
->second
.mSlot
)
1374 siter
->second
.mSlot
->removeSourceSend({Source(this), send
});
1375 siter
->second
.mSlot
= slot
;
1377 setFilterParams(siter
->second
.mFilter
, filter
);
1382 ALuint slotid
= (siter
->second
.mSlot
? siter
->second
.mSlot
->getId() : 0);
1383 alSource3i(mId
, AL_AUXILIARY_SEND_FILTER
, slotid
, send
, siter
->second
.mFilter
);
1388 void SourceImpl::release()
1393 mContext
->freeSource(this);
1397 // Need to use these to avoid extraneous commas in macro parameter lists
1398 using UInt64NSecPair
= std::pair
<uint64_t,std::chrono::nanoseconds
>;
1399 using SecondsPair
= std::pair
<Seconds
,Seconds
>;
1400 using ALfloatPair
= std::pair
<ALfloat
,ALfloat
>;
1401 using Vector3Pair
= std::pair
<Vector3
,Vector3
>;
1402 using BoolTriple
= std::tuple
<bool,bool,bool>;
1404 DECL_THUNK1(void, Source
, play
,, Buffer
)
1405 DECL_THUNK3(void, Source
, play
,, SharedPtr
<Decoder
>, ALuint
, ALuint
)
1406 DECL_THUNK1(void, Source
, play
,, SharedFuture
<Buffer
>)
1407 DECL_THUNK0(void, Source
, stop
,)
1408 DECL_THUNK2(void, Source
, fadeOutToStop
,, ALfloat
, std::chrono::milliseconds
)
1409 DECL_THUNK0(void, Source
, pause
,)
1410 DECL_THUNK0(void, Source
, resume
,)
1411 DECL_THUNK0(bool, Source
, isPending
, const)
1412 DECL_THUNK0(bool, Source
, isPlaying
, const)
1413 DECL_THUNK0(bool, Source
, isPaused
, const)
1414 DECL_THUNK1(void, Source
, setPriority
,, ALuint
)
1415 DECL_THUNK0(ALuint
, Source
, getPriority
, const)
1416 DECL_THUNK1(void, Source
, setOffset
,, uint64_t)
1417 DECL_THUNK0(UInt64NSecPair
, Source
, getSampleOffsetLatency
, const)
1418 DECL_THUNK0(SecondsPair
, Source
, getSecOffsetLatency
, const)
1419 DECL_THUNK1(void, Source
, setLooping
,, bool)
1420 DECL_THUNK0(bool, Source
, getLooping
, const)
1421 DECL_THUNK1(void, Source
, setPitch
,, ALfloat
)
1422 DECL_THUNK0(ALfloat
, Source
, getPitch
, const)
1423 DECL_THUNK1(void, Source
, setGain
,, ALfloat
)
1424 DECL_THUNK0(ALfloat
, Source
, getGain
, const)
1425 DECL_THUNK2(void, Source
, setGainRange
,, ALfloat
, ALfloat
)
1426 DECL_THUNK0(ALfloatPair
, Source
, getGainRange
, const)
1427 DECL_THUNK2(void, Source
, setDistanceRange
,, ALfloat
, ALfloat
)
1428 DECL_THUNK0(ALfloatPair
, Source
, getDistanceRange
, const)
1429 DECL_THUNK3(void, Source
, set3DParameters
,, const Vector3
&, const Vector3
&, const Vector3
&)
1430 DECL_THUNK3(void, Source
, set3DParameters
,, const Vector3
&, const Vector3
&, Vector3Pair
)
1431 DECL_THUNK3(void, Source
, setPosition
,, ALfloat
, ALfloat
, ALfloat
)
1432 DECL_THUNK1(void, Source
, setPosition
,, const ALfloat
*)
1433 DECL_THUNK0(Vector3
, Source
, getPosition
, const)
1434 DECL_THUNK3(void, Source
, setVelocity
,, ALfloat
, ALfloat
, ALfloat
)
1435 DECL_THUNK1(void, Source
, setVelocity
,, const ALfloat
*)
1436 DECL_THUNK0(Vector3
, Source
, getVelocity
, const)
1437 DECL_THUNK3(void, Source
, setDirection
,, ALfloat
, ALfloat
, ALfloat
)
1438 DECL_THUNK1(void, Source
, setDirection
,, const ALfloat
*)
1439 DECL_THUNK0(Vector3
, Source
, getDirection
, const)
1440 DECL_THUNK6(void, Source
, setOrientation
,, ALfloat
, ALfloat
, ALfloat
, ALfloat
, ALfloat
, ALfloat
)
1441 DECL_THUNK2(void, Source
, setOrientation
,, const ALfloat
*, const ALfloat
*)
1442 DECL_THUNK1(void, Source
, setOrientation
,, const ALfloat
*)
1443 DECL_THUNK0(Vector3Pair
, Source
, getOrientation
, const)
1444 DECL_THUNK2(void, Source
, setConeAngles
,, ALfloat
, ALfloat
)
1445 DECL_THUNK0(ALfloatPair
, Source
, getConeAngles
, const)
1446 DECL_THUNK2(void, Source
, setOuterConeGains
,, ALfloat
, ALfloat
)
1447 DECL_THUNK0(ALfloatPair
, Source
, getOuterConeGains
, const)
1448 DECL_THUNK2(void, Source
, setRolloffFactors
,, ALfloat
, ALfloat
)
1449 DECL_THUNK0(ALfloatPair
, Source
, getRolloffFactors
, const)
1450 DECL_THUNK1(void, Source
, setDopplerFactor
,, ALfloat
)
1451 DECL_THUNK0(ALfloat
, Source
, getDopplerFactor
, const)
1452 DECL_THUNK1(void, Source
, setRelative
,, bool)
1453 DECL_THUNK0(bool, Source
, getRelative
, const)
1454 DECL_THUNK1(void, Source
, setRadius
,, ALfloat
)
1455 DECL_THUNK0(ALfloat
, Source
, getRadius
, const)
1456 DECL_THUNK2(void, Source
, setStereoAngles
,, ALfloat
, ALfloat
)
1457 DECL_THUNK0(ALfloatPair
, Source
, getStereoAngles
, const)
1458 DECL_THUNK1(void, Source
, set3DSpatialize
,, Spatialize
)
1459 DECL_THUNK0(Spatialize
, Source
, get3DSpatialize
, const)
1460 DECL_THUNK1(void, Source
, setResamplerIndex
,, ALsizei
)
1461 DECL_THUNK0(ALsizei
, Source
, getResamplerIndex
, const)
1462 DECL_THUNK1(void, Source
, setAirAbsorptionFactor
,, ALfloat
)
1463 DECL_THUNK0(ALfloat
, Source
, getAirAbsorptionFactor
, const)
1464 DECL_THUNK3(void, Source
, setGainAuto
,, bool, bool, bool)
1465 DECL_THUNK0(BoolTriple
, Source
, getGainAuto
, const)
1466 DECL_THUNK1(void, Source
, setDirectFilter
,, const FilterParams
&)
1467 DECL_THUNK2(void, Source
, setSendFilter
,, ALuint
, const FilterParams
&)
1468 DECL_THUNK2(void, Source
, setAuxiliarySend
,, AuxiliaryEffectSlot
, ALuint
)
1469 DECL_THUNK3(void, Source
, setAuxiliarySendFilter
,, AuxiliaryEffectSlot
, ALuint
, const FilterParams
&)
1470 void Source::release()