diff options
Diffstat (limited to 'indra/llaudio')
| -rw-r--r-- | indra/llaudio/llaudioengine.cpp | 9 | ||||
| -rw-r--r-- | indra/llaudio/llaudioengine.h | 6 | ||||
| -rw-r--r-- | indra/llaudio/llaudioengine_fmodstudio.cpp | 4 | ||||
| -rw-r--r-- | indra/llaudio/llaudioengine_openal.cpp | 2 | ||||
| -rw-r--r-- | indra/llaudio/llstreamingaudio_fmodstudio.cpp | 33 | 
5 files changed, 38 insertions, 16 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index e0ebbb76bd..9e897a7ce8 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -276,7 +276,7 @@ void LLAudioEngine::idle(F32 max_decode_time)  		{  			// The source is done playing, clean it up.  			delete sourcep; -			mAllSources.erase(iter++); +            iter = mAllSources.erase(iter);  			continue;  		} @@ -827,7 +827,8 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i  	addAudioSource(asp);  	if (pos_global.isExactlyZero())  	{ -		asp->setAmbient(true); +		// For sound preview and UI +		asp->setForcedPriority(true);  	}  	else  	{ @@ -1273,7 +1274,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32  	mPriority(0.f),  	mGain(gain),  	mSourceMuted(false), -	mAmbient(false), +	mForcedPriority(false),  	mLoop(false),  	mSyncMaster(false),  	mSyncSlave(false), @@ -1339,7 +1340,7 @@ void LLAudioSource::update()  void LLAudioSource::updatePriority()  { -	if (isAmbient()) +	if (isForcedPriority())  	{  		mPriority = 1.f;  	} diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index b5fd4c27a1..e12fb970ca 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -266,8 +266,8 @@ public:  	void addAudioData(LLAudioData *adp, bool set_current = TRUE); -	void setAmbient(const bool ambient)						{ mAmbient = ambient; } -	bool isAmbient() const									{ return mAmbient; } +	void setForcedPriority(const bool ambient)						{ mForcedPriority = ambient; } +	bool isForcedPriority() const									{ return mForcedPriority; }  	void setLoop(const bool loop)							{ mLoop = loop; }  	bool isLoop() const										{ return mLoop; } @@ -326,7 +326,7 @@ protected:  	F32				mPriority;  	F32				mGain;  	bool			mSourceMuted; -	bool			mAmbient; +	bool			mForcedPriority; // ignore mute, set high priority, researved for sound preview and UI  	bool			mLoop;  	bool			mSyncMaster;  	bool			mSyncSlave; diff --git a/indra/llaudio/llaudioengine_fmodstudio.cpp b/indra/llaudio/llaudioengine_fmodstudio.cpp index b0c87b0208..e5752d3dad 100644 --- a/indra/llaudio/llaudioengine_fmodstudio.cpp +++ b/indra/llaudio/llaudioengine_fmodstudio.cpp @@ -519,9 +519,9 @@ void LLAudioChannelFMODSTUDIO::update3DPosition()          return;      } -    if (mCurrentSourcep->isAmbient()) +    if (mCurrentSourcep->isForcedPriority())      { -        // Ambient sound, don't need to do any positional updates. +        // Prioritized UI and preview sounds don't need to do any positional updates.          set3DMode(false);      }      else diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 3bdd0302ee..305aa1ecb5 100644 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -297,7 +297,7 @@ void LLAudioChannelOpenAL::update3DPosition()  	{  		return;  	} -	if (mCurrentSourcep->isAmbient()) +	if (mCurrentSourcep->isForcedPriority())  	{  		alSource3f(mALSource, AL_POSITION, 0.0, 0.0, 0.0);  		alSource3f(mALSource, AL_VELOCITY, 0.0, 0.0, 0.0); diff --git a/indra/llaudio/llstreamingaudio_fmodstudio.cpp b/indra/llaudio/llstreamingaudio_fmodstudio.cpp index 1ad29a3f59..85577992a6 100644 --- a/indra/llaudio/llstreamingaudio_fmodstudio.cpp +++ b/indra/llaudio/llstreamingaudio_fmodstudio.cpp @@ -70,7 +70,11 @@ mRetryCount(0)      // Must be larger than the usual Second Life frame stutter time.      const U32 buffer_seconds = 10;		//sec      const U32 estimated_bitrate = 128;	//kbit/sec -    mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES); +    FMOD_RESULT result = mSystem->setStreamBufferSize(estimated_bitrate * buffer_seconds * 128/*bytes/kbit*/, FMOD_TIMEUNIT_RAWBYTES); +    if (result != FMOD_OK) +    { +        LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL; +    }      // Here's where we set the size of the network buffer and some buffering       // parameters.  In this case we want a network buffer of 16k, we want it  @@ -134,7 +138,7 @@ void LLStreamingAudio_FMODSTUDIO::killDeadStreams()          {              LL_INFOS("FMOD") << "Closed dead stream" << LL_ENDL;              delete streamp; -            mDeadStreams.erase(iter++); +            iter = mDeadStreams.erase(iter);          }          else          { @@ -404,7 +408,11 @@ FMOD::Channel *LLAudioStreamManagerFMODSTUDIO::startStream()      if (mStreamChannel)          return mStreamChannel;	//Already have a channel for this stream. -    mSystem->playSound(mInternetStream, NULL, true, &mStreamChannel); +    FMOD_RESULT result = mSystem->playSound(mInternetStream, NULL, true, &mStreamChannel); +    if (result != FMOD_OK) +    { +        LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL; +    }      return mStreamChannel;  } @@ -445,16 +453,29 @@ bool LLAudioStreamManagerFMODSTUDIO::stopStream()  FMOD_OPENSTATE LLAudioStreamManagerFMODSTUDIO::getOpenState(unsigned int* percentbuffered, bool* starving, bool* diskbusy)  {      FMOD_OPENSTATE state; -    mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy); +    FMOD_RESULT result = mInternetStream->getOpenState(&state, percentbuffered, starving, diskbusy); +    if (result != FMOD_OK) +    { +        LL_WARNS("FMOD") << FMOD_ErrorString(result) << LL_ENDL; +    }      return state;  }  void LLStreamingAudio_FMODSTUDIO::setBufferSizes(U32 streambuffertime, U32 decodebuffertime)  { -    mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES); +    FMOD_RESULT result = mSystem->setStreamBufferSize(streambuffertime / 1000 * 128 * 128, FMOD_TIMEUNIT_RAWBYTES); +    if (result != FMOD_OK) +    { +        LL_WARNS("FMOD") << "setStreamBufferSize error: " << FMOD_ErrorString(result) << LL_ENDL; +        return; +    }      FMOD_ADVANCEDSETTINGS settings;      memset(&settings, 0, sizeof(settings));      settings.cbSize = sizeof(settings);      settings.defaultDecodeBufferSize = decodebuffertime;//ms -    mSystem->setAdvancedSettings(&settings); +    result = mSystem->setAdvancedSettings(&settings); +    if (result != FMOD_OK) +    { +        LL_WARNS("FMOD") << "setAdvancedSettings error: " << FMOD_ErrorString(result) << LL_ENDL; +    }  }  | 
