mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Sfx playlist asset working (#1109)
* GroundWork -Reverted SFXPlaylist since it is going to be made from an asset now instead. -Added extra options to soundAssets description. -SFXPlaylist may need an onAdd function * Update sfxController.cpp * SFXPlaylist data -Added sfxPlaylist init persist fields for the slots to sound asset -Added logic to fil sfxPlaylist if more than 1 slot is filled * Update SoundAsset.cpp to stop git ci complaining, assetImporter........ * Update SoundAsset.h * sfxPlaylist -Fix: incomplete type error -Added onAdd and onRemove to playlist -SoundAsset getProfile define now returns playlist if the asset is a playlist. * Update SoundAsset.h -updated asset array to return playlist or profile depending on what the asset is * SFXPlaylist working -SFXPlaylist works AudioChannelDefault gets its volume set to 0 for some reason and was throwing off making sfxPlaylist inaudible. Still an exception when closing if using a playlist trips on line 355 of sfxSound * Update sfxSound.h * setSoundFile index null fix * Update SoundAsset.h * Update SoundAsset.h * netstream safety in case of a null asset assignment * Update sfxController.cpp added safeties around a null playlist trying to play. * Update with Az's asset err code changes --------- Co-authored-by: AzaezelX <quillus@hotmail.com>
This commit is contained in:
parent
845defb25d
commit
852ed8f225
14 changed files with 550 additions and 245 deletions
|
|
@ -106,8 +106,7 @@ SFXEmitter::SFXEmitter()
|
|||
mDescription.mFadeInTime = -1.f;
|
||||
mDescription.mFadeOutTime = -1.f;
|
||||
mInstanceDescription = &mDescription;
|
||||
mLocalProfile.mFilename = StringTable->EmptyString();
|
||||
mLocalProfile._registerSignals();
|
||||
mLocalProfile = NULL;
|
||||
|
||||
INIT_ASSET(Sound);
|
||||
|
||||
|
|
@ -119,7 +118,9 @@ SFXEmitter::SFXEmitter()
|
|||
|
||||
SFXEmitter::~SFXEmitter()
|
||||
{
|
||||
mLocalProfile.onRemove();
|
||||
if(mLocalProfile != NULL)
|
||||
mLocalProfile->onRemove();
|
||||
|
||||
SFX_DELETE( mSource );
|
||||
}
|
||||
|
||||
|
|
@ -653,7 +654,7 @@ void SFXEmitter::_update()
|
|||
SFXStatus prevState = mSource ? mSource->getStatus() : SFXStatusNull;
|
||||
|
||||
// are we overriding the asset properties?
|
||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && mSoundAsset->getSfxProfile());
|
||||
bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile());
|
||||
|
||||
if (mSoundAsset.notNull())
|
||||
{
|
||||
|
|
@ -662,12 +663,12 @@ void SFXEmitter::_update()
|
|||
else
|
||||
mInstanceDescription = &mDescription;
|
||||
|
||||
mLocalProfile = *mSoundAsset->getSfxProfile();
|
||||
}
|
||||
// Make sure all the settings are valid.
|
||||
mInstanceDescription->validate();
|
||||
mLocalProfile.setDescription(mInstanceDescription);
|
||||
mLocalProfile = getSoundProfile();
|
||||
|
||||
// Make sure all the settings are valid.
|
||||
mInstanceDescription->validate();
|
||||
mLocalProfile->setDescription(mInstanceDescription);
|
||||
}
|
||||
|
||||
const MatrixF& transform = getTransform();
|
||||
const VectorF& velocity = getVelocity();
|
||||
|
|
@ -676,12 +677,12 @@ void SFXEmitter::_update()
|
|||
if( mDirty.test( Track | Is3D | IsLooping | IsStreaming | TrackOnly ) )
|
||||
{
|
||||
SFX_DELETE( mSource );
|
||||
if (mLocalProfile.getSoundFileName().isNotEmpty())
|
||||
if (getSoundProfile())
|
||||
{
|
||||
mSource = SFX->createSource(&mLocalProfile, &transform, &velocity);
|
||||
mSource = SFX->createSource(mLocalProfile, &transform, &velocity);
|
||||
if (!mSource)
|
||||
Con::errorf("SFXEmitter::_update() - failed to create sound for track %i (%s)",
|
||||
mSoundAsset->getSfxProfile()->getId(), mSoundAsset->getSfxProfile()->getName());
|
||||
getSoundProfile()->getId(), getSoundProfile()->getName());
|
||||
|
||||
// If we're supposed to play when the emitter is
|
||||
// added to the scene then also restart playback
|
||||
|
|
@ -1043,8 +1044,8 @@ SFXStatus SFXEmitter::_getPlaybackStatus() const
|
|||
|
||||
bool SFXEmitter::is3D() const
|
||||
{
|
||||
if( mSoundAsset.notNull() && mSoundAsset->getSfxProfile() != NULL )
|
||||
return mSoundAsset->getSfxProfile()->getDescription()->mIs3D;
|
||||
if( mSoundAsset.notNull() )
|
||||
return mSoundAsset->getSfxDescription()->mIs3D;
|
||||
else
|
||||
return mInstanceDescription->mIs3D;
|
||||
}
|
||||
|
|
@ -1080,8 +1081,8 @@ void SFXEmitter::setScale( const VectorF &scale )
|
|||
{
|
||||
F32 maxDistance;
|
||||
|
||||
if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && mSoundAsset->getSfxProfile())
|
||||
maxDistance = mSoundAsset->getSfxProfile()->getDescription()->mMaxDistance;
|
||||
if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile())
|
||||
maxDistance = mSoundAsset->getSfxDescription()->mMaxDistance;
|
||||
else
|
||||
{
|
||||
// Use the average of the three coords.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue