diff options
author | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:50 -0500 |
commit | 2a4dea528f670b9bb1f77ef27a8a1dd16603d114 (patch) | |
tree | 95c68e362703c9099d571ecbdc6142b1cda1e005 /linden/indra/llaudio | |
parent | Second Life viewer sources 1.20.6 (diff) | |
download | meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.zip meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.gz meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.bz2 meta-impy-2a4dea528f670b9bb1f77ef27a8a1dd16603d114.tar.xz |
Second Life viewer sources 1.20.7
Diffstat (limited to 'linden/indra/llaudio')
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 41 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine.h | 3 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine_fmod.cpp | 66 |
3 files changed, 63 insertions, 47 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index 3e1fdf8..021c940 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp | |||
@@ -60,6 +60,7 @@ const F32 MAX_CURRENT_TRANSFER_TIME = 60.f; | |||
60 | 60 | ||
61 | LLAudioEngine::LLAudioEngine() | 61 | LLAudioEngine::LLAudioEngine() |
62 | { | 62 | { |
63 | setDefaults(); | ||
63 | } | 64 | } |
64 | 65 | ||
65 | 66 | ||
@@ -68,30 +69,42 @@ LLAudioEngine::~LLAudioEngine() | |||
68 | } | 69 | } |
69 | 70 | ||
70 | 71 | ||
71 | BOOL LLAudioEngine::init(const S32 num_channels, void* userdata) | 72 | void LLAudioEngine::setDefaults() |
72 | { | 73 | { |
73 | mMuted = FALSE; | 74 | mMaxWindGain = 1.f; |
74 | mMasterGain = 1.f; | ||
75 | mInternetStreamGain = 0.125f; | ||
76 | mUserData = userdata; | ||
77 | mLastStatus = 0; | ||
78 | 75 | ||
79 | mNumChannels = num_channels; | 76 | mListenerp = NULL; |
80 | |||
81 | 77 | ||
82 | mMaxWindGain = 1.0; | 78 | mMuted = FALSE; |
79 | mUserData = NULL; | ||
80 | |||
81 | mLastStatus = 0; | ||
83 | 82 | ||
83 | mNumChannels = 0; | ||
84 | mEnableWind = FALSE; | 84 | mEnableWind = FALSE; |
85 | 85 | ||
86 | S32 i; | 86 | S32 i; |
87 | for (i = 0; i < MAX_BUFFERS; i++) | 87 | for (i = 0; i < MAX_CHANNELS; i++) |
88 | { | ||
89 | mBuffers[i] = NULL; | ||
90 | } | ||
91 | for (i = 0; i < num_channels; i++) | ||
92 | { | 88 | { |
93 | mChannels[i] = NULL; | 89 | mChannels[i] = NULL; |
94 | } | 90 | } |
91 | for (i = 0; i < MAX_BUFFERS; i++) | ||
92 | { | ||
93 | mBuffers[i] = NULL; | ||
94 | } | ||
95 | |||
96 | mMasterGain = 1.f; | ||
97 | mInternetStreamGain = 0.125f; | ||
98 | mNextWindUpdate = 0.f; | ||
99 | } | ||
100 | |||
101 | |||
102 | BOOL LLAudioEngine::init(const S32 num_channels, void* userdata) | ||
103 | { | ||
104 | setDefaults(); | ||
105 | |||
106 | mNumChannels = num_channels; | ||
107 | mUserData = userdata; | ||
95 | 108 | ||
96 | allocateListener(); | 109 | allocateListener(); |
97 | 110 | ||
diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index ac84b77..8994703 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h | |||
@@ -233,6 +233,9 @@ protected: | |||
233 | F32 mNextWindUpdate; | 233 | F32 mNextWindUpdate; |
234 | 234 | ||
235 | LLFrameTimer mWindUpdateTimer; | 235 | LLFrameTimer mWindUpdateTimer; |
236 | |||
237 | private: | ||
238 | void setDefaults(); | ||
236 | }; | 239 | }; |
237 | 240 | ||
238 | 241 | ||
diff --git a/linden/indra/llaudio/audioengine_fmod.cpp b/linden/indra/llaudio/audioengine_fmod.cpp index 0fb5146..271074e 100644 --- a/linden/indra/llaudio/audioengine_fmod.cpp +++ b/linden/indra/llaudio/audioengine_fmod.cpp | |||
@@ -117,16 +117,16 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
117 | // Reserve one extra channel for the http stream. | 117 | // Reserve one extra channel for the http stream. |
118 | if (!FSOUND_SetMinHardwareChannels(num_channels + 1)) | 118 | if (!FSOUND_SetMinHardwareChannels(num_channels + 1)) |
119 | { | 119 | { |
120 | llwarns<< "FMOD::init[0](), error: " << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 120 | LL_WARNS("AppInit") << "FMOD::init[0](), error: " << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
121 | } | 121 | } |
122 | 122 | ||
123 | llinfos << "LLAudioEngine_FMOD::init() initializing FMOD" << llendl; | 123 | LL_DEBUGS("AppInit") << "LLAudioEngine_FMOD::init() initializing FMOD" << LL_ENDL; |
124 | 124 | ||
125 | F32 version = FSOUND_GetVersion(); | 125 | F32 version = FSOUND_GetVersion(); |
126 | if (version < FMOD_VERSION) | 126 | if (version < FMOD_VERSION) |
127 | { | 127 | { |
128 | llwarns << "Error : You are using the wrong FMOD version (" << version | 128 | LL_WARNS("AppInit") << "Error : You are using the wrong FMOD version (" << version |
129 | << ")! You should be using FMOD " << FMOD_VERSION << llendl; | 129 | << ")! You should be using FMOD " << FMOD_VERSION << LL_ENDL; |
130 | //return FALSE; | 130 | //return FALSE; |
131 | } | 131 | } |
132 | 132 | ||
@@ -140,8 +140,8 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
140 | // between minimized and not-focused states. | 140 | // between minimized and not-focused states. |
141 | if (!FSOUND_SetHWND(userdata)) | 141 | if (!FSOUND_SetHWND(userdata)) |
142 | { | 142 | { |
143 | llwarns << "Error setting FMOD window: " | 143 | LL_WARNS("AppInit") << "Error setting FMOD window: " |
144 | << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 144 | << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
145 | return FALSE; | 145 | return FALSE; |
146 | } | 146 | } |
147 | // Play audio when we don't have focus. | 147 | // Play audio when we don't have focus. |
@@ -159,7 +159,7 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
159 | // otherwise valgrind will fall over on FMOD's MMX detection | 159 | // otherwise valgrind will fall over on FMOD's MMX detection |
160 | if (getenv("LL_VALGRIND")) /*Flawfinder: ignore*/ | 160 | if (getenv("LL_VALGRIND")) /*Flawfinder: ignore*/ |
161 | { | 161 | { |
162 | llinfos << "Pacifying valgrind in FMOD init." << llendl; | 162 | LL_INFOS("AppInit") << "Pacifying valgrind in FMOD init." << LL_ENDL; |
163 | FSOUND_SetMixer(FSOUND_MIXER_QUALITY_FPU); | 163 | FSOUND_SetMixer(FSOUND_MIXER_QUALITY_FPU); |
164 | } | 164 | } |
165 | 165 | ||
@@ -175,58 +175,58 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
175 | if (!audio_ok) | 175 | if (!audio_ok) |
176 | if (NULL == getenv("LL_BAD_ESD")) /*Flawfinder: ignore*/ | 176 | if (NULL == getenv("LL_BAD_ESD")) /*Flawfinder: ignore*/ |
177 | { | 177 | { |
178 | llinfos << "Trying ESD audio output..." << llendl; | 178 | LL_DEBUGS("AppInit") << "Trying ESD audio output..." << LL_ENDL; |
179 | if(FSOUND_SetOutput(FSOUND_OUTPUT_ESD) && | 179 | if(FSOUND_SetOutput(FSOUND_OUTPUT_ESD) && |
180 | FSOUND_Init(44100, num_channels, fmod_flags)) | 180 | FSOUND_Init(44100, num_channels, fmod_flags)) |
181 | { | 181 | { |
182 | llinfos << "ESD audio output initialized OKAY" | 182 | LL_DEBUGS("AppInit") << "ESD audio output initialized OKAY" |
183 | << llendl; | 183 | << LL_ENDL; |
184 | audio_ok = TRUE; | 184 | audio_ok = TRUE; |
185 | } else { | 185 | } else { |
186 | llwarns << "ESD audio output FAILED to initialize: " | 186 | LL_WARNS("AppInit") << "ESD audio output FAILED to initialize: " |
187 | << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 187 | << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
188 | } | 188 | } |
189 | } else { | 189 | } else { |
190 | llinfos << "ESD audio output SKIPPED" << llendl; | 190 | LL_DEBUGS("AppInit") << "ESD audio output SKIPPED" << LL_ENDL; |
191 | } | 191 | } |
192 | 192 | ||
193 | if (!audio_ok) | 193 | if (!audio_ok) |
194 | if (NULL == getenv("LL_BAD_OSS")) /*Flawfinder: ignore*/ | 194 | if (NULL == getenv("LL_BAD_OSS")) /*Flawfinder: ignore*/ |
195 | { | 195 | { |
196 | llinfos << "Trying OSS audio output..." << llendl; | 196 | LL_DEBUGS("AppInit") << "Trying OSS audio output..." << LL_ENDL; |
197 | if(FSOUND_SetOutput(FSOUND_OUTPUT_OSS) && | 197 | if(FSOUND_SetOutput(FSOUND_OUTPUT_OSS) && |
198 | FSOUND_Init(44100, num_channels, fmod_flags)) | 198 | FSOUND_Init(44100, num_channels, fmod_flags)) |
199 | { | 199 | { |
200 | llinfos << "OSS audio output initialized OKAY" << llendl; | 200 | LL_DEBUGS("AppInit") << "OSS audio output initialized OKAY" << LL_ENDL; |
201 | audio_ok = TRUE; | 201 | audio_ok = TRUE; |
202 | } else { | 202 | } else { |
203 | llwarns << "OSS audio output FAILED to initialize: " | 203 | LL_WARNS("AppInit") << "OSS audio output FAILED to initialize: " |
204 | << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 204 | << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
205 | } | 205 | } |
206 | } else { | 206 | } else { |
207 | llinfos << "OSS audio output SKIPPED" << llendl; | 207 | LL_DEBUGS("AppInit") << "OSS audio output SKIPPED" << LL_ENDL; |
208 | } | 208 | } |
209 | 209 | ||
210 | if (!audio_ok) | 210 | if (!audio_ok) |
211 | if (NULL == getenv("LL_BAD_ALSA")) /*Flawfinder: ignore*/ | 211 | if (NULL == getenv("LL_BAD_ALSA")) /*Flawfinder: ignore*/ |
212 | { | 212 | { |
213 | llinfos << "Trying ALSA audio output..." << llendl; | 213 | LL_DEBUGS("AppInit") << "Trying ALSA audio output..." << LL_ENDL; |
214 | if(FSOUND_SetOutput(FSOUND_OUTPUT_ALSA) && | 214 | if(FSOUND_SetOutput(FSOUND_OUTPUT_ALSA) && |
215 | FSOUND_Init(44100, num_channels, fmod_flags)) | 215 | FSOUND_Init(44100, num_channels, fmod_flags)) |
216 | { | 216 | { |
217 | llinfos << "ALSA audio output initialized OKAY" << llendl; | 217 | LL_DEBUGS("AppInit") << "ALSA audio output initialized OKAY" << LL_ENDL; |
218 | audio_ok = TRUE; | 218 | audio_ok = TRUE; |
219 | } else { | 219 | } else { |
220 | llwarns << "ALSA audio output FAILED to initialize: " | 220 | LL_WARNS("AppInit") << "ALSA audio output FAILED to initialize: " |
221 | << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 221 | << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
222 | } | 222 | } |
223 | } else { | 223 | } else { |
224 | llinfos << "OSS audio output SKIPPED" << llendl; | 224 | LL_DEBUGS("AppInit") << "OSS audio output SKIPPED" << LL_ENDL; |
225 | } | 225 | } |
226 | 226 | ||
227 | if (!audio_ok) | 227 | if (!audio_ok) |
228 | { | 228 | { |
229 | llwarns << "Overall audio init failure." << llendl; | 229 | LL_WARNS("AppInit") << "Overall audio init failure." << LL_ENDL; |
230 | return FALSE; | 230 | return FALSE; |
231 | } | 231 | } |
232 | 232 | ||
@@ -239,11 +239,11 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
239 | // ended up with, for QA purposes. | 239 | // ended up with, for QA purposes. |
240 | switch (FSOUND_GetOutput()) | 240 | switch (FSOUND_GetOutput()) |
241 | { | 241 | { |
242 | case FSOUND_OUTPUT_NOSOUND: llinfos << "Audio output: NoSound" << llendl; break; | 242 | case FSOUND_OUTPUT_NOSOUND: LL_DEBUGS("AppInit") << "Audio output: NoSound" << LL_ENDL; break; |
243 | case FSOUND_OUTPUT_OSS: llinfos << "Audio output: OSS" << llendl; break; | 243 | case FSOUND_OUTPUT_OSS: LL_DEBUGS("AppInit") << "Audio output: OSS" << LL_ENDL; break; |
244 | case FSOUND_OUTPUT_ESD: llinfos << "Audio output: ESD" << llendl; break; | 244 | case FSOUND_OUTPUT_ESD: LL_DEBUGS("AppInit") << "Audio output: ESD" << LL_ENDL; break; |
245 | case FSOUND_OUTPUT_ALSA: llinfos << "Audio output: ALSA" << llendl; break; | 245 | case FSOUND_OUTPUT_ALSA: LL_DEBUGS("AppInit") << "Audio output: ALSA" << LL_ENDL; break; |
246 | default: llinfos << "Audio output: Unknown!" << llendl; break; | 246 | default: LL_INFOS("AppInit") << "Audio output: Unknown!" << LL_ENDL; break; |
247 | }; | 247 | }; |
248 | 248 | ||
249 | #else // LL_LINUX | 249 | #else // LL_LINUX |
@@ -251,8 +251,8 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
251 | // initialize the FMOD engine | 251 | // initialize the FMOD engine |
252 | if (!FSOUND_Init(44100, num_channels, fmod_flags)) | 252 | if (!FSOUND_Init(44100, num_channels, fmod_flags)) |
253 | { | 253 | { |
254 | llwarns << "Error initializing FMOD: " | 254 | LL_WARNS("AppInit") << "Error initializing FMOD: " |
255 | << FMOD_ErrorString(FSOUND_GetError()) << llendl; | 255 | << FMOD_ErrorString(FSOUND_GetError()) << LL_ENDL; |
256 | return FALSE; | 256 | return FALSE; |
257 | } | 257 | } |
258 | 258 | ||
@@ -260,7 +260,7 @@ BOOL LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) | |||
260 | 260 | ||
261 | initInternetStream(); | 261 | initInternetStream(); |
262 | 262 | ||
263 | llinfos << "LLAudioEngine_FMOD::init() FMOD initialized correctly" << llendl; | 263 | LL_DEBUGS("AppInit") << "LLAudioEngine_FMOD::init() FMOD initialized correctly" << LL_ENDL; |
264 | 264 | ||
265 | mInited = TRUE; | 265 | mInited = TRUE; |
266 | 266 | ||
@@ -686,7 +686,7 @@ BOOL LLAudioBufferFMOD::loadWAV(const char *filename) | |||
686 | // MikeS. - Loading the sound file manually and then handing it over to FMOD, | 686 | // MikeS. - Loading the sound file manually and then handing it over to FMOD, |
687 | // since FMOD uses posix IO internally, | 687 | // since FMOD uses posix IO internally, |
688 | // which doesn't work with unicode file paths. | 688 | // which doesn't work with unicode file paths. |
689 | FILE* sound_file = LLFile::fopen(filename,"rb"); /* Flawfinder: ignore */ | 689 | LLFILE* sound_file = LLFile::fopen(filename,"rb"); /* Flawfinder: ignore */ |
690 | if (sound_file) | 690 | if (sound_file) |
691 | { | 691 | { |
692 | fseek(sound_file,0,SEEK_END); | 692 | fseek(sound_file,0,SEEK_END); |