Browse Source

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)

AzaezelX 3 years ago
parent
commit
670b246a2a

+ 2 - 2
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.

+ 10 - 4
Engine/source/sfx/sfxPlayList.cpp

@@ -220,6 +220,8 @@ SFXPlayList::SFXPlayList()
      mTrace( false ),
      mNumSlotsToPlay( NUM_SLOTS )
 {
+   for (U32 i=0;i<NUM_SLOTS;i++)
+      INIT_ASSET_ARRAY(Track, i);
 }
 
 //-----------------------------------------------------------------------------
@@ -247,7 +249,7 @@ void SFXPlayList::initPersistFields()
    
       addArray( "slots", NUM_SLOTS );
       
-         addField( "track",                  TypeSFXTrackName, Offset( mSlots.mTrack, SFXPlayList ), NUM_SLOTS,
+         INITPERSISTFIELD_SOUNDASSET_ARRAY( Track, NUM_SLOTS, SFXPlayList,
             "Track to play in this slot.\n"
             "This must be set for the slot to be considered for playback.  Other settings for a slot "
             "will not take effect except this field is set." );
@@ -350,8 +352,12 @@ bool SFXPlayList::preload( bool server, String& errorStr )
    {
       for( U32 i = 0; i < NUM_SLOTS; ++ i )
       {
-         if( !sfxResolve( &mSlots.mTrack[ i ], errorStr ) )
+         _setTrack(getTrack(i),i);
+         if (!getTrackProfile(i))
+         {
+            Con::errorf("SFXPlayList::Preload() - unable to find sfxProfile for asset %s", mTrackAssetId[i]);
             return false;
+         }
             
          if( !sfxResolve( &mSlots.mState[ i ], errorStr ) )
             return false;
@@ -419,7 +425,7 @@ void SFXPlayList::packData( BitStream* stream )
       stream->write( 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
 }

+ 8 - 6
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.

+ 2 - 0
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;