diff options
Diffstat (limited to 'linden/indra/llaudio')
21 files changed, 247 insertions, 140 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) | |||
6 | include(Audio) | 6 | include(Audio) |
7 | include(OPENAL) | 7 | include(OPENAL) |
8 | include(FMOD) | 8 | include(FMOD) |
9 | include(OPENAL) | ||
9 | include(LLCommon) | 10 | include(LLCommon) |
10 | include(LLMath) | 11 | include(LLMath) |
11 | include(LLMessage) | 12 | include(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 | |||
80 | endif (OPENAL) | 80 | endif (OPENAL) |
81 | 81 | ||
82 | set_source_files_properties(${llaudio_HEADER_FILES} | 82 | set_source_files_properties(${llaudio_HEADER_FILES} |
@@ -85,3 +85,11 @@ set_source_files_properties(${llaudio_HEADER_FILES} | |||
85 | list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) | 85 | list(APPEND llaudio_SOURCE_FILES ${llaudio_HEADER_FILES}) |
86 | 86 | ||
87 | add_library (llaudio ${llaudio_SOURCE_FILES}) | 87 | add_library (llaudio ${llaudio_SOURCE_FILES}) |
88 | |||
89 | target_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 |
184 | void LLAudioEngine::startInternetStream(const std::string& url) | 184 | void 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 |
235 | void LLAudioEngine::stopInternetStream() | 235 | void 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 | ||
253 | void 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 | ||
253 | std::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 | |||
253 | void LLAudioEngine_FMOD::allocateListener(void) | 267 | void 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.cpp b/linden/indra/llaudio/audioengine_openal.cpp index 6d9a242..5f04d56 100644 --- a/linden/indra/llaudio/audioengine_openal.cpp +++ b/linden/indra/llaudio/audioengine_openal.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 |
@@ -36,6 +36,7 @@ | |||
36 | #include "audioengine_openal.h" | 36 | #include "audioengine_openal.h" |
37 | #include "listener_openal.h" | 37 | #include "listener_openal.h" |
38 | 38 | ||
39 | |||
39 | LLAudioEngine_OpenAL::LLAudioEngine_OpenAL() | 40 | LLAudioEngine_OpenAL::LLAudioEngine_OpenAL() |
40 | : | 41 | : |
41 | mWindGen(NULL), | 42 | mWindGen(NULL), |
@@ -53,41 +54,67 @@ LLAudioEngine_OpenAL::~LLAudioEngine_OpenAL() | |||
53 | { | 54 | { |
54 | } | 55 | } |
55 | 56 | ||
57 | static ALboolean alutInitHelp(const char **errorstring) | ||
58 | { | ||
59 | ALboolean result = AL_FALSE; | ||
60 | ALenum err = AL_NO_ERROR; | ||
61 | #if LL_WINDOWS | ||
62 | __try { | ||
63 | result = alutInit(NULL, NULL); | ||
64 | err = alutGetError(); | ||
65 | alGetError(); // hit loading of wrap_oal.dll | ||
66 | if(!result) *errorstring = alutGetErrorString(err); | ||
67 | } __except( EXCEPTION_EXECUTE_HANDLER ) { | ||
68 | *errorstring = "[Exception]"; | ||
69 | result = AL_FALSE; | ||
70 | } | ||
71 | return result; | ||
72 | #else | ||
73 | result = alutInit(NULL, NULL); | ||
74 | if(!result) { | ||
75 | err = alutGetError(); | ||
76 | *errorstring = alutGetErrorString(err); | ||
77 | } | ||
78 | return result; | ||
79 | #endif | ||
80 | } | ||
81 | |||
56 | // virtual | 82 | // virtual |
57 | bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) | 83 | bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) |
58 | { | 84 | { |
85 | const char *errorstring = "(null)"; | ||
59 | mWindGen = NULL; | 86 | mWindGen = NULL; |
60 | LLAudioEngine::init(num_channels, userdata); | 87 | LLAudioEngine::init(num_channels, userdata); |
61 | 88 | ||
62 | if(!alutInit(NULL, NULL)) | 89 | if(!alutInitHelp(&errorstring)) |
63 | { | 90 | { |
64 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; | 91 | llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << errorstring << llendl; |
65 | return false; | 92 | return false; |
66 | } | 93 | } |
67 | 94 | ||
68 | LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << LL_ENDL; | 95 | llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl; |
69 | 96 | ||
70 | LL_INFOS("OpenAL") << "OpenAL version: " | 97 | llinfos << "OpenAL version: " |
71 | << ll_safe_string(alGetString(AL_VERSION)) << LL_ENDL; | 98 | << ll_safe_string(alGetString(AL_VERSION)) << llendl; |
72 | LL_INFOS("OpenAL") << "OpenAL vendor: " | 99 | llinfos << "OpenAL vendor: " |
73 | << ll_safe_string(alGetString(AL_VENDOR)) << LL_ENDL; | 100 | << ll_safe_string(alGetString(AL_VENDOR)) << llendl; |
74 | LL_INFOS("OpenAL") << "OpenAL renderer: " | 101 | llinfos << "OpenAL renderer: " |
75 | << ll_safe_string(alGetString(AL_RENDERER)) << LL_ENDL; | 102 | << ll_safe_string(alGetString(AL_RENDERER)) << llendl; |
76 | 103 | ||
77 | ALint major = alutGetMajorVersion (); | 104 | ALint major = alutGetMajorVersion (); |
78 | ALint minor = alutGetMinorVersion (); | 105 | ALint minor = alutGetMinorVersion (); |
79 | LL_INFOS("OpenAL") << "ALUT version: " << major << "." << minor << LL_ENDL; | 106 | llinfos << "ALUT version: " << major << "." << minor << llendl; |
80 | 107 | ||
81 | ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); | 108 | ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); |
82 | 109 | ||
83 | alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); | 110 | alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); |
84 | alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); | 111 | alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); |
85 | LL_INFOS("OpenAL") << "ALC version: " << major << "." << minor << LL_ENDL; | 112 | llinfos << "ALC version: " << major << "." << minor << llendl; |
86 | 113 | ||
87 | LL_INFOS("OpenAL") << "ALC default device: " | 114 | llinfos << "ALC default device: " |
88 | << ll_safe_string(alcGetString(device, | 115 | << ll_safe_string(alcGetString(device, |
89 | ALC_DEFAULT_DEVICE_SPECIFIER)) | 116 | ALC_DEFAULT_DEVICE_SPECIFIER)) |
90 | << LL_ENDL; | 117 | << llendl; |
91 | 118 | ||
92 | return true; | 119 | return true; |
93 | } | 120 | } |
@@ -127,24 +154,24 @@ void LLAudioEngine_OpenAL::allocateListener() | |||
127 | mListenerp = (LLListener *) new LLListener_OpenAL(); | 154 | mListenerp = (LLListener *) new LLListener_OpenAL(); |
128 | if(!mListenerp) | 155 | if(!mListenerp) |
129 | { | 156 | { |
130 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << LL_ENDL; | 157 | llwarns << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << llendl; |
131 | } | 158 | } |
132 | } | 159 | } |
133 | 160 | ||
134 | // virtual | 161 | // virtual |
135 | void LLAudioEngine_OpenAL::shutdown() | 162 | void LLAudioEngine_OpenAL::shutdown() |
136 | { | 163 | { |
137 | LL_INFOS("OpenAL") << "About to LLAudioEngine::shutdown()" << LL_ENDL; | 164 | llinfos << "About to LLAudioEngine::shutdown()" << llendl; |
138 | LLAudioEngine::shutdown(); | 165 | LLAudioEngine::shutdown(); |
139 | 166 | ||
140 | LL_INFOS("OpenAL") << "About to alutExit()" << LL_ENDL; | 167 | llinfos << "About to alutExit()" << llendl; |
141 | if(!alutExit()) | 168 | if(!alutExit()) |
142 | { | 169 | { |
143 | LL_WARNS("OpenAL") << "Nuts." << LL_ENDL; | 170 | llwarns << "Nuts." << llendl; |
144 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; | 171 | llwarns << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << llendl; |
145 | } | 172 | } |
146 | 173 | ||
147 | LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << LL_ENDL; | 174 | llinfos << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << llendl; |
148 | 175 | ||
149 | delete mListenerp; | 176 | delete mListenerp; |
150 | mListenerp = NULL; | 177 | mListenerp = NULL; |
@@ -162,7 +189,7 @@ LLAudioChannel *LLAudioEngine_OpenAL::createChannel() | |||
162 | 189 | ||
163 | void LLAudioEngine_OpenAL::setInternalGain(F32 gain) | 190 | void LLAudioEngine_OpenAL::setInternalGain(F32 gain) |
164 | { | 191 | { |
165 | //LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << LL_ENDL; | 192 | //llinfos << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << llendl; |
166 | alListenerf(AL_GAIN, gain); | 193 | alListenerf(AL_GAIN, gain); |
167 | } | 194 | } |
168 | 195 | ||
@@ -172,17 +199,6 @@ LLAudioChannelOpenAL::LLAudioChannelOpenAL() | |||
172 | mLastSamplePos(0) | 199 | mLastSamplePos(0) |
173 | { | 200 | { |
174 | alGenSources(1, &mALSource); | 201 | alGenSources(1, &mALSource); |
175 | |||
176 | if( mALSource == AL_NONE ) | ||
177 | { | ||
178 | ALenum error = alGetError(); | ||
179 | if( error == AL_NO_ERROR ) | ||
180 | { | ||
181 | LL_WARNS("OpenAL") << "LLAudioChannelOpenAL::LLAudioChannelOpenAL() Could not generate mALSource, but no error is indicated!" << LL_ENDL; | ||
182 | } | ||
183 | LL_WARNS("OpenAL") << "LLAudioChannelOpenAL::LLAudioChannelOpenAL() Could not generate mALSource: (" << error << ") " << alGetString( error ) << LL_ENDL; | ||
184 | } | ||
185 | |||
186 | } | 202 | } |
187 | 203 | ||
188 | LLAudioChannelOpenAL::~LLAudioChannelOpenAL() | 204 | LLAudioChannelOpenAL::~LLAudioChannelOpenAL() |
@@ -201,7 +217,7 @@ void LLAudioChannelOpenAL::play() | |||
201 | { | 217 | { |
202 | if (mALSource == AL_NONE) | 218 | if (mALSource == AL_NONE) |
203 | { | 219 | { |
204 | LL_WARNS("OpenAL") << "Playing without a mALSource, aborting" << LL_ENDL; | 220 | llwarns << "Playing without a mALSource, aborting" << llendl; |
205 | return; | 221 | return; |
206 | } | 222 | } |
207 | 223 | ||
@@ -226,8 +242,8 @@ void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp) | |||
226 | alGetSourcef(masterchannelp->mALSource, AL_SEC_OFFSET, | 242 | alGetSourcef(masterchannelp->mALSource, AL_SEC_OFFSET, |
227 | &master_offset); | 243 | &master_offset); |
228 | 244 | ||
229 | LL_INFOS("OpenAL") << "Syncing with master at " << master_offset | 245 | llinfos << "Syncing with master at " << master_offset |
230 | << "sec" << LL_ENDL; | 246 | << "sec" << llendl; |
231 | // *TODO: detect when this fails, maybe use AL_SAMPLE_ | 247 | // *TODO: detect when this fails, maybe use AL_SAMPLE_ |
232 | alSourcef(mALSource, AL_SEC_OFFSET, master_offset); | 248 | alSourcef(mALSource, AL_SEC_OFFSET, master_offset); |
233 | } | 249 | } |
@@ -309,14 +325,12 @@ void LLAudioChannelOpenAL::update3DPosition() | |||
309 | { | 325 | { |
310 | alSource3f(mALSource, AL_POSITION, 0.0, 0.0, 0.0); | 326 | alSource3f(mALSource, AL_POSITION, 0.0, 0.0, 0.0); |
311 | alSource3f(mALSource, AL_VELOCITY, 0.0, 0.0, 0.0); | 327 | alSource3f(mALSource, AL_VELOCITY, 0.0, 0.0, 0.0); |
312 | //alSource3f(mALSource, AL_DIRECTION, 0.0, 0.0, 0.0); | ||
313 | alSourcei (mALSource, AL_SOURCE_RELATIVE, AL_TRUE); | 328 | alSourcei (mALSource, AL_SOURCE_RELATIVE, AL_TRUE); |
314 | } else { | 329 | } else { |
315 | LLVector3 float_pos; | 330 | LLVector3 float_pos; |
316 | float_pos.setVec(mCurrentSourcep->getPositionGlobal()); | 331 | float_pos.setVec(mCurrentSourcep->getPositionGlobal()); |
317 | alSourcefv(mALSource, AL_POSITION, float_pos.mV); | 332 | alSourcefv(mALSource, AL_POSITION, float_pos.mV); |
318 | alSourcefv(mALSource, AL_VELOCITY, mCurrentSourcep->getVelocity().mV); | 333 | alSourcefv(mALSource, AL_VELOCITY, mCurrentSourcep->getVelocity().mV); |
319 | //alSource3f(mALSource, AL_DIRECTION, 0.0, 0.0, 0.0); | ||
320 | alSourcei (mALSource, AL_SOURCE_RELATIVE, AL_FALSE); | 334 | alSourcei (mALSource, AL_SOURCE_RELATIVE, AL_FALSE); |
321 | } | 335 | } |
322 | 336 | ||
@@ -351,18 +365,18 @@ bool LLAudioBufferOpenAL::loadWAV(const std::string& filename) | |||
351 | ALenum error = alutGetError(); | 365 | ALenum error = alutGetError(); |
352 | if (gDirUtilp->fileExists(filename)) | 366 | if (gDirUtilp->fileExists(filename)) |
353 | { | 367 | { |
354 | LL_WARNS("OpenAL") << | 368 | llwarns << |
355 | "LLAudioBufferOpenAL::loadWAV() Error loading " | 369 | "LLAudioBufferOpenAL::loadWAV() Error loading " |
356 | << filename | 370 | << filename |
357 | << " " << alutGetErrorString(error) << LL_ENDL; | 371 | << " " << alutGetErrorString(error) << llendl; |
358 | } | 372 | } |
359 | else | 373 | else |
360 | { | 374 | { |
361 | // It's common for the file to not actually exist. | 375 | // It's common for the file to not actually exist. |
362 | //LL_DEBUGS("OpenAL") << | 376 | lldebugs << |
363 | // "LLAudioBufferOpenAL::loadWAV() Error loading " | 377 | "LLAudioBufferOpenAL::loadWAV() Error loading " |
364 | // << filename | 378 | << filename |
365 | // << " " << alutGetErrorString(error) << LL_ENDL; | 379 | << " " << alutGetErrorString(error) << llendl; |
366 | } | 380 | } |
367 | return false; | 381 | return false; |
368 | } | 382 | } |
@@ -378,7 +392,7 @@ U32 LLAudioBufferOpenAL::getLength() | |||
378 | } | 392 | } |
379 | ALint length; | 393 | ALint length; |
380 | alGetBufferi(mALBuffer, AL_SIZE, &length); | 394 | alGetBufferi(mALBuffer, AL_SIZE, &length); |
381 | return length >> 2; | 395 | return length / 2; // convert size in bytes to size in (16-bit) samples |
382 | } | 396 | } |
383 | 397 | ||
384 | // ------------ | 398 | // ------------ |
@@ -386,7 +400,7 @@ U32 LLAudioBufferOpenAL::getLength() | |||
386 | void LLAudioEngine_OpenAL::initWind() | 400 | void LLAudioEngine_OpenAL::initWind() |
387 | { | 401 | { |
388 | ALenum error; | 402 | ALenum error; |
389 | LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::initWind() start" << LL_ENDL; | 403 | llinfos << "LLAudioEngine_OpenAL::initWind() start" << llendl; |
390 | 404 | ||
391 | mNumEmptyWindALBuffers = MAX_NUM_WIND_BUFFERS; | 405 | mNumEmptyWindALBuffers = MAX_NUM_WIND_BUFFERS; |
392 | 406 | ||
@@ -396,36 +410,35 @@ void LLAudioEngine_OpenAL::initWind() | |||
396 | 410 | ||
397 | if((error=alGetError()) != AL_NO_ERROR) | 411 | if((error=alGetError()) != AL_NO_ERROR) |
398 | { | 412 | { |
399 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<LL_ENDL; | 413 | llwarns << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<llendl; |
400 | } | 414 | } |
401 | 415 | ||
402 | mWindGen = new LLWindGen<WIND_SAMPLE_T>; | 416 | mWindGen = new LLWindGen<WIND_SAMPLE_T>; |
403 | const float WIND_BUFFER_SIZE_SEC = 0.05f; // 1/20th sec | ||
404 | 417 | ||
405 | mWindBufFreq = mWindGen->getInputSamplingRate(); | 418 | mWindBufFreq = mWindGen->getInputSamplingRate(); |
406 | mWindBufSamples = llceil(mWindBufFreq * WIND_BUFFER_SIZE_SEC); | 419 | mWindBufSamples = llceil(mWindBufFreq * 0.05f); // 1/20th sec - WIND_BUFFER_SIZE_SEC |
407 | mWindBufBytes = mWindBufSamples * 2 /*stereo*/ * sizeof(WIND_SAMPLE_T); | 420 | mWindBufBytes = mWindBufSamples * 2 /*stereo*/ * sizeof(WIND_SAMPLE_T); |
408 | 421 | ||
409 | mWindBuf = new WIND_SAMPLE_T [mWindBufSamples * 2 /*stereo*/]; | 422 | mWindBuf = new WIND_SAMPLE_T [mWindBufSamples * 2 /*stereo*/]; |
410 | 423 | ||
411 | if(mWindBuf==NULL) | 424 | if(mWindBuf==NULL) |
412 | { | 425 | { |
413 | LL_ERRS("OpenAL") << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << LL_ENDL; | 426 | llerrs << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << llendl; |
414 | mEnableWind=false; | 427 | mEnableWind=false; |
415 | } | 428 | } |
416 | 429 | ||
417 | LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::initWind() done" << LL_ENDL; | 430 | llinfos << "LLAudioEngine_OpenAL::initWind() done" << llendl; |
418 | } | 431 | } |
419 | 432 | ||
420 | void LLAudioEngine_OpenAL::cleanupWind() | 433 | void LLAudioEngine_OpenAL::cleanupWind() |
421 | { | 434 | { |
422 | LL_INFOS("OpenAL") << "LLAudioEngine_OpenAL::cleanupWind()" << LL_ENDL; | 435 | llinfos << "LLAudioEngine_OpenAL::cleanupWind()" << llendl; |
423 | 436 | ||
424 | if (mWindSource != AL_NONE) | 437 | if (mWindSource != AL_NONE) |
425 | { | 438 | { |
426 | // detach and delete all outstanding buffers on the wind source | 439 | // detach and delete all outstanding buffers on the wind source |
427 | alSourceStop(mWindSource); | 440 | alSourceStop(mWindSource); |
428 | int processed; | 441 | ALint processed; |
429 | alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed); | 442 | alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed); |
430 | while (processed--) | 443 | while (processed--) |
431 | { | 444 | { |
@@ -485,7 +498,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) | |||
485 | 498 | ||
486 | // ok lets make a wind buffer now | 499 | // ok lets make a wind buffer now |
487 | 500 | ||
488 | int processed, queued, unprocessed; | 501 | ALint processed, queued, unprocessed; |
489 | alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed); | 502 | alGetSourcei(mWindSource, AL_BUFFERS_PROCESSED, &processed); |
490 | alGetSourcei(mWindSource, AL_BUFFERS_QUEUED, &queued); | 503 | alGetSourcei(mWindSource, AL_BUFFERS_QUEUED, &queued); |
491 | unprocessed = queued - processed; | 504 | unprocessed = queued - processed; |
@@ -495,18 +508,18 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) | |||
495 | mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed); | 508 | mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed); |
496 | mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0); | 509 | mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0); |
497 | 510 | ||
498 | //LL_INFOS("OpenAL") << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL; | 511 | //llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl; |
499 | 512 | ||
500 | while(processed--) // unqueue old buffers | 513 | while(processed--) // unqueue old buffers |
501 | { | 514 | { |
502 | ALuint buffer; | 515 | ALuint buffer; |
503 | int error; | 516 | ALenum error; |
504 | alGetError(); /* clear error */ | 517 | alGetError(); /* clear error */ |
505 | alSourceUnqueueBuffers(mWindSource, 1, &buffer); | 518 | alSourceUnqueueBuffers(mWindSource, 1, &buffer); |
506 | error = alGetError(); | 519 | error = alGetError(); |
507 | if(error != AL_NO_ERROR) | 520 | if(error != AL_NO_ERROR) |
508 | { | 521 | { |
509 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << LL_ENDL; | 522 | llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << llendl; |
510 | } | 523 | } |
511 | else | 524 | else |
512 | { | 525 | { |
@@ -522,7 +535,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) | |||
522 | alGenBuffers(1,&buffer); | 535 | alGenBuffers(1,&buffer); |
523 | if((error=alGetError()) != AL_NO_ERROR) | 536 | if((error=alGetError()) != AL_NO_ERROR) |
524 | { | 537 | { |
525 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::initWind() Error creating wind buffer: " << error << LL_ENDL; | 538 | llwarns << "LLAudioEngine_OpenAL::initWind() Error creating wind buffer: " << error << llendl; |
526 | break; | 539 | break; |
527 | } | 540 | } |
528 | 541 | ||
@@ -534,22 +547,27 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) | |||
534 | mWindBufFreq); | 547 | mWindBufFreq); |
535 | error = alGetError(); | 548 | error = alGetError(); |
536 | if(error != AL_NO_ERROR) | 549 | if(error != AL_NO_ERROR) |
537 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << LL_ENDL; | 550 | { |
551 | llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl; | ||
552 | } | ||
538 | 553 | ||
539 | alSourceQueueBuffers(mWindSource, 1, &buffer); | 554 | alSourceQueueBuffers(mWindSource, 1, &buffer); |
540 | error = alGetError(); | 555 | error = alGetError(); |
541 | if(error != AL_NO_ERROR) | 556 | if(error != AL_NO_ERROR) |
542 | LL_WARNS("OpenAL") << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << LL_ENDL; | 557 | { |
558 | llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl; | ||
559 | } | ||
543 | 560 | ||
544 | --mNumEmptyWindALBuffers; | 561 | --mNumEmptyWindALBuffers; |
545 | } | 562 | } |
546 | 563 | ||
547 | int playing; | 564 | ALint playing; |
548 | alGetSourcei(mWindSource, AL_SOURCE_STATE, &playing); | 565 | alGetSourcei(mWindSource, AL_SOURCE_STATE, &playing); |
549 | if(playing != AL_PLAYING) | 566 | if(playing != AL_PLAYING) |
550 | { | 567 | { |
551 | alSourcePlay(mWindSource); | 568 | alSourcePlay(mWindSource); |
552 | 569 | ||
553 | LL_INFOS("OpenAL") << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << LL_ENDL; | 570 | lldebugs << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << llendl; |
554 | } | 571 | } |
555 | } | 572 | } |
573 | |||
diff --git a/linden/indra/llaudio/audioengine_openal.h b/linden/indra/llaudio/audioengine_openal.h index 1f6dee4..c14551c 100644 --- a/linden/indra/llaudio/audioengine_openal.h +++ b/linden/indra/llaudio/audioengine_openal.h | |||
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 7 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
8 | * | 8 | * |
9 | * Copyright (c) 2002-2008, Linden Research, Inc. | 9 | * Copyright (c) 2002-2009, Linden Research, Inc. |
10 | * | 10 | * |
11 | * Second Life Viewer Source Code | 11 | * Second Life Viewer Source Code |
12 | * The source code in this file ("Source Code") is provided by Linden Lab | 12 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -39,6 +39,7 @@ | |||
39 | #include "listener_openal.h" | 39 | #include "listener_openal.h" |
40 | #include "windgen.h" | 40 | #include "windgen.h" |
41 | 41 | ||
42 | |||
42 | class LLAudioEngine_OpenAL : public LLAudioEngine | 43 | class LLAudioEngine_OpenAL : public LLAudioEngine |
43 | { | 44 | { |
44 | public: | 45 | public: |
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 | ||
38 | LLListener_OpenAL::LLListener_OpenAL(){ | 38 | LLListener_OpenAL::LLListener_OpenAL() |
39 | { | ||
39 | init(); | 40 | init(); |
40 | } | 41 | } |
41 | 42 | ||
42 | LLListener_OpenAL::~LLListener_OpenAL(){ | 43 | LLListener_OpenAL::~LLListener_OpenAL() |
44 | { | ||
43 | } | 45 | } |
44 | 46 | ||
45 | void LLListener_OpenAL::translate(LLVector3 offset){ | 47 | void 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 | ||
50 | void LLListener_OpenAL::setPosition(LLVector3 pos){ | 53 | void 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 | ||
55 | void LLListener_OpenAL::setVelocity(LLVector3 vel){ | 59 | void LLListener_OpenAL::setVelocity(LLVector3 vel) |
60 | { | ||
56 | LLListener::setVelocity(vel); | 61 | LLListener::setVelocity(vel); |
57 | } | 62 | } |
58 | 63 | ||
59 | void LLListener_OpenAL::orient(LLVector3 up, LLVector3 at){ | 64 | void 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 | ||
64 | void LLListener_OpenAL::commitDeferredChanges(){ | 70 | void 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 | ||
83 | void LLListener_OpenAL::setDopplerFactor(F32 factor){ | 90 | void 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 | ||
91 | F32 LLListener_OpenAL::getDopplerFactor(){ | 96 | F32 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 | |||
105 | void LLListener_OpenAL::setRolloffFactor(F32 factor) | ||
106 | { | ||
107 | mRolloffFactor = factor; | ||
108 | } | ||
109 | |||
110 | F32 LLListener_OpenAL::getRolloffFactor() | ||
111 | { | ||
112 | return mRolloffFactor; | ||
113 | } | ||
114 | |||
115 | |||
116 | void LLListener_OpenAL::setDistanceFactor(F32 factor) | ||
117 | { | ||
118 | mDistanceFactor = factor; | ||
119 | } | ||
120 | |||
121 | F32 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 | ||
42 | class LLListener_OpenAL : public LLListener | 42 | class 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 | ||