aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio/audioengine.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-12-01 17:39:58 -0600
committerJacek Antonelli2008-12-01 17:40:06 -0600
commit7abecb48babe6a6f09bf6692ba55076546cfced9 (patch)
tree8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/llaudio/audioengine.cpp
parentSecond Life viewer sources 1.21.6 (diff)
downloadmeta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/llaudio/audioengine.cpp')
-rw-r--r--linden/indra/llaudio/audioengine.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp
index 5dd5b28..298ab1d 100644
--- a/linden/indra/llaudio/audioengine.cpp
+++ b/linden/indra/llaudio/audioengine.cpp
@@ -96,6 +96,9 @@ void LLAudioEngine::setDefaults()
96 mMasterGain = 1.f; 96 mMasterGain = 1.f;
97 mInternetStreamGain = 0.125f; 97 mInternetStreamGain = 0.125f;
98 mNextWindUpdate = 0.f; 98 mNextWindUpdate = 0.f;
99
100 for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++)
101 mSecondaryGain[i] = 1.0f;
99} 102}
100 103
101 104
@@ -167,6 +170,13 @@ void LLAudioEngine::updateChannels()
167 { 170 {
168 if (mChannels[i]) 171 if (mChannels[i])
169 { 172 {
173 // set secondary gain if type is available
174 LLAudioSource* source = mChannels[i]->getSource();
175 if (source)
176 {
177 mChannels[i]->setSecondaryGain(mSecondaryGain[source->getType()]);
178 }
179
170 mChannels[i]->updateBuffer(); 180 mChannels[i]->updateBuffer();
171 mChannels[i]->update3DPosition(); 181 mChannels[i]->update3DPosition();
172 mChannels[i]->updateLoop(); 182 mChannels[i]->updateLoop();
@@ -643,6 +653,18 @@ F32 LLAudioEngine::getMasterGain()
643 return mMasterGain; 653 return mMasterGain;
644} 654}
645 655
656void LLAudioEngine::setSecondaryGain(S32 type, F32 gain)
657{
658 llassert(type < LLAudioEngine::AUDIO_TYPE_COUNT);
659
660 mSecondaryGain[type] = gain;
661}
662
663F32 LLAudioEngine::getSecondaryGain(S32 type)
664{
665 return mSecondaryGain[type];
666}
667
646F32 LLAudioEngine::getInternetStreamGain() 668F32 LLAudioEngine::getInternetStreamGain()
647{ 669{
648 return mInternetStreamGain; 670 return mInternetStreamGain;
@@ -718,7 +740,8 @@ F64 LLAudioEngine::mapWindVecToPan(LLVector3 wind_vec)
718} 740}
719 741
720 742
721void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain, const LLVector3d &pos_global) 743void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_id, const F32 gain,
744 const S32 type, const LLVector3d &pos_global)
722{ 745{
723 // Create a new source (since this can't be associated with an existing source. 746 // Create a new source (since this can't be associated with an existing source.
724 //llinfos << "Localized: " << audio_uuid << llendl; 747 //llinfos << "Localized: " << audio_uuid << llendl;
@@ -731,7 +754,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
731 LLUUID source_id; 754 LLUUID source_id;
732 source_id.generate(); 755 source_id.generate();
733 756
734 LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain); 757 LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
735 gAudiop->addAudioSource(asp); 758 gAudiop->addAudioSource(asp);
736 if (pos_global.isExactlyZero()) 759 if (pos_global.isExactlyZero())
737 { 760 {
@@ -1180,11 +1203,12 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
1180// 1203//
1181 1204
1182 1205
1183LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain) 1206LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type)
1184: mID(id), 1207: mID(id),
1185 mOwnerID(owner_id), 1208 mOwnerID(owner_id),
1186 mPriority(0.f), 1209 mPriority(0.f),
1187 mGain(gain), 1210 mGain(gain),
1211 mType(type),
1188 mAmbient(FALSE), 1212 mAmbient(FALSE),
1189 mLoop(FALSE), 1213 mLoop(FALSE),
1190 mSyncMaster(FALSE), 1214 mSyncMaster(FALSE),
@@ -1515,7 +1539,8 @@ LLAudioChannel::LLAudioChannel() :
1515 mCurrentSourcep(NULL), 1539 mCurrentSourcep(NULL),
1516 mCurrentBufferp(NULL), 1540 mCurrentBufferp(NULL),
1517 mLoopedThisFrame(FALSE), 1541 mLoopedThisFrame(FALSE),
1518 mWaiting(FALSE) 1542 mWaiting(FALSE),
1543 mSecondaryGain(1.0f)
1519{ 1544{
1520} 1545}
1521 1546