From 670b246a2acb5cf27365c5c7d6e8eaf36c80c36a Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Thu, 14 Oct 2021 22:33:13 -0500 Subject: [PATCH] sound asset conversions - playlist (as a point of significance, that no longer uses mSlots.mTrack[ i ] on the backend. just th equivalent of mTrack[i]. While the former was certainly useful for clustering, it's actively fighting standarization) --- Engine/source/sfx/sfxController.cpp | 4 ++-- Engine/source/sfx/sfxPlayList.cpp | 14 ++++++++++---- Engine/source/sfx/sfxPlayList.h | 14 ++++++++------ .../scripts/pre40/T3Dpre4ProjectImporter.tscript | 2 ++ 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Engine/source/sfx/sfxController.cpp b/Engine/source/sfx/sfxController.cpp index 6bb5924b9..4946280ff 100644 --- a/Engine/source/sfx/sfxController.cpp +++ b/Engine/source/sfx/sfxController.cpp @@ -166,7 +166,7 @@ void SFXController::_compileList( SFXPlayList* playList ) // If there's no track in this slot, ignore it. - if( !playList->getSlots().mTrack[ slotIndex ] ) + if( !playList->getTrackProfile(slotIndex)) continue; // If this is a looped slot and the list is not set to loop @@ -393,7 +393,7 @@ bool SFXController::_execInsn() case OP_Play: { SFXPlayList* playList = getPlayList(); - SFXTrack* track = playList->getSlots().mTrack[ insn.mSlotIndex ]; + SFXTrack* track = playList->getTrackProfile(insn.mSlotIndex); // Handle existing sources playing on this slot and find // whether we need to start a new source. diff --git a/Engine/source/sfx/sfxPlayList.cpp b/Engine/source/sfx/sfxPlayList.cpp index ffbbaf68d..0e56d4607 100644 --- a/Engine/source/sfx/sfxPlayList.cpp +++ b/Engine/source/sfx/sfxPlayList.cpp @@ -220,6 +220,8 @@ SFXPlayList::SFXPlayList() mTrace( false ), mNumSlotsToPlay( NUM_SLOTS ) { + for (U32 i=0;iwrite( mSlots.mRepeatCount[ i ] ); FOR_EACH_SLOT sfxWrite( stream, mSlots.mState[ i ] ); - FOR_EACH_SLOT sfxWrite( stream, mSlots.mTrack[ i ] ); + FOR_EACH_SLOT PACKDATA_ASSET_ARRAY(Track, i); } //----------------------------------------------------------------------------- @@ -458,7 +464,7 @@ void SFXPlayList::unpackData( BitStream* stream ) FOR_EACH_SLOT if(stream->readFlag()){ stream->read( &mSlots.mRepeatCount[ i ] );} FOR_EACH_SLOT sfxRead( stream, &mSlots.mState[ i ] ); - FOR_EACH_SLOT sfxRead( stream, &mSlots.mTrack[ i ] ); + FOR_EACH_SLOT UNPACKDATA_ASSET_ARRAY(Track, i); #undef FOR_EACH_SLOT } diff --git a/Engine/source/sfx/sfxPlayList.h b/Engine/source/sfx/sfxPlayList.h index 6bde33734..1043bf988 100644 --- a/Engine/source/sfx/sfxPlayList.h +++ b/Engine/source/sfx/sfxPlayList.h @@ -30,6 +30,10 @@ #include "sfx/sfxTrack.h" #endif +#ifndef SOUND_ASSET_H +#include "T3D/assets/SoundAsset.h" +#endif + class SFXState; @@ -256,10 +260,7 @@ class SFXPlayList : public SFXTrack /// Bahavior when state of this slot is deactivated and the slot's track /// is playing. EStateMode mStateMode[ NUM_SLOTS ]; - - /// Track to play in this slot. - SFXTrack* mTrack[ NUM_SLOTS ]; - + SlotData() { dMemset( mReplayMode, 0, sizeof( mReplayMode ) ); @@ -267,7 +268,6 @@ class SFXPlayList : public SFXTrack dMemset( mTransitionOut, 0, sizeof( mTransitionOut ) ); dMemset( mRepeatCount, 0, sizeof( mRepeatCount ) ); dMemset( mState, 0, sizeof( mState ) ); - dMemset( mTrack, 0, sizeof( mTrack ) ); dMemset( mStateMode, 0, sizeof( mStateMode ) ); for( U32 i = 0; i < NUM_SLOTS; ++ i ) @@ -282,7 +282,9 @@ class SFXPlayList : public SFXTrack } } }; - + DECLARE_SOUNDASSET_ARRAY(SFXPlayList, Track, NUM_SLOTS); + DECLARE_ASSET_ARRAY_SETGET(SFXPlayList, Track); + protected: /// Trace interpreter execution. This field is not networked. diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript index 67d683968..78cdfecf8 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript @@ -1080,6 +1080,8 @@ T3Dpre4ProjectImporter::genProcessor("PostEffect", "texture textureAsset"); // our meta-properties on the sound asset itself. //============================================================================== T3Dpre4ProjectImporter::genProcessor("SFXAmbience", "soundTrack soundTrackAsset"); +T3Dpre4ProjectImporter::genProcessor("SFXPlayList", "track trackAsset"); + function T3Dpre4ProjectImporter::processSFXProfileLine(%this, %line) { return %line;