aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r--linden/indra/llaudio/CMakeLists.txt10
-rw-r--r--linden/indra/llaudio/audioengine.cpp70
-rw-r--r--linden/indra/llaudio/audioengine.h3
-rw-r--r--linden/indra/llaudio/audioengine_fmod.cpp29
-rw-r--r--linden/indra/llaudio/audioengine_fmod.h3
-rw-r--r--linden/indra/llaudio/audioengine_openal.h6
-rw-r--r--linden/indra/llaudio/listener.cpp2
-rw-r--r--linden/indra/llaudio/listener.h2
-rw-r--r--linden/indra/llaudio/listener_ds3d.h2
-rw-r--r--linden/indra/llaudio/listener_fmod.cpp2
-rw-r--r--linden/indra/llaudio/listener_fmod.h2
-rw-r--r--linden/indra/llaudio/listener_openal.cpp78
-rw-r--r--linden/indra/llaudio/listener_openal.h16
-rw-r--r--linden/indra/llaudio/llaudiodecodemgr.cpp2
-rw-r--r--linden/indra/llaudio/llaudiodecodemgr.h2
-rw-r--r--linden/indra/llaudio/vorbisdecode.cpp2
-rw-r--r--linden/indra/llaudio/vorbisdecode.h2
-rw-r--r--linden/indra/llaudio/vorbisencode.cpp2
-rw-r--r--linden/indra/llaudio/vorbisencode.h2
-rw-r--r--linden/indra/llaudio/windgen.h13
20 files changed, 166 insertions, 84 deletions
diff --git a/linden/indra/llaudio/CMakeLists.txt b/linden/indra/llaudio/CMakeLists.txt
index 8a26e54..70041e7 100644
--- a/linden/indra/llaudio/CMakeLists.txt
+++ b/linden/indra/llaudio/CMakeLists.txt
@@ -6,6 +6,7 @@ include(00-Common)
6include(Audio) 6include(Audio)
7include(OPENAL) 7include(OPENAL)
8include(FMOD) 8include(FMOD)
9include(OPENAL)
9include(LLCommon) 10include(LLCommon)
10include(LLMath) 11include(LLMath)
11include(LLMessage) 12include(LLMessage)
@@ -76,7 +77,6 @@ if (OPENAL)
76 audioengine_openal.h 77 audioengine_openal.h
77 listener_openal.h 78 listener_openal.h
78 ) 79 )
79
80endif (OPENAL) 80endif (OPENAL)
81 81
82set_source_files_properties(${llaudio_HEADER_FILES} 82set_source_files_properties(${llaudio_HEADER_FILES}
@@ -85,3 +85,11 @@ set_source_files_properties(${llaudio_HEADER_FILES}
85list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) 85list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES})
86 86
87add_library (llaudio ${llaudio_SOURCE_FILES}) 87add_library (llaudio ${llaudio_SOURCE_FILES})
88
89target_link_libraries(
90 llaudio
91 ${VORBISENC_LIBRARIES}
92 ${VORBISFILE_LIBRARIES}
93 ${VORBIS_LIBRARIES}
94 ${OGG_LIBRARIES}
95 )
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp
index 438aefc..dd0ffff 100644
--- a/linden/indra/llaudio/audioengine.cpp
+++ b/linden/indra/llaudio/audioengine.cpp
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2000&license=viewergpl$ 6 * $LicenseInfo:firstyear=2000&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2000-2008, Linden Research, Inc. 8 * Copyright (c) 2000-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -98,12 +98,12 @@ void LLAudioEngine::setDefaults()
98 mInternetStreamGain = 0.125f; 98 mInternetStreamGain = 0.125f;
99 mNextWindUpdate = 0.f; 99 mNextWindUpdate = 0.f;
100 100
101 mInternetStreamMedia = NULL;
102 mInternetStreamURL.clear();
103
104 for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) 101 for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++)
105 mSecondaryGain[i] = 1.0f; 102 mSecondaryGain[i] = 1.0f;
106 103
104 mInternetStreamMedia = NULL;
105 mInternetStreamURL.clear();
106
107 mStatus = LLMediaBase::STATUS_UNKNOWN; 107 mStatus = LLMediaBase::STATUS_UNKNOWN;
108} 108}
109 109
@@ -120,7 +120,7 @@ bool LLAudioEngine::init(const S32 num_channels, void* userdata)
120 // Initialize the decode manager 120 // Initialize the decode manager
121 gAudioDecodeMgrp = new LLAudioDecodeMgr; 121 gAudioDecodeMgrp = new LLAudioDecodeMgr;
122 122
123 LL_INFOS("AudioEngine") << "LLAudioEngine::init() AudioEngine successfully initialized" << llendl; 123 llinfos << "LLAudioEngine::init() AudioEngine successfully initialized" << llendl;
124 124
125 return true; 125 return true;
126} 126}
@@ -183,7 +183,7 @@ LLMediaBase::EStatus LLAudioEngine::getStatus()
183// virtual 183// virtual
184void LLAudioEngine::startInternetStream(const std::string& url) 184void LLAudioEngine::startInternetStream(const std::string& url)
185{ 185{
186 LL_INFOS("AudioEngine") << "entered startInternetStream()" << llendl; 186 llinfos << "entered startInternetStream()" << llendl;
187 187
188 if (!mInternetStreamMedia) 188 if (!mInternetStreamMedia)
189 { 189 {
@@ -191,7 +191,7 @@ void LLAudioEngine::startInternetStream(const std::string& url)
191 if (mgr) 191 if (mgr)
192 { 192 {
193 mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. 193 mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis.
194 LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; 194 llinfos << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl;
195 } 195 }
196 } 196 }
197 197
@@ -202,7 +202,7 @@ void LLAudioEngine::startInternetStream(const std::string& url)
202 // Check for a dead stream from gstreamer, just in case 202 // Check for a dead stream from gstreamer, just in case
203 else if(getStatus() == LLMediaBase::STATUS_DEAD) 203 else if(getStatus() == LLMediaBase::STATUS_DEAD)
204 { 204 {
205 LL_INFOS("AudioEngine") << "don't play dead stream urls"<< llendl; 205 llinfos << "don't play dead stream urls"<< llendl;
206 mInternetStreamURL.clear(); 206 mInternetStreamURL.clear();
207 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); 207 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP);
208 mInternetStreamMedia->updateMedia(); 208 mInternetStreamMedia->updateMedia();
@@ -210,7 +210,7 @@ void LLAudioEngine::startInternetStream(const std::string& url)
210 } 210 }
211 else if (url.empty()) 211 else if (url.empty())
212 { 212 {
213 LL_INFOS("AudioEngine") << "url is emptly. Setting stream to NULL"<< llendl; 213 llinfos << "url is emptly. Setting stream to NULL"<< llendl;
214 mInternetStreamURL.clear(); 214 mInternetStreamURL.clear();
215 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); 215 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP);
216 mInternetStreamMedia->updateMedia(); 216 mInternetStreamMedia->updateMedia();
@@ -221,10 +221,10 @@ void LLAudioEngine::startInternetStream(const std::string& url)
221 // stop any other stream first 221 // stop any other stream first
222 stopInternetStream(); 222 stopInternetStream();
223 223
224 LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; 224 llinfos << "Starting internet stream: " << url << llendl;
225 mInternetStreamURL = url; 225 mInternetStreamURL = url;
226 mInternetStreamMedia->navigateTo(url); 226 mInternetStreamMedia->navigateTo(url);
227 //LL_INFOS("AudioEngine") << "Playing....." << llendl; 227 //llinfos << "Playing....." << llendl;
228 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); 228 mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START);
229 mInternetStreamMedia->updateMedia(); 229 mInternetStreamMedia->updateMedia();
230 mStatus = LLMediaBase::STATUS_STARTED; 230 mStatus = LLMediaBase::STATUS_STARTED;
@@ -234,17 +234,42 @@ void LLAudioEngine::startInternetStream(const std::string& url)
234// virtual 234// virtual
235void LLAudioEngine::stopInternetStream() 235void LLAudioEngine::stopInternetStream()
236{ 236{
237 LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; 237 llinfos << "entered stopInternetStream()" << llendl;
238 mInternetStreamURL.clear(); 238 mInternetStreamURL.clear();
239 239
240 if(mInternetStreamMedia) 240 if(mInternetStreamMedia)
241 { 241 {
242 if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) 242 if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP))
243 { 243 {
244 LL_INFOS("AudioEngine") << "attempting to stop stream failed!" << llendl; 244 llinfos << "attempting to stop stream failed!" << llendl;
245 } 245 }
246 mInternetStreamMedia->updateMedia(); 246 mInternetStreamMedia->updateMedia();
247 } 247 }
248
249 mInternetStreamURL.clear();
250}
251
252// virtual
253void LLAudioEngine::pauseInternetStream(int pause)
254{
255 llinfos << "entered pauseInternetStream()" << llendl;
256
257 if(!mInternetStreamMedia)
258 return;
259
260 if(pause)
261 {
262 if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_PAUSE))
263 {
264 llinfos << "attempting to pause stream failed!" << llendl;
265 }
266 } else {
267 if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START))
268 {
269 llinfos << "attempting to unpause stream failed!" << llendl;
270 }
271 }
272 mInternetStreamMedia->updateMedia();
248} 273}
249 274
250// virtual 275// virtual
@@ -265,6 +290,11 @@ int LLAudioEngine::isInternetStreamPlaying()
265 return 1; // Active and playing 290 return 1; // Active and playing
266 } 291 }
267 292
293 if (mInternetStreamMedia->getStatus() == LLMediaBase::STATUS_PAUSED)
294 {
295 return 2; // paused
296 }
297
268 return 0; // Stopped 298 return 0; // Stopped
269} 299}
270 300
@@ -1526,7 +1556,7 @@ bool LLAudioSource::isDone()
1526 { 1556 {
1527 // We don't have a channel assigned, and it's been 1557 // We don't have a channel assigned, and it's been
1528 // over 5 seconds since we tried to play it. Don't bother. 1558 // over 5 seconds since we tried to play it. Don't bother.
1529 //LL_INFOS("AudioEngine") << "No channel assigned, source is done" << llendl; 1559 //llinfos << "No channel assigned, source is done" << llendl;
1530 return true; 1560 return true;
1531 } 1561 }
1532 else 1562 else
@@ -1716,6 +1746,8 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep)
1716 } 1746 }
1717 1747
1718 mCurrentSourcep = sourcep; 1748 mCurrentSourcep = sourcep;
1749
1750
1719 updateBuffer(); 1751 updateBuffer();
1720 update3DPosition(); 1752 update3DPosition();
1721} 1753}
@@ -1730,6 +1762,12 @@ bool LLAudioChannel::updateBuffer()
1730 return false; 1762 return false;
1731 } 1763 }
1732 1764
1765 // Initialize the channel's gain setting for this sound.
1766 if(gAudiop)
1767 {
1768 setSecondaryGain(gAudiop->getSecondaryGain(mCurrentSourcep->getType()));
1769 }
1770
1733 LLAudioBuffer *bufferp = mCurrentSourcep->getCurrentBuffer(); 1771 LLAudioBuffer *bufferp = mCurrentSourcep->getCurrentBuffer();
1734 if (bufferp == mCurrentBufferp) 1772 if (bufferp == mCurrentBufferp)
1735 { 1773 {
@@ -1804,7 +1842,7 @@ bool LLAudioData::load()
1804 if (mBufferp) 1842 if (mBufferp)
1805 { 1843 {
1806 // We already have this sound in a buffer, don't do anything. 1844 // We already have this sound in a buffer, don't do anything.
1807 LL_INFOS("AudioEngine") << "Already have a buffer for this sound, don't bother loading!" << llendl; 1845 llinfos << "Already have a buffer for this sound, don't bother loading!" << llendl;
1808 return true; 1846 return true;
1809 } 1847 }
1810 1848
@@ -1812,7 +1850,7 @@ bool LLAudioData::load()
1812 if (!mBufferp) 1850 if (!mBufferp)
1813 { 1851 {
1814 // No free buffers, abort. 1852 // No free buffers, abort.
1815 LL_INFOS("AudioEngine") << "Not able to allocate a new audio buffer, aborting." << llendl; 1853 llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
1816 return false; 1854 return false;
1817 } 1855 }
1818 1856
diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h
index 878a96a..d289ba5 100644
--- a/linden/indra/llaudio/audioengine.h
+++ b/linden/indra/llaudio/audioengine.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -155,6 +155,7 @@ public:
155 // Internet stream methods 155 // Internet stream methods
156 virtual void startInternetStream(const std::string& url); 156 virtual void startInternetStream(const std::string& url);
157 virtual void stopInternetStream(); 157 virtual void stopInternetStream();
158 virtual void pauseInternetStream(int pause);
158 virtual void updateInternetStream(); 159 virtual void updateInternetStream();
159 virtual int isInternetStreamPlaying(); 160 virtual int isInternetStreamPlaying();
160 virtual void getInternetStreamInfo(char* artist, char* title); 161 virtual void getInternetStreamInfo(char* artist, char* title);
diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp
index 354ef95..2197a45 100644
--- a/linden/indra/llaudio/audioengine_fmod.cpp
+++ b/linden/indra/llaudio/audioengine_fmod.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2002-2008, Linden Research, Inc. 7 * Copyright (c) 2002-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -155,7 +155,7 @@ bool LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata)
155 bool audio_ok = false; 155 bool audio_ok = false;
156 156
157 if (!audio_ok) 157 if (!audio_ok)
158 if (NULL == getenv("LL_BAD_ESD")) /*Flawfinder: ignore*/ 158 if (NULL == getenv("LL_BAD_FMOD_ESD")) /*Flawfinder: ignore*/
159 { 159 {
160 LL_DEBUGS("AppInit") << "Trying ESD audio output..." << LL_ENDL; 160 LL_DEBUGS("AppInit") << "Trying ESD audio output..." << LL_ENDL;
161 if(FSOUND_SetOutput(FSOUND_OUTPUT_ESD) && 161 if(FSOUND_SetOutput(FSOUND_OUTPUT_ESD) &&
@@ -173,7 +173,7 @@ bool LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata)
173 } 173 }
174 174
175 if (!audio_ok) 175 if (!audio_ok)
176 if (NULL == getenv("LL_BAD_OSS")) /*Flawfinder: ignore*/ 176 if (NULL == getenv("LL_BAD_FMOD_OSS")) /*Flawfinder: ignore*/
177 { 177 {
178 LL_DEBUGS("AppInit") << "Trying OSS audio output..." << LL_ENDL; 178 LL_DEBUGS("AppInit") << "Trying OSS audio output..." << LL_ENDL;
179 if(FSOUND_SetOutput(FSOUND_OUTPUT_OSS) && 179 if(FSOUND_SetOutput(FSOUND_OUTPUT_OSS) &&
@@ -190,7 +190,7 @@ bool LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata)
190 } 190 }
191 191
192 if (!audio_ok) 192 if (!audio_ok)
193 if (NULL == getenv("LL_BAD_ALSA")) /*Flawfinder: ignore*/ 193 if (NULL == getenv("LL_BAD_FMOD_ALSA")) /*Flawfinder: ignore*/
194 { 194 {
195 LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL; 195 LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL;
196 if(FSOUND_SetOutput(FSOUND_OUTPUT_ALSA) && 196 if(FSOUND_SetOutput(FSOUND_OUTPUT_ALSA) &&
@@ -250,6 +250,20 @@ bool LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata)
250} 250}
251 251
252 252
253std::string LLAudioEngine_FMOD::getDriverName(bool verbose)
254{
255 if (verbose)
256 {
257 F32 version = FSOUND_GetVersion();
258 return llformat("FMOD version %f", version);
259 }
260 else
261 {
262 return "FMOD";
263 }
264}
265
266
253void LLAudioEngine_FMOD::allocateListener(void) 267void LLAudioEngine_FMOD::allocateListener(void)
254{ 268{
255 mListenerp = (LLListener *) new LLListener_FMOD(); 269 mListenerp = (LLListener *) new LLListener_FMOD();
@@ -470,7 +484,7 @@ bool LLAudioChannelFMOD::updateBuffer()
470 if (mCurrentSourcep) 484 if (mCurrentSourcep)
471 { 485 {
472 // SJB: warnings can spam and hurt framerate, disabling 486 // SJB: warnings can spam and hurt framerate, disabling
473 if (!FSOUND_SetVolume(mChannelID, llround(mCurrentSourcep->getGain() * 255.0f))) 487 if (!FSOUND_SetVolume(mChannelID, llround(getSecondaryGain() * mCurrentSourcep->getGain() * 255.0f)))
474 { 488 {
475// llwarns << "LLAudioChannelFMOD::updateBuffer error: " << FMOD_ErrorString(FSOUND_GetError()) << llendl; 489// llwarns << "LLAudioChannelFMOD::updateBuffer error: " << FMOD_ErrorString(FSOUND_GetError()) << llendl;
476 } 490 }
@@ -532,8 +546,9 @@ void LLAudioChannelFMOD::updateLoop()
532 } 546 }
533 547
534 // 548 //
535 // Hack: We keep track of whether we looped or not by seeing when the sign of the last sample 549 // Hack: We keep track of whether we looped or not by seeing when the
536 // flips. This is pretty crappy. 550 // sample position looks like it's going backwards. Not reliable; may
551 // yield false negatives.
537 // 552 //
538 U32 cur_pos = FSOUND_GetCurrentPosition(mChannelID); 553 U32 cur_pos = FSOUND_GetCurrentPosition(mChannelID);
539 if (cur_pos < (U32)mLastSamplePos) 554 if (cur_pos < (U32)mLastSamplePos)
diff --git a/linden/indra/llaudio/audioengine_fmod.h b/linden/indra/llaudio/audioengine_fmod.h
index 132afb1..60f75b9 100644
--- a/linden/indra/llaudio/audioengine_fmod.h
+++ b/linden/indra/llaudio/audioengine_fmod.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2002&license=viewergpl$ 6 * $LicenseInfo:firstyear=2002&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2002-2008, Linden Research, Inc. 8 * Copyright (c) 2002-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -49,6 +49,7 @@ public:
49 49
50 // initialization/startup/shutdown 50 // initialization/startup/shutdown
51 virtual bool init(const S32 num_channels, void *user_data); 51 virtual bool init(const S32 num_channels, void *user_data);
52 virtual std::string getDriverName(bool verbose);
52 virtual void allocateListener(); 53 virtual void allocateListener();
53 54
54 virtual void shutdown(); 55 virtual void shutdown();
diff --git a/linden/indra/llaudio/audioengine_openal.h b/linden/indra/llaudio/audioengine_openal.h
index 70de9d4..5ccdcb7 100644
--- a/linden/indra/llaudio/audioengine_openal.h
+++ b/linden/indra/llaudio/audioengine_openal.h
@@ -39,10 +39,6 @@
39#include "listener_openal.h" 39#include "listener_openal.h"
40#include "windgen.h" 40#include "windgen.h"
41 41
42#if 1
43#define WIND_BUFFER_SIZE_SEC 0.05f
44#endif
45
46 42
47class LLAudioEngine_OpenAL : public LLAudioEngine 43class LLAudioEngine_OpenAL : public LLAudioEngine
48{ 44{
@@ -77,9 +73,7 @@ class LLAudioEngine_OpenAL : public LLAudioEngine
77 int mNumEmptyWindALBuffers; 73 int mNumEmptyWindALBuffers;
78 74
79 static const int MAX_NUM_WIND_BUFFERS = 80; 75 static const int MAX_NUM_WIND_BUFFERS = 80;
80#if 0
81 static const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec 76 static const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec
82#endif
83}; 77};
84 78
85class LLAudioChannelOpenAL : public LLAudioChannel 79class LLAudioChannelOpenAL : public LLAudioChannel
diff --git a/linden/indra/llaudio/listener.cpp b/linden/indra/llaudio/listener.cpp
index ff3cfff..9b99c5f 100644
--- a/linden/indra/llaudio/listener.cpp
+++ b/linden/indra/llaudio/listener.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/listener.h b/linden/indra/llaudio/listener.h
index 595373d..1c15e29 100644
--- a/linden/indra/llaudio/listener.h
+++ b/linden/indra/llaudio/listener.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/listener_ds3d.h b/linden/indra/llaudio/listener_ds3d.h
index 33367a5..e58f3ff 100644
--- a/linden/indra/llaudio/listener_ds3d.h
+++ b/linden/indra/llaudio/listener_ds3d.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2000&license=viewergpl$ 6 * $LicenseInfo:firstyear=2000&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2000-2008, Linden Research, Inc. 8 * Copyright (c) 2000-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/listener_fmod.cpp b/linden/indra/llaudio/listener_fmod.cpp
index 9e48408..eca3547 100644
--- a/linden/indra/llaudio/listener_fmod.cpp
+++ b/linden/indra/llaudio/listener_fmod.cpp
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2002&license=viewergpl$ 6 * $LicenseInfo:firstyear=2002&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2002-2008, Linden Research, Inc. 8 * Copyright (c) 2002-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/listener_fmod.h b/linden/indra/llaudio/listener_fmod.h
index 95b31ac..6ac8f20 100644
--- a/linden/indra/llaudio/listener_fmod.h
+++ b/linden/indra/llaudio/listener_fmod.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2002&license=viewergpl$ 6 * $LicenseInfo:firstyear=2002&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2002-2008, Linden Research, Inc. 8 * Copyright (c) 2002-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/listener_openal.cpp b/linden/indra/llaudio/listener_openal.cpp
index 637af30..a164242 100644
--- a/linden/indra/llaudio/listener_openal.cpp
+++ b/linden/indra/llaudio/listener_openal.cpp
@@ -4,26 +4,26 @@
4 * support as a OpenAL 3D implementation 4 * support as a OpenAL 3D implementation
5 * 5 *
6 * $LicenseInfo:firstyear=2002&license=viewergpl$ 6 * $LicenseInfo:firstyear=2002&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2002-2007, Linden Research, Inc. 8 * Copyright (c) 2002-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0 12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlife.com/developers/opensource/gplv2 16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 * 17 *
18 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlife.com/developers/opensource/flossexception 21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 * 22 *
23 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations. 25 * and agree to abide by those obligations.
26 * 26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE. 29 * COMPLETENESS OR PERFORMANCE.
@@ -35,33 +35,40 @@
35 35
36#include "listener_openal.h" 36#include "listener_openal.h"
37 37
38LLListener_OpenAL::LLListener_OpenAL(){ 38LLListener_OpenAL::LLListener_OpenAL()
39{
39 init(); 40 init();
40} 41}
41 42
42LLListener_OpenAL::~LLListener_OpenAL(){ 43LLListener_OpenAL::~LLListener_OpenAL()
44{
43} 45}
44 46
45void LLListener_OpenAL::translate(LLVector3 offset){ 47void LLListener_OpenAL::translate(LLVector3 offset)
48{
49 //llinfos << "LLListener_OpenAL::translate() : " << offset << llendl;
46 LLListener::translate(offset); 50 LLListener::translate(offset);
47 llinfos << "LLListener_OpenAL::translate() : " << offset << llendl;
48} 51}
49 52
50void LLListener_OpenAL::setPosition(LLVector3 pos){ 53void LLListener_OpenAL::setPosition(LLVector3 pos)
51 LLListener::setPosition(pos); 54{
52 //llinfos << "LLListener_OpenAL::setPosition() : " << pos << llendl; 55 //llinfos << "LLListener_OpenAL::setPosition() : " << pos << llendl;
56 LLListener::setPosition(pos);
53} 57}
54 58
55void LLListener_OpenAL::setVelocity(LLVector3 vel){ 59void LLListener_OpenAL::setVelocity(LLVector3 vel)
60{
56 LLListener::setVelocity(vel); 61 LLListener::setVelocity(vel);
57} 62}
58 63
59void LLListener_OpenAL::orient(LLVector3 up, LLVector3 at){ 64void LLListener_OpenAL::orient(LLVector3 up, LLVector3 at)
60 LLListener::orient(up, at); 65{
61 //llinfos << "LLListener_OpenAL::orient() up: " << up << " at: " << at << llendl; 66 //llinfos << "LLListener_OpenAL::orient() up: " << up << " at: " << at << llendl;
67 LLListener::orient(up, at);
62} 68}
63 69
64void LLListener_OpenAL::commitDeferredChanges(){ 70void LLListener_OpenAL::commitDeferredChanges()
71{
65 ALfloat orientation[6]; 72 ALfloat orientation[6];
66 orientation[0] = mListenAt.mV[0]; 73 orientation[0] = mListenAt.mV[0];
67 orientation[1] = mListenAt.mV[1]; 74 orientation[1] = mListenAt.mV[1];
@@ -80,19 +87,38 @@ void LLListener_OpenAL::commitDeferredChanges(){
80 alListenerfv(AL_VELOCITY, velocity); 87 alListenerfv(AL_VELOCITY, velocity);
81} 88}
82 89
83void LLListener_OpenAL::setDopplerFactor(F32 factor){ 90void LLListener_OpenAL::setDopplerFactor(F32 factor)
84 // Effect is way too strong by default, scale it down here. 91{
85 // Scaling the speed of sound up causes crashes.
86 factor *= 0.005f;
87 //llinfos << "LLListener_OpenAL::setDopplerFactor() : " << factor << llendl; 92 //llinfos << "LLListener_OpenAL::setDopplerFactor() : " << factor << llendl;
88 alDopplerFactor(factor); 93 alDopplerFactor(factor);
89} 94}
90 95
91F32 LLListener_OpenAL::getDopplerFactor(){ 96F32 LLListener_OpenAL::getDopplerFactor()
97{
92 ALfloat factor; 98 ALfloat factor;
93 factor = 0.0f; 99 factor = alGetFloat(AL_DOPPLER_FACTOR);
94 alDopplerFactor(factor); 100 //llinfos << "LLListener_OpenAL::getDopplerFactor() : " << factor << llendl;
95 llinfos << "LLListener_OpenAL::getDopplerFactor() : " << factor << llendl;
96 return factor; 101 return factor;
97} 102}
98 103
104
105void LLListener_OpenAL::setRolloffFactor(F32 factor)
106{
107 mRolloffFactor = factor;
108}
109
110F32 LLListener_OpenAL::getRolloffFactor()
111{
112 return mRolloffFactor;
113}
114
115
116void LLListener_OpenAL::setDistanceFactor(F32 factor)
117{
118 mDistanceFactor = factor;
119}
120
121F32 LLListener_OpenAL::getDistanceFactor()
122{
123 return mDistanceFactor;
124}
diff --git a/linden/indra/llaudio/listener_openal.h b/linden/indra/llaudio/listener_openal.h
index 7551161..6f71a02 100644
--- a/linden/indra/llaudio/listener_openal.h
+++ b/linden/indra/llaudio/listener_openal.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * $LicenseInfo:firstyear=2000&license=viewergpl$ 6 * $LicenseInfo:firstyear=2000&license=viewergpl$
7 * 7 *
8 * Copyright (c) 2000-2008, Linden Research, Inc. 8 * Copyright (c) 2000-2009, Linden Research, Inc.
9 * 9 *
10 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -41,12 +41,6 @@
41 41
42class LLListener_OpenAL : public LLListener 42class LLListener_OpenAL : public LLListener
43{ 43{
44 private:
45 protected:
46 public:
47
48 private:
49 protected:
50 public: 44 public:
51 LLListener_OpenAL(); 45 LLListener_OpenAL();
52 virtual ~LLListener_OpenAL(); 46 virtual ~LLListener_OpenAL();
@@ -59,6 +53,14 @@ class LLListener_OpenAL : public LLListener
59 53
60 virtual void setDopplerFactor(F32 factor); 54 virtual void setDopplerFactor(F32 factor);
61 virtual F32 getDopplerFactor(); 55 virtual F32 getDopplerFactor();
56 virtual void setDistanceFactor(F32 factor);
57 virtual F32 getDistanceFactor();
58 virtual void setRolloffFactor(F32 factor);
59 virtual F32 getRolloffFactor();
60
61 protected:
62 F32 mDistanceFactor;
63 F32 mRolloffFactor;
62}; 64};
63 65
64#endif 66#endif
diff --git a/linden/indra/llaudio/llaudiodecodemgr.cpp b/linden/indra/llaudio/llaudiodecodemgr.cpp
index cfd0500..c984e1f 100644
--- a/linden/indra/llaudio/llaudiodecodemgr.cpp
+++ b/linden/indra/llaudio/llaudiodecodemgr.cpp
@@ -3,7 +3,7 @@
3 * 3 *
4 * $LicenseInfo:firstyear=2003&license=viewergpl$ 4 * $LicenseInfo:firstyear=2003&license=viewergpl$
5 * 5 *
6 * Copyright (c) 2003-2008, Linden Research, Inc. 6 * Copyright (c) 2003-2009, Linden Research, Inc.
7 * 7 *
8 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/llaudiodecodemgr.h b/linden/indra/llaudio/llaudiodecodemgr.h
index ccd5ded..fa6dbd8 100644
--- a/linden/indra/llaudio/llaudiodecodemgr.h
+++ b/linden/indra/llaudio/llaudiodecodemgr.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * $LicenseInfo:firstyear=2003&license=viewergpl$ 4 * $LicenseInfo:firstyear=2003&license=viewergpl$
5 * 5 *
6 * Copyright (c) 2003-2008, Linden Research, Inc. 6 * Copyright (c) 2003-2009, Linden Research, Inc.
7 * 7 *
8 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
9 * The source code in this file ("Source Code") is provided by Linden Lab 9 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/vorbisdecode.cpp b/linden/indra/llaudio/vorbisdecode.cpp
index 23e02aa..85c4b16 100644
--- a/linden/indra/llaudio/vorbisdecode.cpp
+++ b/linden/indra/llaudio/vorbisdecode.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/vorbisdecode.h b/linden/indra/llaudio/vorbisdecode.h
index a9e1cfb..e130c85 100644
--- a/linden/indra/llaudio/vorbisdecode.h
+++ b/linden/indra/llaudio/vorbisdecode.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/vorbisencode.cpp b/linden/indra/llaudio/vorbisencode.cpp
index 3a107b9..c5a751e 100644
--- a/linden/indra/llaudio/vorbisencode.cpp
+++ b/linden/indra/llaudio/vorbisencode.cpp
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/vorbisencode.h b/linden/indra/llaudio/vorbisencode.h
index 6ad0819..eadfa7d 100644
--- a/linden/indra/llaudio/vorbisencode.h
+++ b/linden/indra/llaudio/vorbisencode.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$ 5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2000-2008, Linden Research, Inc. 7 * Copyright (c) 2000-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
diff --git a/linden/indra/llaudio/windgen.h b/linden/indra/llaudio/windgen.h
index 39ce568..faffd3c 100644
--- a/linden/indra/llaudio/windgen.h
+++ b/linden/indra/llaudio/windgen.h
@@ -4,7 +4,7 @@
4 * 4 *
5 * $LicenseInfo:firstyear=2002&license=viewergpl$ 5 * $LicenseInfo:firstyear=2002&license=viewergpl$
6 * 6 *
7 * Copyright (c) 2002-2008, Linden Research, Inc. 7 * Copyright (c) 2002-2009, Linden Research, Inc.
8 * 8 *
9 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 10 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -82,7 +82,7 @@ public:
82 // start with white noise 82 // start with white noise
83 nextSample = ll_frand(2.0f) - 1.0f; 83 nextSample = ll_frand(2.0f) - 1.0f;
84 84
85#if 1 // LLAE_WIND_PINK apply pinking filter 85 // apply pinking filter
86 mbuf0 = 0.997f * mbuf0 + 0.0126502f * nextSample; 86 mbuf0 = 0.997f * mbuf0 + 0.0126502f * nextSample;
87 mbuf1 = 0.985f * mbuf1 + 0.0139083f * nextSample; 87 mbuf1 = 0.985f * mbuf1 + 0.0139083f * nextSample;
88 mbuf2 = 0.950f * mbuf2 + 0.0205439f * nextSample; 88 mbuf2 = 0.950f * mbuf2 + 0.0205439f * nextSample;
@@ -91,14 +91,11 @@ public:
91 mbuf5 = 0.250f * mbuf5 + 0.1093477f * nextSample; 91 mbuf5 = 0.250f * mbuf5 + 0.1093477f * nextSample;
92 92
93 nextSample = mbuf0 + mbuf1 + mbuf2 + mbuf3 + mbuf4 + mbuf5; 93 nextSample = mbuf0 + mbuf1 + mbuf2 + mbuf3 + mbuf4 + mbuf5;
94#endif
95 94
96#if 1 //LLAE_WIND_RESONANT // do a resonant filter on the noise 95 // do a resonant filter on the noise
97 nextSample = (double)( a0 * nextSample - b1 * mY0 - b2 * mY1 ); 96 nextSample = (double)( a0 * nextSample - b1 * mY0 - b2 * mY1 );
98
99 mY1 = mY0; 97 mY1 = mY0;
100 mY0 = nextSample; 98 mY0 = nextSample;
101#endif
102 99
103 nextSample *= mCurrentGain; 100 nextSample *= mCurrentGain;
104 101