mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 23:24:41 +00:00
Merge pull request #1304 from Azaezel/alpha41/audiofix2
guiaudio crashfix on exit
This commit is contained in:
commit
2bbd5db767
1 changed files with 28 additions and 28 deletions
|
|
@ -150,40 +150,41 @@ void GuiAudioCtrl::initPersistFields()
|
||||||
|
|
||||||
void GuiAudioCtrl::_update()
|
void GuiAudioCtrl::_update()
|
||||||
{
|
{
|
||||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());
|
|
||||||
|
|
||||||
if (getSoundProfile())
|
if (testCondition() && isAwake())
|
||||||
{
|
{
|
||||||
if (mSoundPlaying == NULL)
|
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());
|
||||||
{
|
|
||||||
mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The rest only applies if we have a source.
|
if (getSoundProfile())
|
||||||
if (mSoundPlaying && !useTrackDescriptionOnly)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Set the volume irrespective of the profile.
|
|
||||||
if (mSourceGroup)
|
|
||||||
{
|
{
|
||||||
mSourceGroup->addObject(mSoundPlaying);
|
if (mSoundPlaying == NULL)
|
||||||
mSoundPlaying->setVolume(mSourceGroup->getVolume() * mVolume);
|
{
|
||||||
}
|
mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
|
||||||
else
|
}
|
||||||
{
|
|
||||||
mSoundPlaying->setVolume(mVolume);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mSoundPlaying->setPitch(mPitch);
|
if ( mSoundPlaying && !mSoundPlaying->isPlaying())
|
||||||
mSoundPlaying->setFadeTimes(mFadeInTime, mFadeOutTime);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isAwake())
|
|
||||||
{
|
|
||||||
if (testCondition() && 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();
|
mSoundPlaying->play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -191,7 +192,6 @@ void GuiAudioCtrl::_update()
|
||||||
{
|
{
|
||||||
if (mSoundPlaying != NULL)
|
if (mSoundPlaying != NULL)
|
||||||
{
|
{
|
||||||
mSoundPlaying->stop();
|
|
||||||
SFX_DELETE(mSoundPlaying);
|
SFX_DELETE(mSoundPlaying);
|
||||||
setProcessTicks(false);
|
setProcessTicks(false);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue