aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llaudio/audioengine_fmod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llaudio/audioengine_fmod.cpp')
-rw-r--r--linden/indra/llaudio/audioengine_fmod.cpp29
1 files changed, 22 insertions, 7 deletions
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)