diff --git a/Engine/source/gui/shiny/guiAudioCtrl.cpp b/Engine/source/gui/shiny/guiAudioCtrl.cpp
index 96fe5f097..a077ee24f 100644
--- a/Engine/source/gui/shiny/guiAudioCtrl.cpp
+++ b/Engine/source/gui/shiny/guiAudioCtrl.cpp
@@ -43,42 +43,38 @@ GuiAudioCtrl::GuiAudioCtrl()
mTickPeriodMS = 100;
mLastThink = 0;
mCurrTick = 0;
- mPlayIf = "";
mSoundPlaying = NULL;
mUseTrackDescriptionOnly = false;
- mDescription.mIs3D = false;
- mDescription.mIsLooping = true;
- mDescription.mIsStreaming = false;
- mDescription.mFadeInTime = -1.f;
- mDescription.mFadeOutTime = -1.f;
-
mVolume = 1;
mPitch = 1;
mFadeInTime = -1;
mFadeOutTime = -1;
mSourceGroup = NULL;
- setProcessTicks();
}
GuiAudioCtrl::~GuiAudioCtrl()
{
- if (mSoundPlaying)
- mSoundPlaying->stop();
SFX_DELETE(mSoundPlaying);
}
bool GuiAudioCtrl::onWake()
{
- return Parent::onWake();
+ bool awake = Parent::onWake();
+ setProcessTicks();
+ _update();
+ return awake;
}
void GuiAudioCtrl::onSleep()
{
- if (mSoundPlaying)
- mSoundPlaying->stop();
- SFX_DELETE(mSoundPlaying);
Parent::onSleep();
+ _update();
+}
+
+void GuiAudioCtrl::onRemove()
+{
+ Parent::onRemove();
}
void GuiAudioCtrl::processTick()
@@ -154,22 +150,13 @@ void GuiAudioCtrl::initPersistFields()
void GuiAudioCtrl::_update()
{
- if (isSoundValid())
- {
- //mLocalProfile = *mSoundAsset->getSfxProfile();
- mDescription = *mSoundAsset->getSfxDescription();
- }
-
- // Make sure all the settings are valid.
- mDescription.validate();
-
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile());
if (getSoundProfile())
{
if (mSoundPlaying == NULL)
{
- mSoundPlaying = SFX->createSource(getSoundProfile());
+ mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform()));
}
}
@@ -193,9 +180,9 @@ void GuiAudioCtrl::_update()
}
- if (testCondition() && isActive() && isAwake())
+ if (isAwake())
{
- if (mSoundPlaying && !mSoundPlaying->isPlaying())
+ if (testCondition() && mSoundPlaying && !mSoundPlaying->isPlaying())
{
mSoundPlaying->play();
}
@@ -205,6 +192,8 @@ void GuiAudioCtrl::_update()
if (mSoundPlaying != NULL)
{
mSoundPlaying->stop();
+ SFX_DELETE(mSoundPlaying);
+ setProcessTicks(false);
}
}
}
diff --git a/Engine/source/gui/shiny/guiAudioCtrl.h b/Engine/source/gui/shiny/guiAudioCtrl.h
index 32a674cf6..dabd32f60 100644
--- a/Engine/source/gui/shiny/guiAudioCtrl.h
+++ b/Engine/source/gui/shiny/guiAudioCtrl.h
@@ -72,7 +72,6 @@ protected:
bool mUseTrackDescriptionOnly;
/// The description and variant values used by the local profile.
- SFXDescription mDescription;
SFXSource* mSourceGroup;
F32 mVolume;
F32 mPitch;
@@ -91,6 +90,7 @@ public:
// GuiControl.
bool onWake() override;
void onSleep() override;
+ void onRemove() override;
void setActive(bool value) override {};
bool testCondition();
static void initPersistFields();
diff --git a/Templates/BaseGame/game/core/gui/scripts/profiles.tscript b/Templates/BaseGame/game/core/gui/scripts/profiles.tscript
index fe02febfa..994d80fc8 100644
--- a/Templates/BaseGame/game/core/gui/scripts/profiles.tscript
+++ b/Templates/BaseGame/game/core/gui/scripts/profiles.tscript
@@ -79,6 +79,8 @@ new GuiControlProfile (GuiDefaultProfile)
returnTab = false;
numbersOnly = false;
cursorColor = "0 0 0 255";
+ soundButtonDownAsset = "Core_GUI:buttonClick";
+ soundButtonOverAsset = "Core_GUI:buttonHover";
};
if(!isObject(GuiNonModalDefaultProfile))
diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml b/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml
new file mode 100644
index 000000000..1ccdee6d9
--- /dev/null
+++ b/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonClick.wav b/Templates/BaseGame/game/core/gui/sounds/buttonClick.wav
new file mode 100644
index 000000000..ec55432ee
Binary files /dev/null and b/Templates/BaseGame/game/core/gui/sounds/buttonClick.wav differ
diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml b/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml
new file mode 100644
index 000000000..45200a373
--- /dev/null
+++ b/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml
@@ -0,0 +1,10 @@
+
+
+
+
+
diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonHover.wav b/Templates/BaseGame/game/core/gui/sounds/buttonHover.wav
new file mode 100644
index 000000000..e7276cde4
Binary files /dev/null and b/Templates/BaseGame/game/core/gui/sounds/buttonHover.wav differ