Skip to content

Commit

Permalink
Merge pull request #1304 from Azaezel/alpha41/audiofix2
Browse files Browse the repository at this point in the history
guiaudio crashfix on exit
  • Loading branch information
Azaezel authored Aug 8, 2024
2 parents 35e50b5 + 1055dc8 commit 2bbd5db
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions Engine/source/gui/shiny/guiAudioCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,48 +150,48 @@ void GuiAudioCtrl::initPersistFields()

void GuiAudioCtrl::_update()
{
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());

if (getSoundProfile())
if (testCondition() && isAwake())
{
if (mSoundPlaying == NULL)
{
mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
}
}
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());

// The rest only applies if we have a source.
if (mSoundPlaying && !useTrackDescriptionOnly)
{

// Set the volume irrespective of the profile.
if (mSourceGroup)
{
mSourceGroup->addObject(mSoundPlaying);
mSoundPlaying->setVolume(mSourceGroup->getVolume() * mVolume);
}
else
if (getSoundProfile())
{
mSoundPlaying->setVolume(mVolume);
if (mSoundPlaying == NULL)
{
mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
}
}

mSoundPlaying->setPitch(mPitch);
mSoundPlaying->setFadeTimes(mFadeInTime, mFadeOutTime);

}

if (isAwake())
{
if (testCondition() && mSoundPlaying && !mSoundPlaying->isPlaying())
if ( mSoundPlaying && !mSoundPlaying->isPlaying())
{
// The rest only applies if we have a source.
if (!useTrackDescriptionOnly)
{

// Set the volume irrespective of the profile.
if (mSourceGroup)
{
mSourceGroup->addObject(mSoundPlaying);
mSoundPlaying->setVolume(mSourceGroup->getVolume() * mVolume);
}
else
{
mSoundPlaying->setVolume(mVolume);
}

mSoundPlaying->setPitch(mPitch);
mSoundPlaying->setFadeTimes(mFadeInTime, mFadeOutTime);

}

mSoundPlaying->play();
}
}
else
{
if (mSoundPlaying != NULL)
{
mSoundPlaying->stop();
SFX_DELETE(mSoundPlaying);
setProcessTicks(false);
}
Expand Down

0 comments on commit 2bbd5db

Please sign in to comment.