diff options
Diffstat (limited to 'linden/indra/llaudio/audioengine.cpp')
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 65 |
1 files changed, 31 insertions, 34 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index da9bcba..400e938 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp | |||
@@ -45,6 +45,8 @@ | |||
45 | #include "llassetstorage.h" | 45 | #include "llassetstorage.h" |
46 | 46 | ||
47 | #include "llmediamanager.h" | 47 | #include "llmediamanager.h" |
48 | #include "llmediabase.h" | ||
49 | #include "llmediaimplcommon.h" | ||
48 | 50 | ||
49 | // necessary for grabbing sounds from sim (implemented in viewer) | 51 | // necessary for grabbing sounds from sim (implemented in viewer) |
50 | extern void request_sound(const LLUUID &sound_guid); | 52 | extern void request_sound(const LLUUID &sound_guid); |
@@ -101,6 +103,8 @@ void LLAudioEngine::setDefaults() | |||
101 | 103 | ||
102 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) | 104 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) |
103 | mSecondaryGain[i] = 1.0f; | 105 | mSecondaryGain[i] = 1.0f; |
106 | |||
107 | mStatus = LLMediaBase::STATUS_UNKNOWN; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
@@ -168,6 +172,14 @@ void LLAudioEngine::shutdown() | |||
168 | } | 172 | } |
169 | 173 | ||
170 | 174 | ||
175 | //////////////////////////////////////////////////////////////////////////////// | ||
176 | // virtual (derives from LLMediaBase) | ||
177 | LLMediaBase::EStatus LLAudioEngine::getStatus() | ||
178 | { | ||
179 | return mStatus; | ||
180 | } | ||
181 | |||
182 | |||
171 | // virtual | 183 | // virtual |
172 | void LLAudioEngine::startInternetStream(const std::string& url) | 184 | void LLAudioEngine::startInternetStream(const std::string& url) |
173 | { | 185 | { |
@@ -179,27 +191,39 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
179 | if (mgr) | 191 | if (mgr) |
180 | { | 192 | { |
181 | 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. |
182 | LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; | 194 | //LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; |
183 | } | 195 | } |
184 | } | 196 | } |
185 | 197 | ||
186 | if(!mInternetStreamMedia) | 198 | if(!mInternetStreamMedia) |
187 | return; | 199 | return; |
200 | |||
201 | // Check for a dead stream, just in case | ||
202 | if(getStatus() == LLMediaBase::STATUS_DEAD) | ||
203 | { | ||
204 | mInternetStreamURL.clear(); | ||
205 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | ||
206 | mInternetStreamMedia->updateMedia(); | ||
207 | stopInternetStream(); | ||
208 | return; | ||
209 | } | ||
188 | 210 | ||
189 | if (!url.empty()) { | 211 | if (!url.empty()) |
212 | { | ||
190 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; | 213 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; |
191 | mInternetStreamURL = url; | 214 | mInternetStreamURL = url; |
192 | mInternetStreamMedia->navigateTo ( url ); | 215 | mInternetStreamMedia->navigateTo ( url ); |
193 | LL_INFOS("AudioEngine") << "Playing....." << llendl; | 216 | LL_INFOS("AudioEngine") << "Playing....." << llendl; |
194 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | 217 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); |
195 | mInternetStreamMedia->updateMedia(); | 218 | mInternetStreamMedia->updateMedia(); |
196 | } else { | 219 | } |
220 | else | ||
221 | { | ||
197 | LL_INFOS("AudioEngine") << "setting stream to NULL"<< llendl; | 222 | LL_INFOS("AudioEngine") << "setting stream to NULL"<< llendl; |
198 | mInternetStreamURL.clear(); | 223 | mInternetStreamURL.clear(); |
199 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 224 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
200 | mInternetStreamMedia->updateMedia(); | 225 | mInternetStreamMedia->updateMedia(); |
201 | } | 226 | } |
202 | //#endif | ||
203 | } | 227 | } |
204 | 228 | ||
205 | // virtual | 229 | // virtual |
@@ -207,9 +231,10 @@ void LLAudioEngine::stopInternetStream() | |||
207 | { | 231 | { |
208 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; | 232 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; |
209 | 233 | ||
210 | if(mInternetStreamMedia) | 234 | if(mInternetStreamMedia) |
211 | { | 235 | { |
212 | if( ! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)){ | 236 | if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) |
237 | { | ||
213 | LL_INFOS("AudioEngine") << "attempting to stop stream failed!" << llendl; | 238 | LL_INFOS("AudioEngine") << "attempting to stop stream failed!" << llendl; |
214 | } | 239 | } |
215 | mInternetStreamMedia->updateMedia(); | 240 | mInternetStreamMedia->updateMedia(); |
@@ -219,29 +244,6 @@ void LLAudioEngine::stopInternetStream() | |||
219 | } | 244 | } |
220 | 245 | ||
221 | // virtual | 246 | // virtual |
222 | void LLAudioEngine::pauseInternetStream(int pause) | ||
223 | { | ||
224 | LL_INFOS("AudioEngine") << "entered pauseInternetStream()" << llendl; | ||
225 | |||
226 | if(!mInternetStreamMedia) | ||
227 | return; | ||
228 | |||
229 | if(pause) | ||
230 | { | ||
231 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_PAUSE)) | ||
232 | { | ||
233 | LL_INFOS("AudioEngine") << "attempting to pause stream failed!" << llendl; | ||
234 | } | ||
235 | } else { | ||
236 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START)) | ||
237 | { | ||
238 | LL_INFOS("AudioEngine") << "attempting to unpause stream failed!" << llendl; | ||
239 | } | ||
240 | } | ||
241 | mInternetStreamMedia->updateMedia(); | ||
242 | } | ||
243 | |||
244 | // virtual | ||
245 | void LLAudioEngine::updateInternetStream() | 247 | void LLAudioEngine::updateInternetStream() |
246 | { | 248 | { |
247 | if (mInternetStreamMedia) | 249 | if (mInternetStreamMedia) |
@@ -259,11 +261,6 @@ int LLAudioEngine::isInternetStreamPlaying() | |||
259 | return 1; // Active and playing | 261 | return 1; // Active and playing |
260 | } | 262 | } |
261 | 263 | ||
262 | if (mInternetStreamMedia->getStatus() == LLMediaBase::STATUS_PAUSED) | ||
263 | { | ||
264 | return 2; // paused | ||
265 | } | ||
266 | |||
267 | return 0; // Stopped | 264 | return 0; // Stopped |
268 | } | 265 | } |
269 | 266 | ||