Fixed a shutdown crash in LLAudioEngine::assetCallback, and fixed behavior when soundsource re-issues a sound whilst a sound is currently playing for same source. (LLAudioChannel[Impl]::play now re-starts sound if already playing)
This commit is contained in:
@@ -1249,6 +1249,9 @@ void LLAudioEngine::startNextTransfer()
|
|||||||
// static
|
// static
|
||||||
void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status)
|
void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status)
|
||||||
{
|
{
|
||||||
|
if(!gAudiop)
|
||||||
|
return;
|
||||||
|
|
||||||
if (result_code)
|
if (result_code)
|
||||||
{
|
{
|
||||||
LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL;
|
LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL;
|
||||||
@@ -1469,6 +1472,19 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(mCurrentDatap == adp) //Desired sound did not change. Just re-play it.
|
||||||
|
{
|
||||||
|
if(getChannel() && getChannel()->isPlaying())
|
||||||
|
getChannel()->play();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else //Desired sound did change. Release the old channel if set.
|
||||||
|
{
|
||||||
|
if(getChannel())
|
||||||
|
getChannel()->cleanup();
|
||||||
|
mPlayedOnce = false; //Reset the played flag so the new sound is actually started up.
|
||||||
|
}
|
||||||
|
|
||||||
mCurrentDatap = adp;
|
mCurrentDatap = adp;
|
||||||
|
|
||||||
// Make sure the audio engine knows that we want to request this sound.
|
// Make sure the audio engine knows that we want to request this sound.
|
||||||
|
|||||||
@@ -600,6 +600,12 @@ void LLAudioChannelFMOD::play()
|
|||||||
llwarns << "Playing without a channelID, aborting" << llendl;
|
llwarns << "Playing without a channelID, aborting" << llendl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!FSOUND_IsPaused(mChannelID))
|
||||||
|
{
|
||||||
|
FSOUND_SetPaused(mChannelID, true);
|
||||||
|
FSOUND_SetCurrentPosition(mChannelID, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!FSOUND_SetPaused(mChannelID, false))
|
if (!FSOUND_SetPaused(mChannelID, false))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -823,6 +823,13 @@ void LLAudioChannelFMODEX::play()
|
|||||||
|
|
||||||
gSoundCheck.assertActiveState(this,true);
|
gSoundCheck.assertActiveState(this,true);
|
||||||
|
|
||||||
|
bool paused=true;
|
||||||
|
Check_FMOD_Error(mChannelp->getPaused(&paused), "FMOD::Channel::getPaused");
|
||||||
|
if(!paused)
|
||||||
|
{
|
||||||
|
Check_FMOD_Error(mChannelp->setPaused(true), "FMOD::Channel::setPaused");
|
||||||
|
Check_FMOD_Error(mChannelp->setPosition(0,FMOD_TIMEUNIT_PCMBYTES), "FMOD::Channel::setPosition");
|
||||||
|
}
|
||||||
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::setPaused");
|
Check_FMOD_Error(mChannelp->setPaused(false), "FMOD::Channel::setPaused");
|
||||||
|
|
||||||
if(sVerboseDebugging)
|
if(sVerboseDebugging)
|
||||||
|
|||||||
@@ -199,11 +199,13 @@ void LLAudioChannelOpenAL::play()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlaying())
|
if(isPlaying())
|
||||||
{
|
{
|
||||||
alSourcePlay(mALSource);
|
alSourceStop(mALSource);
|
||||||
getSource()->setPlayedOnce(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alSourcePlay(mALSource);
|
||||||
|
getSource()->setPlayedOnce(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp)
|
void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp)
|
||||||
|
|||||||
@@ -4901,11 +4901,7 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow
|
|||||||
mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER);
|
mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER);
|
||||||
mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE);
|
mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE);
|
||||||
mAudioSourcep->setQueueSounds(queue);
|
mAudioSourcep->setQueueSounds(queue);
|
||||||
if(!queue) // stop any current sound first to avoid "farts of doom" (SL-1541) -MG
|
|
||||||
{
|
|
||||||
mAudioSourcep->play(LLUUID::null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Play this sound if region maturity permits
|
// Play this sound if region maturity permits
|
||||||
if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) )
|
if( gAgent.canAccessMaturityAtGlobal(this->getPositionGlobal()) )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user