Cleaned up implementation of #712

Also updates other game classes like the shapebase to utilize the sound asset hooks properly.
This commit is contained in:
JeffR 2022-01-03 20:57:10 -06:00
parent 3812ce2e82
commit 15ef8b4fbe
12 changed files with 312 additions and 187 deletions

View file

@ -265,6 +265,7 @@ struct ShapeBaseImageData: public GameBaseData {
F32 emitterTime; ///<
S32 emitterNode[MaxShapes]; ///< Node ID on the shape to emit from
SoundAsset* sound;
SFXTrack* soundTrack; ///<Holdover for special, non-asset cases like SFXPlaylists
};
/// @name State Data
/// Individual state data used to initialize struct array
@ -744,13 +745,13 @@ protected:
/// @name Scripted Sound
/// @{
struct Sound {
struct SoundThread {
bool play; ///< Are we playing this sound?
SimTime timeout; ///< Time until we stop playing this sound.
SFXTrack* profile; ///< Profile on server
AssetPtr<SoundAsset> asset; ///< Asset on server
SFXSource* sound; ///< Sound on client
};
Sound mSoundThread[MaxSoundThreads];
SoundThread mSoundThread[MaxSoundThreads];
/// @}
/// @name Scripted Animation Threads
@ -1114,7 +1115,7 @@ protected:
/// Updates the audio state of the supplied sound
/// @param st Sound
void updateAudioState(Sound& st);
void updateAudioState(SoundThread& st);
/// Recalculates the spacial sound based on the current position of the object
/// emitting the sound.
@ -1328,9 +1329,7 @@ public:
/// Plays an audio sound from a mounted object
/// @param slot Mount slot ID
/// @param track Audio track to play
void playAudio(U32 slot,SFXTrack* track);
void playAudio( U32 slot, SFXProfile* profile ) { playAudio( slot, ( SFXTrack* ) profile ); }
void playAudio(U32 slot, StringTableEntry assetId);
/// Stops audio from a mounted object
/// @param slot Mount slot ID