From b4959214023db77c6048036cc924075c4271ba74 Mon Sep 17 00:00:00 2001 From: Armin Weatherwax Date: Tue, 4 Jan 2011 00:25:35 +0100 Subject: move streaming audio out of gAudiop into its own class. * might solve several issues with streaming audio, like: streaming audio not working when the sound effects driver fails. * breaks fmod. Sorry. If you want fmod go fix it, its probably not difficult. --- linden/indra/llaudio/llaudioengine.cpp | 79 ------------- linden/indra/llaudio/llaudioengine.h | 21 +--- linden/indra/llaudio/llstreamingaudio.h | 3 +- linden/indra/newview/CMakeLists.txt | 2 + linden/indra/newview/chatbar_as_cmdline.cpp | 4 +- linden/indra/newview/kokuastreamingaudio.cpp | 129 +++++++++++++++++++++ linden/indra/newview/kokuastreamingaudio.h | 71 ++++++++++++ linden/indra/newview/llappviewer.cpp | 14 ++- linden/indra/newview/lloverlaybar.cpp | 13 +-- linden/indra/newview/llstartup.cpp | 17 +-- linden/indra/newview/llvieweraudio.cpp | 125 ++++++++++---------- linden/indra/newview/llviewercontrol.cpp | 11 +- .../indra/newview/llviewermedia_streamingaudio.cpp | 7 ++ .../indra/newview/llviewermedia_streamingaudio.h | 2 + linden/indra/newview/llviewerparcelmgr.cpp | 18 +-- 15 files changed, 318 insertions(+), 198 deletions(-) create mode 100644 linden/indra/newview/kokuastreamingaudio.cpp create mode 100644 linden/indra/newview/kokuastreamingaudio.h (limited to 'linden/indra') diff --git a/linden/indra/llaudio/llaudioengine.cpp b/linden/indra/llaudio/llaudioengine.cpp index bed791a..6b0003a 100644 --- a/linden/indra/llaudio/llaudioengine.cpp +++ b/linden/indra/llaudio/llaudioengine.cpp @@ -36,7 +36,6 @@ #include "linden_common.h" #include "llaudioengine.h" -#include "llstreamingaudio.h" #include "llerror.h" #include "llmath.h" @@ -48,7 +47,6 @@ #include "llaudiodecodemgr.h" #include "llassetstorage.h" - // necessary for grabbing sounds from sim (implemented in viewer) extern void request_sound(const LLUUID &sound_guid); @@ -70,16 +68,6 @@ LLAudioEngine::~LLAudioEngine() { } -LLStreamingAudioInterface* LLAudioEngine::getStreamingAudioImpl() -{ - return mStreamingAudioImpl; -} - -void LLAudioEngine::setStreamingAudioImpl(LLStreamingAudioInterface *impl) -{ - mStreamingAudioImpl = impl; -} - void LLAudioEngine::setDefaults() { mMaxWindGain = 1.f; @@ -108,8 +96,6 @@ void LLAudioEngine::setDefaults() mInternalGain = 0.f; mNextWindUpdate = 0.f; - mStreamingAudioImpl = NULL; - for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) mSecondaryGain[i] = 1.0f; } @@ -174,62 +160,6 @@ void LLAudioEngine::shutdown() } } - -// virtual -void LLAudioEngine::startInternetStream(const std::string& url) -{ - if (mStreamingAudioImpl) - mStreamingAudioImpl->start(url); -} - - -// virtual -void LLAudioEngine::stopInternetStream() -{ - if (mStreamingAudioImpl) - mStreamingAudioImpl->stop(); -} - -// virtual -void LLAudioEngine::pauseInternetStream(int pause) -{ - if (mStreamingAudioImpl) - mStreamingAudioImpl->pause(pause); -} - -// virtual -void LLAudioEngine::updateInternetStream() -{ - if (mStreamingAudioImpl) - mStreamingAudioImpl->update(); -} - -// virtual -int LLAudioEngine::isInternetStreamPlaying() -{ - if (mStreamingAudioImpl) - return mStreamingAudioImpl->isPlaying(); - - return 0; // Stopped -} - - -// virtual -void LLAudioEngine::setInternetStreamGain(F32 vol) -{ - if (mStreamingAudioImpl) - mStreamingAudioImpl->setGain(vol); -} - -// virtual -std::string LLAudioEngine::getInternetStreamURL() -{ - if (mStreamingAudioImpl) - return mStreamingAudioImpl->getURL(); - else return std::string(); -} - - void LLAudioEngine::updateChannels() { S32 i; @@ -512,7 +442,6 @@ void LLAudioEngine::idle(F32 max_decode_time) // or request new data. startNextTransfer(); - updateInternetStream(); } @@ -754,14 +683,6 @@ F32 LLAudioEngine::getSecondaryGain(S32 type) return mSecondaryGain[type]; } -F32 LLAudioEngine::getInternetStreamGain() -{ - if (mStreamingAudioImpl) - return mStreamingAudioImpl->getGain(); - else - return 1.0f; -} - void LLAudioEngine::setMaxWindGain(F32 gain) { mMaxWindGain = gain; diff --git a/linden/indra/llaudio/llaudioengine.h b/linden/indra/llaudio/llaudioengine.h index a1b240e..7237ce2 100644 --- a/linden/indra/llaudio/llaudioengine.h +++ b/linden/indra/llaudio/llaudioengine.h @@ -71,8 +71,6 @@ class LLAudioData; class LLAudioChannel; class LLAudioChannelOpenAL; class LLAudioBuffer; -class LLStreamingAudioInterface; - // // LLAudioEngine definition @@ -119,16 +117,13 @@ public: // stops playing new sounds. void setMuted(bool muted); bool getMuted() const { return mMuted; } -#ifdef USE_PLUGIN_MEDIA - LLPluginClassMedia* initializeMedia(const std::string& media_type); -#endif + F32 getMasterGain(); void setMasterGain(F32 gain); F32 getSecondaryGain(S32 type); void setSecondaryGain(S32 type, F32 gain); - F32 getInternetStreamGain(); virtual void setDopplerFactor(F32 factor); virtual F32 getDopplerFactor(); @@ -150,19 +145,6 @@ public: LLAudioSource *findAudioSource(const LLUUID &source_id); LLAudioData *getAudioData(const LLUUID &audio_uuid); - // Internet stream implementation manipulation - LLStreamingAudioInterface *getStreamingAudioImpl(); - void setStreamingAudioImpl(LLStreamingAudioInterface *impl); - // Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists - void startInternetStream(const std::string& url); - void stopInternetStream(); - void pauseInternetStream(int pause); - void updateInternetStream(); // expected to be called often - int isInternetStreamPlaying(); - // use a value from 0.0 to 1.0, inclusive - void setInternetStreamGain(F32 vol); - std::string getInternetStreamURL(); - // For debugging usage virtual LLVector3 getListenerPos(); @@ -247,7 +229,6 @@ protected: private: void setDefaults(); - LLStreamingAudioInterface *mStreamingAudioImpl; }; diff --git a/linden/indra/llaudio/llstreamingaudio.h b/linden/indra/llaudio/llstreamingaudio.h index aa89e6a..f5d5334 100644 --- a/linden/indra/llaudio/llstreamingaudio.h +++ b/linden/indra/llaudio/llstreamingaudio.h @@ -36,7 +36,7 @@ #include "stdtypes.h" // from llcommon -// Entirely abstract. Based exactly on the historic API. +// Entirely abstract. Based on the historic API. class LLStreamingAudioInterface { public: @@ -51,6 +51,7 @@ class LLStreamingAudioInterface virtual void setGain(F32 vol) = 0; virtual F32 getGain() = 0; virtual std::string getURL() = 0; + virtual std::string getVersion() = 0; }; #endif // LL_STREAMINGAUDIO_H diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt index e6c1767..4a30be3 100644 --- a/linden/indra/newview/CMakeLists.txt +++ b/linden/indra/newview/CMakeLists.txt @@ -88,6 +88,7 @@ set(viewer_SOURCE_FILES impprefsfonts.cpp jcfloater_animation_list.cpp jcfloaterareasearch.cpp + kokuastreamingaudio.cpp kowopenregionsettings.cpp lightshare.cpp llagent.cpp @@ -541,6 +542,7 @@ set(viewer_HEADER_FILES impprefsfonts.h jcfloater_animation_list.h jcfloaterareasearch.h + kokuastreamingaudio.h lightshare.h lggautocorrectfloater.h lggautocorrect.h diff --git a/linden/indra/newview/chatbar_as_cmdline.cpp b/linden/indra/newview/chatbar_as_cmdline.cpp index 0593091..b5a7e8c 100644 --- a/linden/indra/newview/chatbar_as_cmdline.cpp +++ b/linden/indra/newview/chatbar_as_cmdline.cpp @@ -69,7 +69,7 @@ #include "llviewerparcelmgr.h" #include "llviewerparcelmedia.h" #include "llparcel.h" -#include "llaudioengine.h" +#include "kokuastreamingaudio.h" #include "llviewerparcelmediaautoplay.h" #include "lloverlaybar.h" #include "lggautocorrectfloater.h" @@ -367,7 +367,7 @@ bool cmd_line_chat(std::string revised_text, EChatType type) { gOverlayBar->toggleMusicPlay(gOverlayBar); } - gAudiop->startInternetStream(status); + gAudioStream->startInternetStream(status); return false; } } diff --git a/linden/indra/newview/kokuastreamingaudio.cpp b/linden/indra/newview/kokuastreamingaudio.cpp new file mode 100644 index 0000000..ed606db --- /dev/null +++ b/linden/indra/newview/kokuastreamingaudio.cpp @@ -0,0 +1,129 @@ + /** + * @file kokuastreamingaudio.cpp + * @brief Definition of KOKUAStreamingAudio base class for streaming audio support + * + * $LicenseInfo:firstyear=2011&license=viewergpl$ + * Kokua Viewer Source Code + * Copyright (C) 2011, Armin.Weatherwax (at) googlemail.com + * for the Kokua Viewer Team, in special for our Imprudence Viewer. + * + * The source code in this file ("Source Code") is provided by the author + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in this + * distribution, or online at + * http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * THIS SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * + * $/LicenseInfo$ + */ + +#include "kokuastreamingaudio.h" +#include "llstreamingaudio.h" + + +KOKUAStreamingAudio* gAudioStream = NULL; + +KOKUAStreamingAudio::KOKUAStreamingAudio(LLStreamingAudioInterface *impl) : +mStreamingAudioImpl (impl) +{ + +} + +KOKUAStreamingAudio::~KOKUAStreamingAudio() +{ + if (mStreamingAudioImpl) + { + delete mStreamingAudioImpl; + mStreamingAudioImpl = NULL; + } +} + +LLStreamingAudioInterface* KOKUAStreamingAudio::getStreamingAudioImpl() +{ + return mStreamingAudioImpl; +} + +// void KOKUAStreamingAudio::setStreamingAudioImpl(LLStreamingAudioInterface *impl) +// { +// mStreamingAudioImpl = impl; +// } + +// virtual +void KOKUAStreamingAudio::startInternetStream(const std::string& url) +{ + if (mStreamingAudioImpl) + mStreamingAudioImpl->start(url); +} + +// virtual +void KOKUAStreamingAudio::stopInternetStream() +{ + if (mStreamingAudioImpl) + mStreamingAudioImpl->stop(); +} + +// virtual +void KOKUAStreamingAudio::pauseInternetStream(int pause) +{ + if (mStreamingAudioImpl) + mStreamingAudioImpl->pause(pause); +} + +// virtual +void KOKUAStreamingAudio::updateInternetStream() +{ + if (mStreamingAudioImpl) + mStreamingAudioImpl->update(); +} + +// virtual +KOKUAStreamingAudio::KOKUAAudioPlayState KOKUAStreamingAudio::isInternetStreamPlaying() +{ + if (mStreamingAudioImpl) + return (KOKUAStreamingAudio::KOKUAAudioPlayState) mStreamingAudioImpl->isPlaying(); + + return KOKUAStreamingAudio::AUDIO_STOPPED; // Stopped +} + +// virtual +void KOKUAStreamingAudio::setInternetStreamGain(F32 vol) +{ + if (mStreamingAudioImpl) + mStreamingAudioImpl->setGain(vol); +} + +F32 KOKUAStreamingAudio::getInternetStreamGain() +{ + if (mStreamingAudioImpl) + return mStreamingAudioImpl->getGain(); + else + return 1.0f; +} + +// virtual +std::string KOKUAStreamingAudio::getInternetStreamURL() +{ + if (mStreamingAudioImpl) + return mStreamingAudioImpl->getURL(); + else return std::string(); +} + +std::string KOKUAStreamingAudio::getVersion() +{ + if (mStreamingAudioImpl) + return mStreamingAudioImpl->getVersion(); + else return std::string(); +} \ No newline at end of file diff --git a/linden/indra/newview/kokuastreamingaudio.h b/linden/indra/newview/kokuastreamingaudio.h new file mode 100644 index 0000000..eb49f25 --- /dev/null +++ b/linden/indra/newview/kokuastreamingaudio.h @@ -0,0 +1,71 @@ +/** + * @file kokuastreamingaudio.h + * @brief Definition of KOKUAStreamingAudio base class for streaming audio support + * + * $LicenseInfo:firstyear=2011&license=viewergpl$ + * Kokua Viewer Source Code + * Copyright (C) 2011, Armin.Weatherwax (at) googlemail.com + * for the Kokua Viewer Team. + * + * The source code in this file ("Source Code") is provided by the author + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in this + * distribution, or online at + * http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * THIS SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * + * $/LicenseInfo$ + */ +#ifndef KOKUA_STREAMINGAUDIO_H +#define KOKUA_STREAMINGAUDIO_H + +#include "linden_common.h" + +class LLStreamingAudioInterface; + +class KOKUAStreamingAudio +{ +public: + enum KOKUAAudioPlayState + { + // isInternetStreamPlaying() returns an *int*, with + // 0 = stopped, 1 = playing, 2 = paused. + AUDIO_STOPPED = 0, + AUDIO_PLAYING = 1, + AUDIO_PAUSED = 2 + }; + + KOKUAStreamingAudio(LLStreamingAudioInterface *impl); + virtual ~KOKUAStreamingAudio(); + + LLStreamingAudioInterface *getStreamingAudioImpl(); +// void setStreamingAudioImpl(LLStreamingAudioInterface *impl); + void startInternetStream(const std::string& url); + void stopInternetStream(); + void pauseInternetStream(int pause); + void updateInternetStream(); + KOKUAAudioPlayState isInternetStreamPlaying(); + void setInternetStreamGain(F32 vol); + F32 getInternetStreamGain(); + std::string getInternetStreamURL(); + std::string getVersion(); +private: + LLStreamingAudioInterface *mStreamingAudioImpl; +}; + +extern KOKUAStreamingAudio* gAudioStream; + +#endif diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index 8aea221..eb03727 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -104,6 +104,7 @@ #include "llassetstorage.h" #include "llpolymesh.h" #include "llcachename.h" +#include "kokuastreamingaudio.h" #include "llaudioengine.h" #include "llstreamingaudio.h" #include "llviewermenu.h" @@ -1278,14 +1279,17 @@ bool LLAppViewer::cleanup() llinfos << "Global stuff deleted" << llendflush; - if (gAudiop) + if (gAudioStream) { // shut down the streaming audio sub-subsystem first, in case it relies on not outliving the general audio subsystem. - LLStreamingAudioInterface *sai = gAudiop->getStreamingAudioImpl(); + LLStreamingAudioInterface *sai = gAudioStream->getStreamingAudioImpl(); delete sai; - gAudiop->setStreamingAudioImpl(NULL); +// gAudioStream->setStreamingAudioImpl(NULL); + } + if (gAudiop) + { // shut down the audio subsystem bool want_longname = false; @@ -3732,6 +3736,10 @@ void LLAppViewer::idle() const F32 max_audio_decode_time = 0.002f; // 2 ms decode time gAudiop->idle(max_audio_decode_time); } + + // update streaming audio + if (gAudioStream) + gAudioStream->updateInternetStream(); } diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index ed406e8..4e1d03e 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp @@ -38,7 +38,7 @@ #include "lloverlaybar.h" #include "aoremotectrl.h" -#include "llaudioengine.h" +#include "kokuastreamingaudio.h" #include "llrender.h" #include "llagent.h" #include "llbutton.h" @@ -438,17 +438,16 @@ void LLOverlayBar::toggleMusicPlay(void*) if (gOverlayBar->mMusicState != PLAYING) { gOverlayBar->mMusicState = PLAYING; // desired state - if (gAudiop) + if (gAudioStream) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if ( parcel ) { // this doesn't work properly when crossing parcel boundaries - even when the // stream is stopped, it doesn't return the right thing - commenting out for now. - // if ( gAudiop->isInternetStreamPlaying() == 0 ) + // if ( gAudioStream->isInternetStreamPlaying() == 0 ) { - gAudiop->startInternetStream(parcel->getMusicURL()); -//awfixme sTitleObserver.init(parcel->getMusicURL()); + gAudioStream->startInternetStream(parcel->getMusicURL()); } } } @@ -456,9 +455,9 @@ void LLOverlayBar::toggleMusicPlay(void*) else { gOverlayBar->mMusicState = STOPPED; // desired state - if (gAudiop) + if (gAudioStream) { - gAudiop->stopInternetStream(); + gAudioStream->stopInternetStream(); } } } diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index b744961..0417f61 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp @@ -41,6 +41,7 @@ #endif #include "llpluginclassmediaowner.h" #include "llviewermedia_streamingaudio.h" +#include "kokuastreamingaudio.h" #include "llaudioengine.h" #ifdef LL_FMOD @@ -681,19 +682,13 @@ bool idle_startup() delete gAudiop; gAudiop = NULL; } - - if (gAudiop) - { - // if the audio engine hasn't set up its own preferred handler for streaming audio then set up the generic streaming audio implementation which uses media plugins - if (NULL == gAudiop->getStreamingAudioImpl()) - { - LL_INFOS("AppInit") << "Using media plugins to render streaming audio" << LL_ENDL; - gAudiop->setStreamingAudioImpl(new LLStreamingAudio_MediaPlugins()); - } - } } } - + + + if (!gAudioStream) + gAudioStream = new KOKUAStreamingAudio(new LLStreamingAudio_MediaPlugins()); + LL_INFOS("AppInit") << "Audio Engine Initialized." << LL_ENDL; diff --git a/linden/indra/newview/llvieweraudio.cpp b/linden/indra/newview/llvieweraudio.cpp index 91e7ce5..d465177 100644 --- a/linden/indra/newview/llvieweraudio.cpp +++ b/linden/indra/newview/llvieweraudio.cpp @@ -33,6 +33,7 @@ #include "llviewerprecompiledheaders.h" #include "llaudioengine.h" +#include "kokuastreamingaudio.h" #include "llagent.h" #include "llappviewer.h" #include "llvieweraudio.h" @@ -46,69 +47,71 @@ void init_audio() { - if (!gAudiop) + if (gAudiop) { - llwarns << "Failed to create an appropriate Audio Engine" << llendl; - return; + LLVector3d lpos_global = gAgent.getCameraPositionGlobal(); + LLVector3 lpos_global_f; + + lpos_global_f.setVec(lpos_global); + + gAudiop->setListener(lpos_global_f, + LLVector3::zero, // LLViewerCamera::getInstance()->getVelocity(), // !!! BUG need to replace this with smoothed velocity! + LLViewerCamera::getInstance()->getUpAxis(), + LLViewerCamera::getInstance()->getAtAxis()); + + // load up our initial set of sounds we'll want so they're in memory and ready to be played + + bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); + + if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload")) + { + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndChatFromObject"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClick"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClickRelease"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionF"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionM"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingChat"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingIM"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvApplyToObject"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvalidOp"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInventoryCopyToInv"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeDown"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeUp"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCopyToInv"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCreate"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectDelete"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezIn"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezOut"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuAppear"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuHide"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight0"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight1"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight2"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight3"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight4"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight5"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight6"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight7"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndSnapshot"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartAutopilot"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartFollowpilot"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartIM"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStopAutopilot"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTeleportOut"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureApplyToObject"))); + //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureCopyToInv"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTyping"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowClose"))); + gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowOpen"))); + } } - LLVector3d lpos_global = gAgent.getCameraPositionGlobal(); - LLVector3 lpos_global_f; - - lpos_global_f.setVec(lpos_global); - - gAudiop->setListener(lpos_global_f, - LLVector3::zero, // LLViewerCamera::getInstance()->getVelocity(), // !!! BUG need to replace this with smoothed velocity! - LLViewerCamera::getInstance()->getUpAxis(), - LLViewerCamera::getInstance()->getAtAxis()); - -// load up our initial set of sounds we'll want so they're in memory and ready to be played - - bool mute_audio = gSavedSettings.getBOOL("MuteAudio"); - - if (!mute_audio && FALSE == gSavedSettings.getBOOL("NoPreload")) + else { - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndAlert"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndBadKeystroke"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndChatFromObject"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClick"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndClickRelease"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionF"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndHealthReductionM"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingChat"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndIncomingIM"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvApplyToObject"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInvalidOp"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndInventoryCopyToInv"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeDown"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndMoneyChangeUp"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCopyToInv"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectCreate"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectDelete"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezIn"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndObjectRezOut"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuAppear"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuHide"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight0"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight1"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight2"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight3"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight4"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight5"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight6"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndPieMenuSliceHighlight7"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndSnapshot"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartAutopilot"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartFollowpilot"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStartIM"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndStopAutopilot"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTeleportOut"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureApplyToObject"))); - //gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTextureCopyToInv"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndTyping"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowClose"))); - gAudiop->preloadSound(LLUUID(gSavedSettings.getString("UISndWindowOpen"))); + llwarns << "Failed to create an appropriate Audio Engine" << llendl; + return; } - audio_update_volume(true); } @@ -158,12 +161,12 @@ void audio_update_volume(bool force_update) } // Streaming Music - if (gAudiop) + if (gAudioStream) { F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); music_volume = mute_volume * master_volume * (music_volume*music_volume); - gAudiop->setInternetStreamGain ( music_muted ? 0.f : music_volume ); + gAudioStream->setInternetStreamGain ( music_muted ? 0.f : music_volume ); } diff --git a/linden/indra/newview/llviewercontrol.cpp b/linden/indra/newview/llviewercontrol.cpp index 3675072..00e3a9a 100644 --- a/linden/indra/newview/llviewercontrol.cpp +++ b/linden/indra/newview/llviewercontrol.cpp @@ -38,7 +38,8 @@ #include "indra_constants.h" // For Listeners -#include "llaudioengine.h" +// #include "llaudioengine.h" +#include "kokuastreamingaudio.h" #include "llagent.h" #include "llconsole.h" #include "lldrawpoolterrain.h" @@ -310,7 +311,7 @@ static bool handleJoystickChanged(const LLSD& newvalue) static bool handleAudioStreamMusicChanged(const LLSD& newvalue) { - if (gAudiop) + if (gAudioStream) { if ( newvalue.asBoolean() ) { @@ -319,15 +320,15 @@ static bool handleAudioStreamMusicChanged(const LLSD& newvalue) { // if stream is already playing, don't call this // otherwise music will briefly stop - if ( !gAudiop->isInternetStreamPlaying() ) + if ( !gAudioStream->isInternetStreamPlaying() ) { - gAudiop->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL()); + gAudioStream->startInternetStream(LLViewerParcelMgr::getInstance()->getAgentParcel()->getMusicURL()); } } } else { - gAudiop->stopInternetStream(); + gAudioStream->stopInternetStream(); } } return true; diff --git a/linden/indra/newview/llviewermedia_streamingaudio.cpp b/linden/indra/newview/llviewermedia_streamingaudio.cpp index 575dbc8..4bbc519 100644 --- a/linden/indra/newview/llviewermedia_streamingaudio.cpp +++ b/linden/indra/newview/llviewermedia_streamingaudio.cpp @@ -69,6 +69,8 @@ void LLStreamingAudio_MediaPlugins::start(const std::string& url) llinfos << "mMediaPlugin is now " << mMediaPlugin << llendl; } + mVersion = mMediaPlugin ? mMediaPlugin->getPluginVersion() : std::string(); + if(!mMediaPlugin) return; @@ -156,6 +158,11 @@ std::string LLStreamingAudio_MediaPlugins::getURL() return mURL; } +std::string LLStreamingAudio_MediaPlugins::getVersion() +{ + return mVersion; +} + void LLStreamingAudio_MediaPlugins::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) { if (event == MEDIA_EVENT_NAME_CHANGED) diff --git a/linden/indra/newview/llviewermedia_streamingaudio.h b/linden/indra/newview/llviewermedia_streamingaudio.h index 816e213..5802a31 100644 --- a/linden/indra/newview/llviewermedia_streamingaudio.h +++ b/linden/indra/newview/llviewermedia_streamingaudio.h @@ -56,6 +56,7 @@ class LLStreamingAudio_MediaPlugins : /*virtual*/ void setGain(F32 vol); /*virtual*/ F32 getGain(); /*virtual*/ std::string getURL(); + /*virtual*/ std::string getVersion(); // inherited from LLPluginClassMediaOwner /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); @@ -66,6 +67,7 @@ private: LLPluginClassMedia *mMediaPlugin; std::string mURL; F32 mGain; + std::string mVersion; }; diff --git a/linden/indra/newview/llviewerparcelmgr.cpp b/linden/indra/newview/llviewerparcelmgr.cpp index b589f2e..630da54 100644 --- a/linden/indra/newview/llviewerparcelmgr.cpp +++ b/linden/indra/newview/llviewerparcelmgr.cpp @@ -35,7 +35,7 @@ #include "llviewerparcelmgr.h" // Library includes -#include "llaudioengine.h" +#include "kokuastreamingaudio.h" #include "indra_constants.h" #include "llcachename.h" #include "llgl.h" @@ -1672,7 +1672,7 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use else { // look for music. - if (gAudiop) + if (gAudioStream) { if (parcel) { @@ -1685,12 +1685,12 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use // On entering a new parcel, stop the last stream if the // new parcel has a different music url. (Empty URL counts // as different.) - const std::string& stream_url = gAudiop->getInternetStreamURL(); + const std::string& stream_url = gAudioStream->getInternetStreamURL(); if (music_url.empty() || music_url != stream_url) { // URL is different from one currently playing. - gAudiop->stopInternetStream(); + gAudioStream->stopInternetStream(); // If there is a new music URL and it's valid, play it. if (music_url.size() > 12) @@ -1700,19 +1700,19 @@ void LLViewerParcelMgr::processParcelProperties(LLMessageSystem *msg, void **use optionally_start_music(music_url); } } - else if (!gAudiop->getInternetStreamURL().empty()) + else if (!gAudioStream->getInternetStreamURL().empty()) { llinfos << "Stopping parcel music" << llendl; - gAudiop->startInternetStream(LLStringUtil::null); + gAudioStream->startInternetStream(LLStringUtil::null); } } } else { // Public land has no music - gAudiop->stopInternetStream(); + gAudioStream->stopInternetStream(); } - }//if gAudiop + }//if gAudioStream // now check for video LLViewerParcelMedia::update( parcel ); @@ -1730,7 +1730,7 @@ void optionally_start_music(const std::string& music_url) // changed as part of SL-4878 if ( gOverlayBar && gOverlayBar->musicPlaying()) { - gAudiop->startInternetStream(music_url); + gAudioStream->startInternetStream(music_url); } } } -- cgit v1.1