diff --git a/Engine/source/T3D/assets/SoundAsset.cpp b/Engine/source/T3D/assets/SoundAsset.cpp index f4882c50f6..a26ef9b88f 100644 --- a/Engine/source/T3D/assets/SoundAsset.cpp +++ b/Engine/source/T3D/assets/SoundAsset.cpp @@ -59,33 +59,52 @@ IMPLEMENT_CONOBJECT(SoundAsset); -ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, const char*, ASSET_ID_FIELD_PREFIX) - //----------------------------------------------------------------------------- +// REFACTOR +//----------------------------------------------------------------------------- +IMPLEMENT_STRUCT(AssetPtr, AssetPtrSoundAsset, , "") +END_IMPLEMENT_STRUCT + +ConsoleType(SoundAssetPtr, TypeSoundAssetPtr, AssetPtr, ASSET_ID_FIELD_PREFIX) ConsoleGetType(TypeSoundAssetPtr) { // Fetch asset Id. - return *((const char**)(dptr)); + return (*((AssetPtr*)dptr)).getAssetId(); } -//----------------------------------------------------------------------------- - ConsoleSetType(TypeSoundAssetPtr) { // Was a single argument specified? if (argc == 1) { // Yes, so fetch field value. - *((const char**)dptr) = StringTable->insert(argv[0]); + const char* pFieldValue = argv[0]; + + // Fetch asset pointer. + AssetPtr* pAssetPtr = dynamic_cast*>((AssetPtrBase*)(dptr)); + + // Is the asset pointer the correct type? + if (pAssetPtr == NULL) + { + Con::warnf("(TypeSoundAssetPtrRefactor) - Failed to set asset Id '%d'.", pFieldValue); + return; + } + + // Set asset. + pAssetPtr->setAssetId(pFieldValue); return; } // Warn. - Con::warnf("(TypeSoundAssetPtr) - Cannot set multiple args to a single asset."); + Con::warnf("(TypeSoundAssetPtrRefactor) - Cannot set multiple args to a single asset."); } +//----------------------------------------------------------------------------- +// REFACTOR END +//----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- ConsoleType(assetIdString, TypeSoundAssetId, const char*, ASSET_ID_FIELD_PREFIX) @@ -122,7 +141,6 @@ const String SoundAsset::mErrCodeStrings[] = //----------------------------------------------------------------------------- SoundAsset::SoundAsset() - : AssetBase() { dMemset(mPlaylist.mSlots.mReplayMode, 0, sizeof(mPlaylist.mSlots.mReplayMode)); dMemset(mPlaylist.mSlots.mTransitionIn, 0, sizeof(mPlaylist.mSlots.mTransitionIn)); @@ -134,7 +152,7 @@ SoundAsset::SoundAsset() for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++) { mSoundFile[i] = StringTable->EmptyString(); - mSoundPath[i] = StringTable->EmptyString(); + mSoundResource[i] = NULL; mPlaylist.mSlots.mTransitionOut[i] = SFXPlayList::TRANSITION_Wait; mPlaylist.mSlots.mVolumeScale.mValue[i] = 1.f; @@ -173,7 +191,8 @@ SoundAsset::SoundAsset() mProfileDesc.mPriority = 1.0f; mProfileDesc.mSourceGroup = NULL; mProfileDesc.mFadeInEase = EaseF(); - mProfileDesc.mReverb = SFXSoundReverbProperties(); + mProfileDesc.mSourceGroup = dynamic_cast(Sim::findObject("AudioChannelMaster")); + dMemset(mProfileDesc.mParameters, 0, sizeof(mProfileDesc.mParameters)); mIsPlaylist = false; @@ -183,21 +202,25 @@ SoundAsset::SoundAsset() mPlaylist.mLoopMode = SFXPlayList::LOOP_All; mPlaylist.mActiveSlots = 1; + mResolvedTrack = NULL; + mResolvedDescription = NULL; } //----------------------------------------------------------------------------- SoundAsset::~SoundAsset() { - - for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++) + if (mResolvedTrack) { - if(mSFXProfile[i].isProperlyAdded() && !mSFXProfile[i].isDeleted()) - mSFXProfile[i].unregisterObject(); + if (mResolvedTrack->isProperlyAdded() && !mResolvedTrack->isDeleted()) + mResolvedTrack->deleteObject(); } - if (mPlaylist.isProperlyAdded() && !mPlaylist.isDeleted()) - mPlaylist.unregisterObject(); + if (mResolvedDescription) + { + if (mResolvedDescription->isProperlyAdded() && !mResolvedDescription->isDeleted()) + mResolvedDescription->deleteObject(); + } } //----------------------------------------------------------------------------- @@ -323,15 +346,37 @@ void SoundAsset::initPersistFields() //------------------------------------------------------------------------------ +void SoundAsset::onRemove() +{ + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + { + if (mSoundFile[i] == StringTable->EmptyString()) + break; + + Torque::FS::RemoveChangeNotification(mSoundFile[i], this, &SoundAsset::_onResourceChanged); + } + + Parent::onRemove(); +} + +void SoundAsset::inspectPostApply() +{ + Parent::inspectPostApply(); + + refreshAsset(); +} + void SoundAsset::copyTo(SimObject* object) { // Call to parent. Parent::copyTo(object); + } void SoundAsset::initializeAsset(void) { Parent::initializeAsset(); + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) { if (i == 0 && mSoundFile[i] == StringTable->EmptyString()) @@ -340,10 +385,12 @@ void SoundAsset::initializeAsset(void) if (mSoundFile[i] == StringTable->EmptyString()) break; - mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i]; - if (!Torque::FS::IsFile(mSoundPath[i])) - Con::errorf("SoundAsset::initializeAsset (%s)[%d] could not find %s!", getAssetName(), i, mSoundPath[i]); + mSoundFile[i] = expandAssetFilePath(mSoundFile[i]); + if (getOwned()) + Torque::FS::AddChangeNotification(mSoundFile[i], this, &SoundAsset::_onResourceChanged); } + + populateSFXTrack(); } void SoundAsset::_onResourceChanged(const Torque::Path &path) @@ -351,132 +398,47 @@ void SoundAsset::_onResourceChanged(const Torque::Path &path) for (U32 i = 0; i < SFXPlayList::NUM_SLOTS; i++) { - if (path != Torque::Path(mSoundPath[i])) + if (path != Torque::Path(mSoundFile[i])) return; } + refreshAsset(); } void SoundAsset::onAssetRefresh(void) { - for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) - { - if (i == 0 && mSoundFile[i] == StringTable->EmptyString()) - return; - - if (mSoundFile[i] == StringTable->EmptyString()) - break; + if (!isProperlyAdded()) + return; - mSoundPath[i] = getOwned() ? expandAssetFilePath(mSoundFile[i]) : mSoundPath[i]; - } + Parent::onAssetRefresh(); + populateSFXTrack(); } U32 SoundAsset::load() { - if (mLoadedState == AssetErrCode::Ok) return mLoadedState; + if (mLoadedState == AssetErrCode::Ok) + return mLoadedState; - // find out how many active slots we have. - U32 numSlots = 0; - for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + if (!mResolvedTrack) { - if (i == 0 && mSoundPath[i] == StringTable->EmptyString()) - return false; - - if (mSoundPath[i] == StringTable->EmptyString()) - break; - - numSlots++; - } - - if (mProfileDesc.mSourceGroup == NULL) - mProfileDesc.mSourceGroup = dynamic_cast(Sim::findObject("AudioChannelMaster")); - - if (numSlots > 1) - { - mIsPlaylist = true; - - for (U32 i = 0; i < numSlots; i++) + if (mIsPlaylist) { - if (mSoundPath[i]) - { - if (!Torque::FS::IsFile(mSoundPath[i])) - { - Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[i]); - mLoadedState = BadFileReference; - mSFXProfile[i].setDescription(NULL); - mSFXProfile[i].setSoundFileName(StringTable->insert(StringTable->EmptyString())); - mSFXProfile[i].setPreload(false); - return mLoadedState; - } - else - { - SFXProfile* trackProfile = new SFXProfile(); - trackProfile->setDescription(&mProfileDesc); - trackProfile->setSoundFileName(mSoundPath[i]); - trackProfile->setPreload(mPreload); - - mSFXProfile[i] = *trackProfile; - mSFXProfile[i].registerObject(String::ToString("%s_profile_track%d", getAssetName()).c_str()); - - mPlaylist.mSlots.mTrack[i] = trackProfile; - - } - } + mResolvedTrack = buildPlaylist(); } - - mPlaylist.setDescription(&mProfileDesc); - mPlaylist.registerObject(String::ToString("%s_playlist", getAssetName()).c_str()); - } - else - { - if (mSoundPath[0]) + else { - if (!Torque::FS::IsFile(mSoundPath[0])) - { - Con::errorf("SoundAsset::initializeAsset: Attempted to load file %s but it was not valid!", mSoundFile[0]); - mLoadedState = BadFileReference; - mSFXProfile[0].setDescription(NULL); - mSFXProfile[0].setSoundFileName(StringTable->insert(StringTable->EmptyString())); - mSFXProfile[0].setPreload(false); - return mLoadedState; - } - else - { - mSFXProfile[0].setDescription(&mProfileDesc); - mSFXProfile[0].setSoundFileName(mSoundPath[0]); - mSFXProfile[0].setPreload(mPreload); - - mSFXProfile[0].registerObject(String::ToString("%s_profile", getAssetName()).c_str()); - } - + mResolvedTrack = buildProfile(); } + + mResolvedTrack->registerObject(String::ToString("%s_profile_track", getAssetName()).c_str()); } - mChangeSignal.trigger(); mLoadedState = Ok; return mLoadedState; } -bool SoundAsset::_setSoundFile(void* object, const char* index, const char* data) -{ - SoundAsset* pData = static_cast(object); - - U32 id = 0; - if (index) - id = dAtoui(index); - - // Update. - pData->mSoundFile[id] = StringTable->insert(data, true); - if (pData->mSoundFile[id] == StringTable->EmptyString()) - pData->mSoundPath[id] = StringTable->EmptyString(); - - // Refresh the asset. - pData->refreshAsset(); - return true; -} - -StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName) +StringTableEntry SoundAsset::getAssetIdByFilename(StringTableEntry fileName) { if (fileName == StringTable->EmptyString()) return StringTable->EmptyString(); @@ -492,7 +454,7 @@ StringTableEntry SoundAsset::getAssetIdByFileName(StringTableEntry fileName) SoundAsset* soundAsset = AssetDatabase.acquireAsset(query.mAssetList[i]); if (soundAsset) { - if (soundAsset->getSoundPath() == fileName) + if (soundAsset->getSoundFile() == fileName) soundAssetId = soundAsset->getAssetId(); AssetDatabase.releaseAsset(query.mAssetList[i]); @@ -519,7 +481,7 @@ U32 SoundAsset::getAssetById(StringTableEntry assetId, AssetPtr* sou } } -U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtr* soundAsset) +U32 SoundAsset::getAssetByFilename(StringTableEntry fileName, AssetPtr* soundAsset) { AssetQuery query; U32 foundAssetcount = AssetDatabase.findAssetType(&query, "SoundAsset"); @@ -534,7 +496,7 @@ U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtr(query.mAssetList[i]); - if (tSoundAsset && tSoundAsset->getSoundPath() == fileName) + if (tSoundAsset && tSoundAsset->getSoundFile() == fileName) { soundAsset->setAssetId(query.mAssetList[i]); AssetDatabase.releaseAsset(query.mAssetList[i]); @@ -548,9 +510,162 @@ U32 SoundAsset::getAssetByFileName(StringTableEntry fileName, AssetPtrregisterObject(String::ToString("%s_profile_description", getAssetName()).c_str()); + } + + mProfileDesc.validate(); + + mResolvedDescription->mPitch = mProfileDesc.mPitch; + mResolvedDescription->mVolume = mProfileDesc.mVolume; + mResolvedDescription->mIs3D = mProfileDesc.mIs3D; + mResolvedDescription->mIsLooping = mProfileDesc.mIsLooping; + mResolvedDescription->mIsStreaming = mProfileDesc.mIsStreaming; + mResolvedDescription->mUseHardware = mProfileDesc.mUseHardware; + mResolvedDescription->mMinDistance = mProfileDesc.mMinDistance; + mResolvedDescription->mMaxDistance = mProfileDesc.mMaxDistance; + mResolvedDescription->mConeInsideAngle = mProfileDesc.mConeInsideAngle; + mResolvedDescription->mConeOutsideAngle = mProfileDesc.mConeOutsideAngle; + mResolvedDescription->mConeOutsideVolume = mProfileDesc.mConeOutsideVolume; + mResolvedDescription->mRolloffFactor = mProfileDesc.mRolloffFactor; + mResolvedDescription->mFadeInTime = mProfileDesc.mFadeInTime; + mResolvedDescription->mFadeOutTime = mProfileDesc.mFadeOutTime; + mResolvedDescription->mFadeLoops = mProfileDesc.mFadeLoops; + mResolvedDescription->mScatterDistance = mProfileDesc.mScatterDistance; + mResolvedDescription->mStreamPacketSize = mProfileDesc.mStreamPacketSize; + mResolvedDescription->mStreamReadAhead = mProfileDesc.mStreamReadAhead; + mResolvedDescription->mPriority = mProfileDesc.mPriority; + mResolvedDescription->mSourceGroup = mProfileDesc.mSourceGroup; + mResolvedDescription->mFadeInEase = mProfileDesc.mFadeInEase; + mResolvedDescription->mSourceGroup = mProfileDesc.mSourceGroup; +} + +SFXProfile* SoundAsset::buildProfile() +{ + SFXProfile* profile = new SFXProfile(mResolvedDescription, mSoundFile[0], mPreload); + mSoundResource[0] = profile->getResource(); + return profile; +} + +//----------------------------------------------------------------------------- +// BUILD PLAYLIST +//----------------------------------------------------------------------------- + +SFXPlayList* SoundAsset::buildPlaylist() +{ + SFXPlayList* pl = new SFXPlayList(); + + pl->mRandomMode = mPlaylist.mRandomMode; + pl->mLoopMode = mPlaylist.mLoopMode; + pl->mNumSlotsToPlay = mPlaylist.mNumSlotsToPlay; + pl->mTrace = mPlaylist.mTrace; + pl->mSlots = mPlaylist.mSlots; + + // Build child tracks for each valid slot + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; ++i) + { + if (mSoundFile[i] == StringTable->EmptyString()) + continue; + + // Build child SFXProfile + SFXProfile* child = new SFXProfile(mResolvedDescription, mSoundFile[i], mPreload); + mSoundResource[i] = child->getResource(); + pl->mSlots.mTrack[i] = child; + } + + return pl; +} + +void SoundAsset::populateSFXTrack(void) +{ + U32 count = 0; + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; ++i) + if (mSoundFile[i] != StringTable->EmptyString() && Torque::FS::IsFile(mSoundFile[i])) + ++count; + + mIsPlaylist = (count > 1); + + buildDescription(); + + if (mResolvedTrack && mResolvedDescription) + { + if (SFX) + SFX->notifyDescriptionChanged(mResolvedDescription); + + return; + } + + mResolvedTrack = NULL; + + // reset loaded state. + mLoadedState = AssetErrCode::NotLoaded; +} + +void SoundAsset::setSoundFile(StringTableEntry pSoundFile, U32 slot) +{ + AssertFatal(pSoundFile != NULL, "Cannot use a NULL sound file."); + + pSoundFile = StringTable->insert(pSoundFile); + + if (pSoundFile == mSoundFile[slot]) + return; + + mSoundFile[slot] = getOwned() ? expandAssetFilePath(pSoundFile) : StringTable->insert(pSoundFile);; + + refreshAsset(); +} + +void SoundAsset::onTamlPreWrite(void) +{ + // Call parent. + Parent::onTamlPreWrite(); + + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + { + if (mSoundFile[i] == StringTable->EmptyString()) + break; + + mSoundFile[i] = collapseAssetFilePath(mSoundFile[i]); + } +} + +void SoundAsset::onTamlPostWrite(void) +{ + for (U32 i = 0; i < SFXPlayList::SFXPlaylistSettings::NUM_SLOTS; i++) + { + if (mSoundFile[i] == StringTable->EmptyString()) + break; + + mSoundFile[i] = expandAssetFilePath(mSoundFile[i]); + } +} + +void SoundAsset::onTamlCustomWrite(TamlCustomNodes& customNodes) +{ + // Debug Profiling. + PROFILE_SCOPE(SoundAsset_OnTamlCustomWrite); + + // Call parent. + Parent::onTamlCustomRead(customNodes); +} + +void SoundAsset::onTamlCustomRead(const TamlCustomNodes& customNodes) +{ + // Debug Profiling. + PROFILE_SCOPE(SoundAsset_OnTamlCustomRead); + + // Call parent. + Parent::onTamlCustomRead(customNodes); +} + DefineEngineMethod(SoundAsset, getSoundPath, const char*, (), , "") { - return object->getSoundPath(); + return object->getSoundFile(); } DefineEngineMethod(SoundAsset, playSound, S32, (Point3F position), (Point3F::Zero), @@ -581,7 +696,7 @@ DefineEngineStaticMethod(SoundAsset, getAssetIdByFilename, const char*, (const c "Queries the Asset Database to see if any asset exists that is associated with the provided file path.\n" "@return The AssetId of the associated asset, if any.") { - return SoundAsset::getAssetIdByFileName(StringTable->insert(filePath)); + return SoundAsset::getAssetIdByFilename(StringTable->insert(filePath)); } IMPLEMENT_CONOBJECT(GuiInspectorTypeSoundAssetPtr); diff --git a/Engine/source/T3D/assets/SoundAsset.h b/Engine/source/T3D/assets/SoundAsset.h index 1def010662..0474a01343 100644 --- a/Engine/source/T3D/assets/SoundAsset.h +++ b/Engine/source/T3D/assets/SoundAsset.h @@ -87,16 +87,7 @@ class SoundAsset : public AssetBase typedef AssetPtr ConcreteAssetPtr; protected: - StringTableEntry mSoundFile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS]; - StringTableEntry mSoundPath[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS]; - SFXProfile mSFXProfile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS]; - - SFXDescription mProfileDesc; - SFXPlayList mPlaylist; - // subtitles - StringTableEntry mSubtitleString; - bool mPreload; - bool mIsPlaylist; + //SFXPlayList::SlotData mSlots; /*These will be needed in the refactor! @@ -121,9 +112,6 @@ class SoundAsset : public AssetBase F32 mPriority; */ - typedef Signal SoundAssetChanged; - SoundAssetChanged mChangeSignal; - public: enum SoundAssetErrCode { @@ -142,179 +130,150 @@ class SoundAsset : public AssetBase if (errCode > SoundAssetErrCode::Extended) return "undefined error"; return mErrCodeStrings[errCode - Parent::Extended]; }; + +private: + StringTableEntry mSoundFile[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS]; + Resource mSoundResource[SFXPlayList::SFXPlaylistSettings::NUM_SLOTS]; + + SFXDescription mProfileDesc; + + SFXPlayList mPlaylist; + // subtitles + StringTableEntry mSubtitleString; + bool mPreload; + bool mIsPlaylist; + SFXTrack* mResolvedTrack; + SFXDescription* mResolvedDescription; + +public: SoundAsset(); virtual ~SoundAsset(); /// Engine. static void initPersistFields(); + void onRemove() override; + void inspectPostApply() override; void copyTo(SimObject* object) override; //SFXResource* getSound() { return mSoundResource; } - Resource getSoundResource(const U32 slotId = 0) { load(); return mSFXProfile[slotId].getResource(); } + Resource getSoundResource(const U32 slotId = 0) { load(); return mSoundResource[slotId]; } /// Declare Console Object. DECLARE_CONOBJECT(SoundAsset); - static bool _setSoundFile(void* object, const char* index, const char* data); + // asset Base load U32 load() override; - inline StringTableEntry getSoundPath(const U32 slotId = 0) const { return mSoundPath[slotId]; }; - SFXProfile* getSfxProfile(const U32 slotId = 0) { return &mSFXProfile[slotId]; } - SFXPlayList* getSfxPlaylist() { return &mPlaylist; } - SFXTrack* getSFXTrack() { load(); return mIsPlaylist ? dynamic_cast(&mPlaylist) : dynamic_cast(&mSFXProfile[0]); } - SFXDescription* getSfxDescription() { return &mProfileDesc; } + + void setSoundFile(StringTableEntry pSoundFile, U32 slot = 0); + inline StringTableEntry getSoundFile(U32 slot = 0) { return mSoundFile[slot]; } + inline StringTableEntry getRelativeSoundFile(U32 slot = 0) { return collapseAssetFilePath(mSoundFile[slot]); } + + SFXTrack* getSFXTrack() { load(); return mResolvedTrack; } + SFXDescription* getSfxDescription() { return mResolvedDescription ? mResolvedDescription : &mProfileDesc; } bool isPlaylist(){ return mIsPlaylist; } bool isLoop() { return mProfileDesc.mIsLooping; } bool is3D() { return mProfileDesc.mIs3D; } - static StringTableEntry getAssetIdByFileName(StringTableEntry fileName); + static StringTableEntry getAssetIdByFilename(StringTableEntry fileName); static U32 getAssetById(StringTableEntry assetId, AssetPtr* materialAsset); - static U32 getAssetByFileName(StringTableEntry fileName, AssetPtr* matAsset); + static U32 getAssetByFilename(StringTableEntry fileName, AssetPtr* matAsset); + + void buildDescription(); + SFXProfile* buildProfile(); + SFXPlayList* buildPlaylist(); + + void populateSFXTrack(void); protected: - void initializeAsset(void) override; - void _onResourceChanged(const Torque::Path & path); - void onAssetRefresh(void) override; + // Asset Base callback + void initializeAsset(void) override; + void _onResourceChanged(const Torque::Path & path); + void onAssetRefresh(void) override; + + /// Taml callbacks. + void onTamlPreWrite(void) override; + void onTamlPostWrite(void) override; + void onTamlCustomWrite(TamlCustomNodes& customNodes) override; + void onTamlCustomRead(const TamlCustomNodes& customNodes) override; + +protected: + static bool _setSoundFile(void* obj, const char* index, const char* data) { U32 idx = 0; if (index) idx = dAtoi(index); static_cast(obj)->setSoundFile(data, idx); return false; } + }; -DefineConsoleType(TypeSoundAssetPtr, SoundAsset) +DECLARE_STRUCT(AssetPtr) +DefineConsoleType(TypeSoundAssetPtr, AssetPtr) + DefineConsoleType(TypeSoundAssetId, String) #pragma region Singular Asset Macros -//Singular assets -/// -/// Declares a sound asset -/// This establishes the assetId, asset and legacy filepath fields, along with supplemental getter and setter functions -/// -#define DECLARE_SOUNDASSET(className, name) public: \ - Resource m##name;\ - StringTableEntry m##name##Name; \ - StringTableEntry m##name##AssetId;\ - AssetPtr m##name##Asset = NULL;\ - SFXTrack* m##name##Profile = NULL;\ - SFXDescription* m##name##Desc = NULL;\ - SimObjectId m##name##SFXId = 0;\ -public: \ - const StringTableEntry get##name##File() const { return m##name##Name; }\ - void set##name##File(const FileName &_in) { m##name##Name = StringTable->insert(_in.c_str());}\ - const AssetPtr & get##name##Asset() const { return m##name##Asset; }\ - void set##name##Asset(const AssetPtr &_in) { m##name##Asset = _in;}\ - \ - bool _set##name(StringTableEntry _in)\ - {\ - if(m##name##AssetId != _in || m##name##Name != _in)\ - {\ - if (_in == NULL || !String::compare(_in,StringTable->EmptyString()))\ - {\ - m##name##Name = StringTable->EmptyString();\ - m##name##AssetId = StringTable->EmptyString();\ - m##name##Asset = NULL;\ - m##name = NULL;\ - return true;\ - }\ - \ - if (AssetDatabase.isDeclaredAsset(_in))\ - {\ - m##name##AssetId = _in;\ - \ - U32 assetState = SoundAsset::getAssetById(m##name##AssetId, &m##name##Asset);\ - \ - if (SoundAsset::Ok == assetState)\ - {\ - m##name##Name = StringTable->EmptyString();\ - }\ - }\ - else\ - {\ - StringTableEntry assetId = SoundAsset::getAssetIdByFileName(_in);\ - if (assetId != StringTable->EmptyString())\ - {\ - m##name##AssetId = assetId;\ - if(SoundAsset::getAssetById(m##name##AssetId, &m##name##Asset) == SoundAsset::Ok)\ - {\ - m##name##Name = StringTable->EmptyString();\ - }\ - }\ - else\ - {\ - m##name##Name = _in;\ - m##name##AssetId = StringTable->EmptyString();\ - m##name##Asset = NULL;\ - }\ - }\ - }\ - if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull())\ - {\ - m##name = m##name##Asset->getSoundResource();\ - }\ - else\ - {\ - m##name = NULL;\ - }\ - if(get##name() == StringTable->EmptyString())\ - return true;\ - \ - if(get##name() == StringTable->EmptyString())\ - return true;\ - if (m##name##Asset.notNull() && m##name##Asset->getStatus() != SoundAsset::Ok)\ - {\ - Con::errorf("%s(%s)::_set%s() - sound asset failure\"%s\" due to [%s]", macroText(className), getName(), macroText(name), _in, SoundAsset::getAssetErrstrn(m##name##Asset->getStatus()).c_str());\ - return false; \ - }\ - else if (!m##name && (m##name##Name != StringTable->EmptyString() && !Sim::findObject(m##name##Name)))\ - {\ - Con::errorf("%s(%s)::_set%s() - Couldn't load sound \"%s\"", macroText(className), getName(), macroText(name), _in);\ - return false;\ - }\ - return true;\ - }\ - \ - const StringTableEntry get##name() const\ - {\ - if (m##name##Asset && (m##name##Asset->getSoundPath() != StringTable->EmptyString()))\ - return m##name##Asset->getSoundPath();\ - else if (m##name##AssetId != StringTable->EmptyString())\ - return m##name##AssetId;\ - else if (m##name##Name != StringTable->EmptyString())\ - return StringTable->insert(m##name##Name);\ - else\ - return StringTable->EmptyString();\ - }\ - Resource get##name##Resource() \ - {\ - return m##name;\ - }\ - SFXTrack* get##name##Profile()\ - {\ - if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull()){\ - m##name##Profile = m##name##Asset->getSFXTrack(); \ - return m##name##Profile;\ - }\ - return NULL;\ - }\ +#define DECLARE_SOUNDASSET(className, name) \ +private: \ + AssetPtr m##name##Asset; \ + StringTableEntry m##name##File = StringTable->EmptyString(); \ +public: \ + void _set##name(StringTableEntry _in){ \ + if(m##name##Asset.getAssetId() == _in) \ + return; \ + if(get##name##File() == _in) \ + return; \ + if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \ + { \ + m##name##Asset = NULL; \ + m##name##File = ""; \ + return; \ + } \ + if(!AssetDatabase.isDeclaredAsset(_in)) \ + { \ + StringTableEntry soundAssetId = StringTable->EmptyString(); \ + AssetQuery query; \ + S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \ + if (foundAssetcount != 0) \ + { \ + soundAssetId = query.mAssetList[0]; \ + } \ + else if(Torque::FS::IsFile(_in)) \ + { \ + soundAssetId = SoundAsset::getAssetIdByFilename(_in); \ + if (soundAssetId == StringTable->EmptyString()) \ + { \ + SoundAsset* privateSound = new SoundAsset(); \ + privateSound->setSoundFile(_in); \ + soundAssetId = AssetDatabase.addPrivateAsset(privateSound); \ + } \ + } \ + else \ + { \ + Con::warnf("%s::%s: Could not find asset for: %s, there is no fallback for sound assets.", #className, #name, _in); \ + soundAssetId = StringTable->EmptyString(); \ + } \ + m##name##Asset = soundAssetId; \ + m##name##File = _in; \ + } \ + else \ + { \ + m##name##Asset = _in; \ + m##name##File = get##name##File(); \ + } \ + }; \ + \ + inline StringTableEntry _get##name(void) const { return m##name##Asset.getAssetId(); } \ + AssetPtr get##name##Asset(void) { return m##name##Asset; } \ + static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast(obj)->_set##name(_getStringTable()->insert(data)); return false;} \ + StringTableEntry get##name##File(){ return m##name##Asset.notNull() ? m##name##Asset->getSoundFile() : ""; } \ SFXDescription* get##name##Description()\ {\ - if (get##name() != StringTable->EmptyString() && m##name##Asset.notNull()){\ - m##name##Desc = m##name##Asset->getSfxDescription();\ - return m##name##Desc;}\ + if (m##name##Asset.notNull())\ + return m##name##Asset->getSfxDescription();\ return NULL;\ }\ - bool is##name##Valid() { return (get##name() != StringTable->EmptyString() && m##name##Asset && m##name##Asset->getStatus() == AssetBase::Ok); } - -#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS - -#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \ - addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, docs)); \ - addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, asset reference.)); + SimObjectPtr get##name##SFXTrack(){ return m##name##Asset.notNull() ? m##name##Asset->getSFXTrack() : NULL; } -#else - -#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \ - addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ - addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, & defaultProtectedGetFn, assetText(name, asset reference.)); - -#endif // TORQUE_SHOW_LEGACY_FILE_FIELDS +#define INITPERSISTFIELD_SOUNDASSET(name, consoleClass, docs) \ + addProtectedField(assetText(name, Asset), TypeSoundAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, asset docs.)); \ + addProtectedField(assetText(name, File), TypeFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, assetDoc(name, file docs.)); //network send - datablock #define PACKDATA_SOUNDASSET(name)\ @@ -374,136 +333,74 @@ public: \ m##name##SFXId[index] = 0;\ } -#define DECLARE_SOUNDASSET_ARRAY(className,name,max) public: \ - static const U32 sm##name##Count = max;\ - Resource m##name[max];\ - StringTableEntry m##name##Name[max]; \ - StringTableEntry m##name##AssetId[max];\ - AssetPtr m##name##Asset[max];\ - SFXTrack* m##name##Profile[max];\ - SimObjectId m##name##SFXId[max];\ -public: \ - const StringTableEntry get##name##File(const U32& index) const { return m##name##Name[index]; }\ - void set##name##File(const FileName &_in, const U32& index) { m##name##Name[index] = StringTable->insert(_in.c_str());}\ - const AssetPtr & get##name##Asset(const U32& index) const { return m##name##Asset[index]; }\ - void set##name##Asset(const AssetPtr &_in, const U32& index) { m##name##Asset[index] = _in;}\ - \ - bool _set##name(StringTableEntry _in, const U32& index)\ - {\ - if(m##name##AssetId[index] != _in || m##name##Name[index] != _in)\ - {\ - if(index >= sm##name##Count || index < 0) \ - return false;\ - if (_in == NULL || !String::compare(_in,StringTable->EmptyString()))\ - {\ - m##name##Name[index] = StringTable->EmptyString();\ - m##name##AssetId[index] = StringTable->EmptyString();\ - m##name##Asset[index] = NULL;\ - m##name[index] = NULL;\ - return true;\ - }\ - else if(_in[0] == '$' || _in[0] == '#')\ - {\ - m##name##Name[index] = _in;\ - m##name##AssetId[index] = StringTable->EmptyString();\ - m##name##Asset[index] = NULL;\ - m##name[index] = NULL;\ - return true;\ - }\ - \ - if (AssetDatabase.isDeclaredAsset(_in))\ - {\ - m##name##AssetId[index] = _in;\ - \ - U32 assetState = SoundAsset::getAssetById(m##name##AssetId[index], &m##name##Asset[index]);\ - \ - if (SoundAsset::Ok == assetState)\ - {\ - m##name##Name[index] = StringTable->EmptyString();\ - }\ - }\ - else\ - {\ - StringTableEntry assetId = SoundAsset::getAssetIdByFileName(_in);\ - if (assetId != StringTable->EmptyString())\ - {\ - m##name##AssetId[index] = assetId;\ - if(SoundAsset::getAssetById(m##name##AssetId[index], &m##name##Asset[index]) == SoundAsset::Ok)\ - {\ - m##name##Name[index] = StringTable->EmptyString();\ - }\ - }\ - else\ - {\ - m##name##Name[index] = _in;\ - m##name##AssetId[index] = StringTable->EmptyString();\ - m##name##Asset[index] = NULL;\ - }\ - }\ - }\ - if (get##name(index) != StringTable->EmptyString() && m##name##Asset[index].notNull())\ - {\ - m##name[index] = m##name##Asset[index]->getSoundResource();\ - }\ - else\ - {\ - m##name[index] = NULL;\ - }\ - if(get##name(index) == StringTable->EmptyString())\ - return true;\ - \ - if (m##name##Asset[index].notNull() && m##name##Asset[index]->getStatus() != SoundAsset::Ok)\ - {\ - Con::errorf("%s(%s)::_set%s(%i) - sound asset failure\"%s\" due to [%s]", macroText(className), getName(), macroText(name),index, _in, SoundAsset::getAssetErrstrn(m##name##Asset[index]->getStatus()).c_str());\ - return false; \ - }\ - else if (!m##name[index] && (m##name##Name[index] != StringTable->EmptyString() && !Sim::findObject(m##name##Name[index])))\ - {\ - Con::errorf("%s(%s)::_set%s(%i) - Couldn't load sound \"%s\"", macroText(className), getName(), macroText(name),index, _in);\ - return false;\ - }\ - return true;\ - }\ - \ - const StringTableEntry get##name(const U32& index) const\ - {\ - if (m##name##Asset[index] && (m##name##Asset[index]->getSoundPath() != StringTable->EmptyString()))\ - return m##name##Asset[index]->getSoundPath();\ - else if (m##name##AssetId[index] != StringTable->EmptyString())\ - return m##name##AssetId[index];\ - else if (m##name##Name[index] != StringTable->EmptyString())\ - return StringTable->insert(m##name##Name[index]);\ - else\ - return StringTable->EmptyString();\ - }\ - Resource get##name##Resource(const U32& id) \ - {\ - if(id >= sm##name##Count || id < 0)\ - return ResourceManager::get().load( "" );\ - return m##name[id];\ - }\ - SFXTrack* get##name##Profile(const U32& id)\ - {\ - if (m##name##Asset[id].notNull())\ - return m##name##Asset[id]->getSFXTrack(); \ - return NULL;\ - }\ - bool is##name##Valid(const U32& id) {return (get##name(id) != StringTable->EmptyString() && m##name##Asset[id] && m##name##Asset[id]->getStatus() == AssetBase::Ok); } - - -#ifdef TORQUE_SHOW_LEGACY_FILE_FIELDS +#define DECLARE_SOUNDASSET_ARRAY(className,name,max)\ +private: \ + AssetPtr m##name##Asset[max]; \ + StringTableEntry m##name##File[max] = {StringTable->EmptyString() }; \ +public: \ +void _set##name(StringTableEntry _in, const U32& index){ \ + if(m##name##Asset[index].getAssetId() == _in) \ + return; \ + if(get##name##File(index) == _in) \ + return; \ + if(_in == NULL || !String::compare(_in,StringTable->EmptyString())) \ + { \ + m##name##Asset[index] = NULL; \ + m##name##File[index] = ""; \ + return; \ + } \ + if(!AssetDatabase.isDeclaredAsset(_in)) \ + { \ + StringTableEntry soundAssetId = StringTable->EmptyString(); \ + AssetQuery query; \ + S32 foundAssetcount = AssetDatabase.findAssetLooseFile(&query, _in); \ + if (foundAssetcount != 0) \ + { \ + soundAssetId = query.mAssetList[0]; \ + } \ + else if(Torque::FS::IsFile(_in)) \ + { \ + soundAssetId = SoundAsset::getAssetIdByFilename(_in); \ + if (soundAssetId == StringTable->EmptyString()) \ + { \ + SoundAsset* privateSound = new SoundAsset(); \ + privateSound->setSoundFile(_in); \ + soundAssetId = AssetDatabase.addPrivateAsset(privateSound); \ + } \ + } \ + else \ + { \ + Con::warnf("%s::%s: Could not find asset for: %s, there is no fallback for sound assets.", #className, #name, _in); \ + soundAssetId = StringTable->EmptyString(); \ + } \ + m##name##Asset[index] = soundAssetId; \ + m##name##File[index] = _in; \ + } \ + else \ + { \ + m##name##Asset[index] = _in; \ + m##name##File[index] = get##name##File(index); \ + } \ + }; \ + \ + inline StringTableEntry _get##name(const U32& index) const { return m##name##Asset[index].getAssetId(); } \ + AssetPtr get##name##Asset(const U32& index) { return m##name##Asset[index]; } \ + static bool _set##name##Data(void* obj, const char* index, const char* data) { static_cast(obj)->_set##name(_getStringTable()->insert(data), dAtoi(index)); return false; } \ + StringTableEntry get##name##File(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getSoundFile() : ""; } \ + SFXDescription* get##name##Description(const U32& index) \ + { \ + if (m##name##Asset[index].notNull()) \ + return m##name##Asset[index]->getSfxDescription(); \ + return NULL; \ + } \ + SimObjectPtr get##name##SFXTrack(const U32& index) { return m##name##Asset[index].notNull() ? m##name##Asset[index]->getSFXTrack() : NULL; } -#define INITPERSISTFIELD_IMAGEASSET_ARRAY(name, arraySize, consoleClass, docs) \ - addProtectedField(#name, TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs)); \ - addProtectedField(assetText(name, Asset), TypeImageAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.)); - -#else #define INITPERSISTFIELD_SOUNDASSET_ARRAY(name, arraySize, consoleClass, docs) \ - addProtectedField(#name, TypeSoundFilename, Offset(m##name##Name, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ - addProtectedField(assetText(name, Asset), TypeSoundAssetId, Offset(m##name##AssetId, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.)); + addProtectedField(#name, TypeSoundFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ + addProtectedField(assetText(name, Asset), TypeSoundAssetPtr, Offset(m##name##Asset, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, asset docs.));\ + addProtectedField(assetText(name, File), TypeSoundFilename, Offset(m##name##File, consoleClass), _set##name##Data, &defaultProtectedGetFn, arraySize, assetDoc(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ -#endif #define LOAD_SOUNDASSET_ARRAY(name, index)\ if (m##name##AssetId[index] != StringTable->EmptyString())\ @@ -530,8 +427,8 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\ const char* enumString = castConsoleTypeToString(static_cast(itter));\ if (enumString && enumString[0])\ {\ - addField(assetEnumNameConcat(enumString, File), TypeSoundFilename, Offset(m##name##Name[0], consoleClass) + sizeof(m##name##Name[0])*i, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ - addField(assetEnumNameConcat(enumString, Asset), TypeSoundAssetId, Offset(m##name##AssetId[0], consoleClass) + sizeof(m##name##AssetId[0])*i, assetText(name, asset reference.));\ + addField(assetEnumNameConcat(enumString, Asset), TypeSoundAssetPtr, Offset(m##name##Asset[0], consoleClass) + sizeof(m##name##Asset[0])*i, assetText(name, asset reference.));\ + addField(assetEnumNameConcat(enumString, File), TypeSoundFilename, Offset(m##name##File[0], consoleClass) + sizeof(m##name##File[0])*i, assetText(name, docs), AbstractClassRep::FIELD_HideInInspectors); \ }\ } @@ -544,5 +441,11 @@ if (m##name##AssetId[index] != StringTable->EmptyString())\ #pragma endregion + +#pragma region Refactor Macros + + +#pragma endregion + #endif // _ASSET_BASE_H_ diff --git a/Engine/source/T3D/assets/assetImporter.cpp b/Engine/source/T3D/assets/assetImporter.cpp index d3f20edcc5..674bd7406f 100644 --- a/Engine/source/T3D/assets/assetImporter.cpp +++ b/Engine/source/T3D/assets/assetImporter.cpp @@ -3292,30 +3292,19 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem) StringTableEntry assetName = StringTable->insert(assetItem->assetName.c_str()); - String soundFileName = assetItem->filePath.getFileName() + "." + assetItem->filePath.getExtension(); - String assetPath = targetPath + "/" + soundFileName; + String soundFileName = assetItem->filePath.getFullFileName(); + String assetPath = "@" + soundFileName; String tamlPath = targetPath + "/" + assetName + ".asset.taml"; String originalPath = assetItem->filePath.getFullPath().c_str(); - char qualifiedFromFile[2048]; - char qualifiedToFile[2048]; - -#ifndef TORQUE_SECURE_VFS - Platform::makeFullPathName(originalPath.c_str(), qualifiedFromFile, sizeof(qualifiedFromFile)); - Platform::makeFullPathName(assetPath.c_str(), qualifiedToFile, sizeof(qualifiedToFile)); -#else - dStrcpy(qualifiedFromFile, originalPath.c_str(), sizeof(qualifiedFromFile)); - dStrcpy(qualifiedToFile, assetPath.c_str(), sizeof(qualifiedToFile)); -#endif - newAsset->setAssetName(assetName); - newAsset->_setSoundFile(newAsset, "0", soundFileName.c_str()); + newAsset->setSoundFile(assetPath.c_str()); //If it's not a re-import, check that the file isn't being in-place imported. If it isn't, store off the original //file path for reimporting support later - if (!isReimport && String::compare(qualifiedFromFile, qualifiedToFile) && Torque::FS::IsFile(qualifiedFromFile)) + if (!isReimport) { - newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, qualifiedFromFile); + newAsset->setDataField(StringTable->insert("originalFilePath"), nullptr, originalPath.c_str()); } Taml tamlWriter; @@ -3328,18 +3317,6 @@ Torque::Path AssetImporter::importSoundAsset(AssetImportObject* assetItem) return ""; } - if (!isReimport) - { - bool isInPlace = !String::compare(qualifiedFromFile, qualifiedToFile); - - if (!isInPlace && !Torque::FS::CopyFile(qualifiedFromFile, qualifiedToFile, !isReimport)) - { - dSprintf(importLogBuffer, sizeof(importLogBuffer), "Error! Unable to copy file %s", assetItem->filePath.getFullPath().c_str()); - activityLog.push_back(importLogBuffer); - return ""; - } - } - return tamlPath; } diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index da374984c3..4a39180ea8 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -230,9 +230,6 @@ ExplosionData::ExplosionData() faceViewer = false; - INIT_ASSET(Sound); - - //soundProfile = NULL; particleEmitter = NULL; particleEmitterId = 0; @@ -310,7 +307,7 @@ ExplosionData::ExplosionData(const ExplosionData& other, bool temp_clone) : Game faceViewer = other.faceViewer; particleDensity = other.particleDensity; particleRadius = other.particleRadius; - CLONE_ASSET(Sound); + mSoundAsset = other.mSoundAsset; particleEmitter = other.particleEmitter; particleEmitterId = other.particleEmitterId; // -- for pack/unpack of particleEmitter ptr explosionScale = other.explosionScale; @@ -675,8 +672,7 @@ void ExplosionData::packData(BitStream* stream) PACKDATA_ASSET_REFACTOR(ExplosionShape); - //PACKDATA_SOUNDASSET(Sound); - PACKDATA_ASSET(Sound); + PACKDATA_ASSET_REFACTOR(Sound); if (stream->writeFlag(particleEmitter)) stream->writeRangedU32(particleEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); @@ -780,7 +776,7 @@ void ExplosionData::unpackData(BitStream* stream) UNPACKDATA_ASSET_REFACTOR(ExplosionShape); - UNPACKDATA_ASSET(Sound); + UNPACKDATA_ASSET_REFACTOR(Sound); if (stream->readFlag()) particleEmitterId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); @@ -886,10 +882,11 @@ bool ExplosionData::preload(bool server, String &errorStr) if (!server) { - if (!isSoundValid()) + if (!getSoundSFXTrack()) { //return false; -TODO: trigger asset download } + if (!particleEmitter && particleEmitterId != 0) { if (Sim::findObject(particleEmitterId, particleEmitter) == false) @@ -1432,7 +1429,7 @@ bool Explosion::explode() resetWorldBox(); } - SFXProfile* sound_prof = static_cast(mDataBlock->getSoundProfile()); + SFXProfile* sound_prof = static_cast(mDataBlock->getSoundSFXTrack().getPointer()); if (sound_prof) { soundProfile_clone = sound_prof->cloneAndPerformSubstitutions(ss_object, ss_index); diff --git a/Engine/source/T3D/fx/explosion.h b/Engine/source/T3D/fx/explosion.h index c00483625c..5337253913 100644 --- a/Engine/source/T3D/fx/explosion.h +++ b/Engine/source/T3D/fx/explosion.h @@ -71,7 +71,6 @@ class ExplosionData : public GameBaseData, protected AssetPtrCallback { F32 particleRadius; DECLARE_SOUNDASSET(ExplosionData, Sound); - DECLARE_ASSET_SETGET(ExplosionData, Sound); ParticleEmitterData* particleEmitter; S32 particleEmitterId; diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index 44c94b1a84..1b8eab7050 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -238,13 +238,6 @@ void LightningStrikeEvent::process(NetConnection*) // LightningData::LightningData() { - INIT_ASSET(StrikeSound); - - for (S32 i = 0; i < MaxThunders; i++) - { - INIT_SOUNDASSET_ARRAY(ThunderSound, i); - } - for (S32 i = 0; i < MaxTextures; i++) { strikeTextureNames[i] = NULL; @@ -297,13 +290,13 @@ bool LightningData::preload(bool server, String &errorStr) { for (S32 i = 0; i < MaxThunders; i++) { - if (!isThunderSoundValid(i)) + if (!getThunderSoundSFXTrack(i)) { //return false; -TODO: trigger asset download } } - if (!isStrikeSoundValid()) + if (!getStrikeSoundSFXTrack()) { //return false; -TODO: trigger asset download } @@ -332,7 +325,7 @@ void LightningData::packData(BitStream* stream) U32 i; for (i = 0; i < MaxThunders; i++) { - PACKDATA_SOUNDASSET_ARRAY(ThunderSound, i); + PACKDATA_ASSET_ARRAY(ThunderSound, i); } stream->writeInt(mNumStrikeTextures, 4); @@ -340,7 +333,7 @@ void LightningData::packData(BitStream* stream) for (i = 0; i < MaxTextures; i++) stream->writeString(strikeTextureNames[i]); - PACKDATA_ASSET(StrikeSound); + PACKDATA_ASSET_REFACTOR(StrikeSound); } void LightningData::unpackData(BitStream* stream) @@ -350,7 +343,7 @@ void LightningData::unpackData(BitStream* stream) U32 i; for (i = 0; i < MaxThunders; i++) { - UNPACKDATA_SOUNDASSET_ARRAY(ThunderSound, i); + UNPACKDATA_ASSET_ARRAY(ThunderSound, i); } mNumStrikeTextures = stream->readInt(4); @@ -358,7 +351,7 @@ void LightningData::unpackData(BitStream* stream) for (i = 0; i < MaxTextures; i++) strikeTextureNames[i] = stream->readSTString(); - UNPACKDATA_ASSET(StrikeSound); + UNPACKDATA_ASSET_REFACTOR(StrikeSound); } @@ -584,7 +577,7 @@ void Lightning::scheduleThunder(Strike* newStrike) if (t <= 0.03f) { // If it's really close, just play it... U32 thunder = sgLightningRand.randI(0, mDataBlock->numThunders - 1); - SFX->playOnce(mDataBlock->getThunderSoundProfile(thunder)); + SFX->playOnce(mDataBlock->getThunderSoundSFXTrack(thunder)); } else { Thunder* pThunder = new Thunder; pThunder->tRemaining = t; @@ -651,7 +644,7 @@ void Lightning::advanceTime(F32 dt) // Play the sound... U32 thunder = sgLightningRand.randI(0, mDataBlock->numThunders - 1); - SFX->playOnce(mDataBlock->getThunderSoundProfile(thunder)); + SFX->playOnce(mDataBlock->getThunderSoundSFXTrack(thunder)); } else { pThunderWalker = &((*pThunderWalker)->next); } @@ -735,9 +728,9 @@ void Lightning::processEvent(LightningStrikeEvent* pEvent) MatrixF trans(true); trans.setPosition( strikePoint ); - if (mDataBlock->getStrikeSoundProfile()) + if (mDataBlock->getStrikeSoundSFXTrack()) { - SFX->playOnce(mDataBlock->getStrikeSoundProfile(), &trans ); + SFX->playOnce(mDataBlock->getStrikeSoundSFXTrack(), &trans ); } } diff --git a/Engine/source/T3D/fx/lightning.h b/Engine/source/T3D/fx/lightning.h index 55834251c1..eb7abda1c4 100644 --- a/Engine/source/T3D/fx/lightning.h +++ b/Engine/source/T3D/fx/lightning.h @@ -65,10 +65,7 @@ class LightningData : public GameBaseData public: DECLARE_SOUNDASSET_ARRAY(LightningData, ThunderSound, MaxThunders); - DECLARE_ASSET_ARRAY_SETGET(LightningData, ThunderSound); - DECLARE_SOUNDASSET(LightningData, StrikeSound); - DECLARE_ASSET_SETGET(LightningData, StrikeSound); StringTableEntry strikeTextureNames[MaxTextures]; diff --git a/Engine/source/T3D/fx/precipitation.cpp b/Engine/source/T3D/fx/precipitation.cpp index 6ac3c75c98..3c84247f56 100644 --- a/Engine/source/T3D/fx/precipitation.cpp +++ b/Engine/source/T3D/fx/precipitation.cpp @@ -127,8 +127,6 @@ ConsoleDocClass( PrecipitationData, //---------------------------------------------------------- PrecipitationData::PrecipitationData() { - INIT_ASSET(Sound); - mDropShaderName = StringTable->EmptyString(); mSplashShaderName = StringTable->EmptyString(); @@ -175,7 +173,7 @@ bool PrecipitationData::preload( bool server, String &errorStr ) return false; if (!server) { - if (!isSoundValid()) + if (!getSoundSFXTrack()) { //return false; -TODO: trigger asset download } @@ -188,7 +186,7 @@ void PrecipitationData::packData(BitStream* stream) { Parent::packData(stream); - PACKDATA_ASSET(Sound); + PACKDATA_ASSET_REFACTOR(Sound); PACKDATA_ASSET_REFACTOR(Drop); @@ -205,7 +203,7 @@ void PrecipitationData::unpackData(BitStream* stream) { Parent::unpackData(stream); - UNPACKDATA_ASSET(Sound); + UNPACKDATA_ASSET_REFACTOR(Sound); UNPACKDATA_ASSET_REFACTOR(Drop); @@ -587,9 +585,9 @@ bool Precipitation::onNewDataBlock( GameBaseData *dptr, bool reload ) { SFX_DELETE( mAmbientSound ); - if ( mDataBlock->getSoundProfile()) + if ( mDataBlock->getSoundSFXTrack()) { - mAmbientSound = SFX->createSource(mDataBlock->getSoundProfile(), &getTransform() ); + mAmbientSound = SFX->createSource(mDataBlock->getSoundSFXTrack(), &getTransform() ); if ( mAmbientSound ) mAmbientSound->play(); } diff --git a/Engine/source/T3D/fx/precipitation.h b/Engine/source/T3D/fx/precipitation.h index 96fe3844ec..c1976cf353 100644 --- a/Engine/source/T3D/fx/precipitation.h +++ b/Engine/source/T3D/fx/precipitation.h @@ -47,7 +47,6 @@ class PrecipitationData : public GameBaseData public: DECLARE_SOUNDASSET(PrecipitationData, Sound); - DECLARE_ASSET_SETGET(PrecipitationData, Sound); DECLARE_IMAGEASSET(PrecipitationData, Drop, GFXStaticTextureSRGBProfile) ///< Texture for drop particles diff --git a/Engine/source/T3D/fx/splash.cpp b/Engine/source/T3D/fx/splash.cpp index 41e7299735..e9a3aed35c 100644 --- a/Engine/source/T3D/fx/splash.cpp +++ b/Engine/source/T3D/fx/splash.cpp @@ -67,11 +67,6 @@ ConsoleDocClass( Splash, //-------------------------------------------------------------------------- SplashData::SplashData() { - //soundProfile = NULL; - //soundProfileId = 0; - - INIT_ASSET(Sound); - scale.set(1, 1, 1); dMemset( emitterList, 0, sizeof( emitterList ) ); @@ -171,7 +166,7 @@ void SplashData::packData(BitStream* stream) { Parent::packData(stream); - PACKDATA_ASSET(Sound); + PACKDATA_ASSET_REFACTOR(Sound); mathWrite(*stream, scale); stream->write(delayMS); @@ -224,7 +219,7 @@ void SplashData::unpackData(BitStream* stream) { Parent::unpackData(stream); - UNPACKDATA_ASSET(Sound); + UNPACKDATA_ASSET_REFACTOR(Sound); mathRead(*stream, &scale); stream->read(&delayMS); @@ -280,7 +275,7 @@ bool SplashData::preload(bool server, String &errorStr) if (!server) { - if (!isSoundValid()) + if (!getSoundSFXTrack()) { Con::errorf(ConsoleLogEntry::General, "SplashData::preload: Invalid Sound asset."); //return false; @@ -689,7 +684,7 @@ void Splash::spawnExplosion() /// could just play the explosion one, but explosion could be weapon specific, /// splash sound could be liquid specific. food for thought. - SFXTrack* sound_prof = mDataBlock->getSoundProfile(); + SFXTrack* sound_prof = mDataBlock->getSoundSFXTrack(); if (sound_prof) { SFX->playOnce(sound_prof, &getTransform()); diff --git a/Engine/source/T3D/fx/splash.h b/Engine/source/T3D/fx/splash.h index 8ac072b9b1..21cde49aec 100644 --- a/Engine/source/T3D/fx/splash.h +++ b/Engine/source/T3D/fx/splash.h @@ -96,7 +96,6 @@ class SplashData : public GameBaseData //S32 soundProfileId; DECLARE_SOUNDASSET(SplashData, Sound); - DECLARE_ASSET_SETGET(SplashData, Sound); ParticleEmitterData* emitterList[NUM_EMITTERS]; S32 emitterIDList[NUM_EMITTERS]; diff --git a/Engine/source/T3D/levelInfo.cpp b/Engine/source/T3D/levelInfo.cpp index 884fd7d172..33e59744de 100644 --- a/Engine/source/T3D/levelInfo.cpp +++ b/Engine/source/T3D/levelInfo.cpp @@ -217,7 +217,7 @@ U32 LevelInfo::packUpdate(NetConnection *conn, U32 mask, BitStream *stream) mathWrite( *stream, mAmbientLightBlendCurve ); sfxWrite( stream, mSoundAmbience ); - stream->writeInt( mSoundDistanceModel, 1 ); + stream->writeInt( mSoundDistanceModel, 2); PACK_ASSET_REFACTOR(conn, AccuTexture); @@ -251,7 +251,7 @@ void LevelInfo::unpackUpdate(NetConnection *conn, BitStream *stream) String errorStr; if( !sfxReadAndResolve( stream, &mSoundAmbience, errorStr ) ) Con::errorf( "%s", errorStr.c_str() ); - mSoundDistanceModel = ( SFXDistanceModel ) stream->readInt( 1 ); + mSoundDistanceModel = ( SFXDistanceModel ) stream->readInt(2); if( isProperlyAdded() ) { diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 3c187ea0dc..ec5daedf5d 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -421,9 +421,6 @@ PlayerData::PlayerData() boxHeadBackPercentage = 0; boxHeadFrontPercentage = 1; - for (S32 i = 0; i < MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(PlayerSound, i); - footPuffEmitter = NULL; footPuffID = 0; footPuffNumParts = 15; @@ -471,7 +468,7 @@ bool PlayerData::preload(bool server, String &errorStr) if (!server) { for (U32 i = 0; i < MaxSounds; ++i) { - if (!isPlayerSoundValid(i)) + if (!getPlayerSoundSFXTrack(i)) { //return false; -TODO: trigger asset download } @@ -1266,8 +1263,7 @@ void PlayerData::packData(BitStream* stream) stream->write(minImpactSpeed); stream->write(minLateralImpactSpeed); - for (U32 i = 0; i < MaxSounds; i++) - PACKDATA_SOUNDASSET_ARRAY(PlayerSound, i); + PACKDATA_ASSET_ARRAY_REFACTOR(PlayerSound, MaxSounds); mathWrite(*stream, boxSize); mathWrite(*stream, crouchBoxSize); @@ -1447,8 +1443,7 @@ void PlayerData::unpackData(BitStream* stream) stream->read(&minImpactSpeed); stream->read(&minLateralImpactSpeed); - for (U32 i = 0; i < MaxSounds; i++) - UNPACKDATA_SOUNDASSET_ARRAY(PlayerSound, i); + UNPACKDATA_ASSET_ARRAY_REFACTOR(PlayerSound, MaxSounds); mathRead(*stream, &boxSize); mathRead(*stream, &crouchBoxSize); @@ -1895,11 +1890,11 @@ bool Player::onNewDataBlock( GameBaseData *dptr, bool reload ) SFX_DELETE( mMoveBubbleSound ); SFX_DELETE( mWaterBreathSound ); - if ( mDataBlock->getPlayerSound(PlayerData::MoveBubbles) ) - mMoveBubbleSound = SFX->createSource( mDataBlock->getPlayerSoundProfile(PlayerData::MoveBubbles) ); + if ( mDataBlock->getPlayerSoundSFXTrack(PlayerData::MoveBubbles) ) + mMoveBubbleSound = SFX->createSource( mDataBlock->getPlayerSoundSFXTrack(PlayerData::MoveBubbles) ); - if ( mDataBlock->getPlayerSound(PlayerData::WaterBreath) ) - mWaterBreathSound = SFX->createSource( mDataBlock->getPlayerSoundProfile(PlayerData::WaterBreath) ); + if ( mDataBlock->getPlayerSoundSFXTrack(PlayerData::WaterBreath) ) + mWaterBreathSound = SFX->createSource( mDataBlock->getPlayerSoundSFXTrack(PlayerData::WaterBreath) ); } mObjBox.maxExtents.x = mDataBlock->boxSize.x * 0.5f; @@ -3223,7 +3218,7 @@ void Player::updateMove(const Move* move) { // exit-water splash sound happens for client only if ( getSpeed() >= mDataBlock->exitSplashSoundVel && !isMounted() ) - SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ExitWater), &getTransform() ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ExitWater), &getTransform() ); } } @@ -6998,26 +6993,26 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S // Treading water. if ( mWaterCoverage < mDataBlock->footSplashHeight ) - SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootShallowSplash ), &footMat ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootShallowSplash ), &footMat ); else { if ( mWaterCoverage < 1.0 ) - SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootWading ), &footMat ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootWading ), &footMat ); else { if ( triggeredLeft ) { - SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootUnderWater ), &footMat ); - SFX->playOnce( mDataBlock->getPlayerSoundProfile( PlayerData::FootBubbles ), &footMat ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootUnderWater ), &footMat ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack( PlayerData::FootBubbles ), &footMat ); } } } } - else if( contactMaterial && contactMaterial->getCustomFootstepSoundProfile()) + else if( contactMaterial && contactMaterial->getCustomFootstepSoundSFXTrack()) { // Footstep sound defined on material. - SFX->playOnce( contactMaterial->getCustomFootstepSoundProfile(), &footMat ); + SFX->playOnce( contactMaterial->getCustomFootstepSoundSFXTrack(), &footMat ); } else { @@ -7030,7 +7025,7 @@ void Player::playFootstepSound( bool triggeredLeft, Material* contactMaterial, S sound = 2; if (sound>=0) - SFX->playOnce(mDataBlock->getPlayerSoundProfile(sound), &footMat); + SFX->playOnce(mDataBlock->getPlayerSoundSFXTrack(sound), &footMat); } } @@ -7050,8 +7045,8 @@ void Player:: playImpactSound() { Material* material = ( rInfo.material ? dynamic_cast< Material* >( rInfo.material->getMaterial() ) : 0 ); - if( material && material->getCustomImpactSoundProfile() ) - SFX->playOnce( material->getCustomImpactSoundProfile(), &getTransform() ); + if( material && material->getCustomImpactSoundSFXTrack() ) + SFX->playOnce( material->getCustomImpactSoundSFXTrack(), &getTransform() ); else { S32 sound = -1; @@ -7061,7 +7056,7 @@ void Player:: playImpactSound() sound = 2; // Play metal; if (sound >= 0) - SFX->playOnce(mDataBlock->getPlayerSoundProfile(PlayerData::ImpactSoft + sound), &getTransform()); + SFX->playOnce(mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactSoft + sound), &getTransform()); } } } @@ -7215,11 +7210,11 @@ bool Player::collidingWithWater( Point3F &waterHeight ) void Player::createSplash( Point3F &pos, F32 speed ) { if ( speed >= mDataBlock->hardSplashSoundVel ) - SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterHard), &getTransform() ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterHard), &getTransform() ); else if ( speed >= mDataBlock->medSplashSoundVel ) - SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterMedium), &getTransform() ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterMedium), &getTransform() ); else - SFX->playOnce( mDataBlock->getPlayerSoundProfile(PlayerData::ImpactWaterEasy), &getTransform() ); + SFX->playOnce( mDataBlock->getPlayerSoundSFXTrack(PlayerData::ImpactWaterEasy), &getTransform() ); if( mDataBlock->splash ) { diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 4476d70ddb..00c57ff8dc 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -147,8 +147,6 @@ ProjectileData::ProjectileData() { mProjectileShapeAsset.registerRefreshNotify(this); - INIT_ASSET(ProjectileSound); - explosion = NULL; explosionId = 0; @@ -220,7 +218,7 @@ ProjectileData::ProjectileData(const ProjectileData& other, bool temp_clone) : G splashId = other.splashId; // -- for pack/unpack of splash ptr decal = other.decal; decalId = other.decalId; // -- for pack/unpack of decal ptr - CLONE_ASSET(ProjectileSound); + mProjectileSoundAsset = other.mProjectileSoundAsset; lightDesc = other.lightDesc; lightDescId = other.lightDescId; // -- for pack/unpack of lightDesc ptr mProjectileShapeAsset = other.mProjectileShapeAsset;// -- TSShape loads using mProjectileShapeName @@ -412,7 +410,7 @@ bool ProjectileData::preload(bool server, String &errorStr) if (Sim::findObject(decalId, decal) == false) Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); - if (!isProjectileSoundValid()) + if (!getProjectileSoundSFXTrack()) { //return false; -TODO: trigger asset download } @@ -477,7 +475,7 @@ void ProjectileData::packData(BitStream* stream) if (stream->writeFlag(decal != NULL)) stream->writeRangedU32(decal->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); - PACKDATA_ASSET(ProjectileSound); + PACKDATA_ASSET_REFACTOR(ProjectileSound); if ( stream->writeFlag(lightDesc != NULL)) stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst, @@ -539,7 +537,7 @@ void ProjectileData::unpackData(BitStream* stream) if (stream->readFlag()) decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); - UNPACKDATA_ASSET(ProjectileSound); + UNPACKDATA_ASSET_REFACTOR(ProjectileSound); if (stream->readFlag()) lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); @@ -928,8 +926,8 @@ bool Projectile::onNewDataBlock( GameBaseData *dptr, bool reload ) SFX_DELETE( mSound ); - if ( mDataBlock->getProjectileSound() ) - mSound = SFX->createSource( mDataBlock->getProjectileSoundProfile() ); + if ( mDataBlock->getProjectileSoundSFXTrack() ) + mSound = SFX->createSource( mDataBlock->getProjectileSoundSFXTrack() ); } return true; @@ -1143,7 +1141,7 @@ void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideT void Projectile::updateSound() { - if (!mDataBlock->isProjectileSoundValid()) + if (!mDataBlock->getProjectileSoundSFXTrack()) return; if ( mSound ) diff --git a/Engine/source/T3D/projectile.h b/Engine/source/T3D/projectile.h index af1b3e8d3e..4ada8e5387 100644 --- a/Engine/source/T3D/projectile.h +++ b/Engine/source/T3D/projectile.h @@ -116,7 +116,6 @@ class ProjectileData : public GameBaseData, protected AssetPtrCallback S32 decalId; // (impact) Decal ID DECLARE_SOUNDASSET(ProjectileData, ProjectileSound); - DECLARE_ASSET_SETGET(ProjectileData, ProjectileSound); LightDescription *lightDesc; S32 lightDescId; diff --git a/Engine/source/T3D/proximityMine.cpp b/Engine/source/T3D/proximityMine.cpp index 86c9807b61..638370de0a 100644 --- a/Engine/source/T3D/proximityMine.cpp +++ b/Engine/source/T3D/proximityMine.cpp @@ -82,8 +82,6 @@ ProximityMineData::ProximityMineData() triggerSequence( -1 ), explosionOffset( 0.05f ) { - INIT_ASSET(ArmSound); - INIT_ASSET(TriggerSound); } void ProximityMineData::initPersistFields() @@ -134,11 +132,11 @@ bool ProximityMineData::preload( bool server, String& errorStr ) if ( !server ) { - if(!isArmSoundValid() ) + if(!getArmSoundSFXTrack() ) { //return false; -TODO: trigger asset download } - if(!isTriggerSoundValid() ) + if(!getTriggerSoundSFXTrack() ) { //return false; -TODO: trigger asset download } @@ -159,14 +157,14 @@ void ProximityMineData::packData( BitStream* stream ) Parent::packData( stream ); stream->write( armingDelay ); - PACKDATA_ASSET(ArmSound); + PACKDATA_ASSET_REFACTOR(ArmSound); stream->write( autoTriggerDelay ); stream->writeFlag( triggerOnOwner ); stream->write( triggerRadius ); stream->write( triggerSpeed ); stream->write( triggerDelay ); - PACKDATA_ASSET(TriggerSound); + PACKDATA_ASSET_REFACTOR(TriggerSound); } void ProximityMineData::unpackData( BitStream* stream ) @@ -174,14 +172,14 @@ void ProximityMineData::unpackData( BitStream* stream ) Parent::unpackData(stream); stream->read( &armingDelay ); - UNPACKDATA_ASSET(ArmSound); + UNPACKDATA_ASSET_REFACTOR(ArmSound); stream->read( &autoTriggerDelay ); triggerOnOwner = stream->readFlag(); stream->read( &triggerRadius ); stream->read( &triggerSpeed ); stream->read( &triggerDelay ); - UNPACKDATA_ASSET(TriggerSound); + UNPACKDATA_ASSET_REFACTOR(TriggerSound); } //---------------------------------------------------------------------------- @@ -429,8 +427,8 @@ void ProximityMine::processTick( const Move* move ) mAnimThread = mShapeInstance->addThread(); mShapeInstance->setSequence( mAnimThread, mDataBlock->armingSequence, 0.0f ); } - if ( mDataBlock->getArmSoundProfile() ) - SFX->playOnce( mDataBlock->getArmSoundProfile(), &getRenderTransform() ); + if ( mDataBlock->getArmSoundSFXTrack() ) + SFX->playOnce( mDataBlock->getArmSoundSFXTrack(), &getRenderTransform() ); } break; @@ -470,8 +468,8 @@ void ProximityMine::processTick( const Move* move ) mAnimThread = mShapeInstance->addThread(); mShapeInstance->setSequence( mAnimThread, mDataBlock->triggerSequence, 0.0f ); } - if ( mDataBlock->getTriggerSoundProfile() ) - SFX->playOnce( mDataBlock->getTriggerSoundProfile(), &getRenderTransform() ); + if ( mDataBlock->getTriggerSoundSFXTrack() ) + SFX->playOnce( mDataBlock->getTriggerSoundSFXTrack(), &getRenderTransform() ); if ( isServerObject() ) mDataBlock->onTriggered_callback( this, sql.mList[0] ); diff --git a/Engine/source/T3D/proximityMine.h b/Engine/source/T3D/proximityMine.h index e505689afc..d4fc6af32e 100644 --- a/Engine/source/T3D/proximityMine.h +++ b/Engine/source/T3D/proximityMine.h @@ -46,7 +46,6 @@ struct ProximityMineData: public ItemData F32 armingDelay; S32 armingSequence; DECLARE_SOUNDASSET(ProximityMineData, ArmSound); - DECLARE_ASSET_SETGET(ProximityMineData, ArmSound); F32 autoTriggerDelay; bool triggerOnOwner; @@ -55,7 +54,6 @@ struct ProximityMineData: public ItemData F32 triggerDelay; S32 triggerSequence; DECLARE_SOUNDASSET(ProximityMineData, TriggerSound); - DECLARE_ASSET_SETGET(ProximityMineData, TriggerSound); F32 explosionOffset; diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index b43d9adfba..5753594dd7 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -254,9 +254,6 @@ RigidShapeData::RigidShapeData() drag = 0.7f; density = 4; - for (S32 i = 0; i < Body::MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(BodySounds, i); - dustEmitter = NULL; dustID = 0; triggerDustHeight = 3.0; @@ -273,9 +270,6 @@ RigidShapeData::RigidShapeData() hardSplashSoundVel = 3.0; enablePhysicsRep = true; - for (S32 i = 0; i < Sounds::MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(WaterSounds, i); - dragForce = 0.01f; vertFactor = 0.25; @@ -348,7 +342,7 @@ bool RigidShapeData::preload(bool server, String &errorStr) if (!server) { for (S32 i = 0; i < Body::MaxSounds; i++) { - if (!isBodySoundsValid(i)) + if (!getBodySoundsSFXTrack(i)) { //return false; -TODO: trigger asset download } @@ -356,7 +350,7 @@ bool RigidShapeData::preload(bool server, String &errorStr) for (S32 j = 0; j < Sounds::MaxSounds; j++) { - if (!isWaterSoundsValid(j)) + if (!getWaterSoundsSFXTrack(j)) { //return false; -TODO: trigger asset download } @@ -419,10 +413,8 @@ void RigidShapeData::packData(BitStream* stream) stream->write(body.restitution); stream->write(body.friction); - for (U32 i = 0; i < Body::MaxSounds; ++i) - { - PACKDATA_SOUNDASSET_ARRAY(BodySounds, i); - } + + PACKDATA_ASSET_ARRAY_REFACTOR(BodySounds, Body::MaxSounds); stream->write(minImpactSpeed); stream->write(softImpactSpeed); @@ -452,10 +444,7 @@ void RigidShapeData::packData(BitStream* stream) stream->write(enablePhysicsRep); // write the water sound profiles - for (U32 i = 0; i < Sounds::MaxSounds; ++i) - { - PACKDATA_SOUNDASSET_ARRAY(WaterSounds, i); - } + PACKDATA_ASSET_ARRAY_REFACTOR(WaterSounds, Sounds::MaxSounds); if (stream->writeFlag( dustEmitter )) stream->writeRangedU32( dustEmitter->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast ); @@ -483,10 +472,7 @@ void RigidShapeData::unpackData(BitStream* stream) stream->read(&body.restitution); stream->read(&body.friction); - for (U32 i = 0; i < Body::Sounds::MaxSounds; i++) - { - UNPACKDATA_SOUNDASSET_ARRAY(BodySounds, i); - } + UNPACKDATA_ASSET_ARRAY_REFACTOR(BodySounds, Body::Sounds::MaxSounds); stream->read(&minImpactSpeed); stream->read(&softImpactSpeed); @@ -516,10 +502,7 @@ void RigidShapeData::unpackData(BitStream* stream) stream->read(&enablePhysicsRep); // write the water sound profiles - for (U32 i = 0; i < Sounds::MaxSounds; ++i) - { - UNPACKDATA_SOUNDASSET_ARRAY(WaterSounds, i); - } + UNPACKDATA_ASSET_ARRAY_REFACTOR(WaterSounds, Sounds::MaxSounds); if( stream->readFlag() ) dustID = (S32) stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); @@ -1210,27 +1193,27 @@ void RigidShape::updatePos(F32 dt) if (collSpeed >= mDataBlock->softImpactSpeed) impactSound = RigidShapeData::Body::SoftImpactSound; - if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound)) - SFX->playOnce(mDataBlock->getBodySoundsProfile(impactSound), &getTransform()); + if (impactSound != -1 && mDataBlock->getBodySoundsSFXTrack(impactSound)) + SFX->playOnce(mDataBlock->getBodySoundsSFXTrack(impactSound), &getTransform()); } // Water volume sounds F32 vSpeed = getVelocity().len(); if (!inLiquid && mWaterCoverage >= 0.8f) { if (vSpeed >= mDataBlock->hardSplashSoundVel) - SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform()); + SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactHard), &getTransform()); else if (vSpeed >= mDataBlock->medSplashSoundVel) - SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform()); + SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactMedium), &getTransform()); else if (vSpeed >= mDataBlock->softSplashSoundVel) - SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform()); + SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ImpactSoft), &getTransform()); inLiquid = true; } else if (inLiquid && mWaterCoverage < 0.8f) { if (vSpeed >= mDataBlock->exitSplashSoundVel) - SFX->playOnce(mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform()); + SFX->playOnce(mDataBlock->getWaterSoundsSFXTrack(RigidShapeData::ExitWater), &getTransform()); inLiquid = false; } } diff --git a/Engine/source/T3D/rigidShape.h b/Engine/source/T3D/rigidShape.h index 95ce0a361d..8a4dca7292 100644 --- a/Engine/source/T3D/rigidShape.h +++ b/Engine/source/T3D/rigidShape.h @@ -83,7 +83,6 @@ class RigidShapeData : public ShapeBaseData MaxSounds }; DECLARE_SOUNDASSET_ARRAY(RigidShapeData, WaterSounds, Sounds::MaxSounds) - DECLARE_ASSET_ARRAY_SETGET(RigidShapeData, WaterSounds); F32 exitSplashSoundVel; F32 softSplashSoundVel; diff --git a/Engine/source/T3D/sfx/sfxEmitter.cpp b/Engine/source/T3D/sfx/sfxEmitter.cpp index 16d8394d93..a3833e7aee 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.cpp +++ b/Engine/source/T3D/sfx/sfxEmitter.cpp @@ -223,8 +223,6 @@ SFXEmitter::SFXEmitter() mInstanceDescription = &mDescription; mLocalProfile = NULL; - INIT_ASSET(Sound); - mObjBox.minExtents.set( -1.f, -1.f, -1.f ); mObjBox.maxExtents.set( 1.f, 1.f, 1.f ); } @@ -408,15 +406,10 @@ U32 SFXEmitter::packUpdate(NetConnection* con, U32 mask, BitStream* stream) stream->writeAffineTransform(mObjToWorld); // track - if (stream->writeFlag(mask & DirtyUpdateMask)){ - PACK_ASSET(con, Sound); + if (stream->writeFlag(mDirty.test(Track))){ + PACK_ASSET_REFACTOR(con, Sound); } - //if (stream->writeFlag(mDirty.test(Track))) - // sfxWrite( stream, mTrack ); - // filename - //if( stream->writeFlag( mDirty.test( Filename ) ) ) - // stream->writeString( mLocalProfile.mFilename ); if (!stream->writeFlag(mUseTrackDescriptionOnly)) { // volume @@ -521,22 +514,11 @@ void SFXEmitter::unpackUpdate( NetConnection *conn, BitStream *stream ) } // track - if (stream->readFlag()) // DirtyUpdateMask - { - initialUpdate = false; - UNPACK_ASSET(conn, Sound); - } - /*if (_readDirtyFlag(stream, Track)) + if (_readDirtyFlag(stream, Track)) // DirtyUpdateMask { - String errorStr; - if( !sfxReadAndResolve( stream, &mTrack, errorStr ) ) - Con::errorf( "%s", errorStr.c_str() ); + UNPACK_ASSET_REFACTOR(conn, Sound); } - // filename - if ( _readDirtyFlag( stream, Filename ) ) - mLocalProfile.mFilename = stream->readSTString();*/ - mUseTrackDescriptionOnly = stream->readFlag(); if (!mUseTrackDescriptionOnly) { @@ -775,7 +757,7 @@ void SFXEmitter::_update() SFXStatus prevState = mSource ? mSource->getStatus() : SFXStatusNull; // are we overriding the asset properties? - bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile()); + bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundSFXTrack()); if (mSoundAsset.notNull()) { @@ -784,7 +766,7 @@ void SFXEmitter::_update() else mInstanceDescription = &mDescription; - mLocalProfile = getSoundProfile(); + mLocalProfile = getSoundSFXTrack(); // Make sure all the settings are valid. mInstanceDescription->validate(); @@ -798,12 +780,12 @@ void SFXEmitter::_update() if( mDirty.test( Track | Is3D | IsLooping | IsStreaming | TrackOnly ) ) { SFX_DELETE( mSource ); - if (getSoundProfile()) + if (getSoundSFXTrack()) { mSource = SFX->createSource(mLocalProfile, &transform, &velocity); if (!mSource) Con::errorf("SFXEmitter::_update() - failed to create sound for track %i (%s)", - getSoundProfile()->getId(), getSoundProfile()->getName()); + getSoundSFXTrack()->getId(), getSoundSFXTrack()->getName()); // If we're supposed to play when the emitter is // added to the scene then also restart playback @@ -820,7 +802,7 @@ void SFXEmitter::_update() // is toggled on a local profile sound. It makes the // editor feel responsive and that things are working. if( gEditingMission && - (SoundAsset::getAssetErrCode(mSoundAsset) || !mSoundAsset->getSfxProfile()) && + (SoundAsset::getAssetErrCode(mSoundAsset)) && mPlayOnAdd && mDirty.test( IsLooping ) ) prevState = SFXStatusPlaying; @@ -1222,7 +1204,7 @@ void SFXEmitter::setScale( const VectorF &scale ) { F32 maxDistance; - if( mUseTrackDescriptionOnly && mSoundAsset.notNull() && getSoundProfile()) + if( mUseTrackDescriptionOnly && mSoundAsset.notNull()) maxDistance = mSoundAsset->getSfxDescription()->mMaxDistance; else { diff --git a/Engine/source/T3D/sfx/sfxEmitter.h b/Engine/source/T3D/sfx/sfxEmitter.h index 562bb55c42..ead394538a 100644 --- a/Engine/source/T3D/sfx/sfxEmitter.h +++ b/Engine/source/T3D/sfx/sfxEmitter.h @@ -122,9 +122,8 @@ class SFXEmitter : public SceneObject BitSet32 mDirty; DECLARE_SOUNDASSET(SFXEmitter, Sound); - DECLARE_ASSET_NET_SETGET(SFXEmitter, Sound, DirtyUpdateMask); /// returns the shape asset used for this object - StringTableEntry getTypeHint() const override { return (getSoundAsset()) ? getSoundAsset()->getAssetName() : StringTable->EmptyString(); } + StringTableEntry getTypeHint() const override { return (mSoundAsset.notNull()) ? mSoundAsset->getAssetName() : StringTable->EmptyString(); } /// The sound source for the emitter. SFXSource *mSource; diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index a8807a0262..0691a43365 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -267,7 +267,6 @@ struct ShapeBaseImageData: public GameBaseData, protected AssetPtrCallback //SFXTrack* sound; F32 emitterTime; ///< S32 emitterNode[MaxShapes]; ///< Node ID on the shape to emit from - SoundAsset* sound; SFXTrack* soundTrack; ///EmptyString()) - { - //ok, so we've got some sort of special-case here like a fallback or SFXPlaylist. So do the hook-up now - SFXTrack* sndTrack; - if (!Sim::findObject(mstateSoundName[stateId], sndTrack)) - { - Con::errorf("ShapeBaseImageData::onAdd() - attempted to find sound %s but failed!", mstateSoundName[stateId]); - } - else - { - s.soundTrack = sndTrack; - } - } - else if (mstateSoundSFXId[stateId] != 0) - { - SFXTrack* sndTrack; - if (!Sim::findObject(mstateSoundSFXId[stateId], sndTrack)) - { - Con::errorf("ShapeBaseImageData::onAdd() - attempted to find sound %i but failed!", mstateSoundSFXId[stateId]); - } - else - { - s.soundTrack = sndTrack; - } - } - } + s.soundTrack = getstateSoundSFXTrack(stateId); } S32 ShapeBaseImageData::lookupState(const char* name) @@ -1162,7 +1129,7 @@ void ShapeBaseImageData::packData(BitStream* stream) } } - PACKDATA_SOUNDASSET_ARRAY(stateSound, i); + PACKDATA_ASSET_ARRAY(stateSound, i); } stream->write(maxConcurrentSounds); stream->writeFlag(useRemainderDT); @@ -1364,7 +1331,7 @@ void ShapeBaseImageData::unpackData(BitStream* stream) else s.emitter = 0; - UNPACKDATA_SOUNDASSET_ARRAY(stateSound, i); + UNPACKDATA_ASSET_ARRAY(stateSound, i); handleStateSoundTrack(i); } } @@ -2776,7 +2743,7 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force) // Delete any loooping sounds that were in the previous state. // this is the crazy bit =/ needs to know prev state in order to stop sounds. // lastState does not return an id for the prev state so we keep track of it. - if (lastState->sound && lastState->sound->getSFXTrack()->getDescription()->mIsLooping) + if (lastState->soundTrack && lastState->soundTrack->getDescription()->mIsLooping) { for (Vector::iterator i = image.mSoundSources.begin(); i != image.mSoundSources.end(); i++) SFX_DELETE((*i)); @@ -2787,11 +2754,6 @@ void ShapeBase::setImageState(U32 imageSlot, U32 newState, bool force) // Play sound if (isGhost()) { - if (stateData.sound) - { - const Point3F& velocity = getVelocity(); - image.addSoundSource(SFX->createSource(stateData.sound->getSFXTrack(), &getRenderTransform(), &velocity)); - } if (stateData.soundTrack) { const Point3F& velocity = getVelocity(); diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 4e10c4b2a1..9712d481c4 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -124,9 +124,6 @@ FlyingVehicleData::FlyingVehicleData() for (S32 j = 0; j < MaxJetEmitters; j++) jetEmitter[j] = 0; - for (S32 i = 0; i < MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(FlyingSounds, i); - vertThrustMultiple = 1.0; } @@ -141,7 +138,7 @@ bool FlyingVehicleData::preload(bool server, String &errorStr) if (!server) { for (S32 i = 0; i < MaxSounds; i++) { - if (!isFlyingSoundsValid(i)) + if (!getFlyingSoundsSFXTrack(i)) { //return false; -TODO: trigger asset download } @@ -258,10 +255,7 @@ void FlyingVehicleData::packData(BitStream* stream) { Parent::packData(stream); - for (S32 i = 0; i < MaxSounds; i++) - { - PACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i); - } + PACKDATA_ASSET_ARRAY_REFACTOR(FlyingSounds, MaxSounds); for (S32 j = 0; j < MaxJetEmitters; j++) { @@ -293,10 +287,7 @@ void FlyingVehicleData::unpackData(BitStream* stream) { Parent::unpackData(stream); - for (S32 i = 0; i < MaxSounds; i++) - { - UNPACKDATA_SOUNDASSET_ARRAY(FlyingSounds, i); - } + UNPACKDATA_ASSET_ARRAY_REFACTOR(FlyingSounds, MaxSounds); for (S32 j = 0; j < MaxJetEmitters; j++) { jetEmitter[j] = NULL; @@ -385,11 +376,11 @@ bool FlyingVehicle::onNewDataBlock(GameBaseData* dptr, bool reload) SFX_DELETE( mJetSound ); SFX_DELETE( mEngineSound ); - if ( mDataBlock->getFlyingSounds(FlyingVehicleData::EngineSound) ) - mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::EngineSound), &getTransform() ); + if ( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::EngineSound) ) + mEngineSound = SFX->createSource( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::EngineSound), &getTransform() ); - if ( mDataBlock->getFlyingSounds(FlyingVehicleData::JetSound)) - mJetSound = SFX->createSource( mDataBlock->getFlyingSoundsProfile(FlyingVehicleData::JetSound), &getTransform() ); + if ( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::JetSound)) + mJetSound = SFX->createSource( mDataBlock->getFlyingSoundsSFXTrack(FlyingVehicleData::JetSound), &getTransform() ); } // Jet Sequences diff --git a/Engine/source/T3D/vehicles/flyingVehicle.h b/Engine/source/T3D/vehicles/flyingVehicle.h index 141515e834..5c7458a6ab 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.h +++ b/Engine/source/T3D/vehicles/flyingVehicle.h @@ -46,7 +46,6 @@ struct FlyingVehicleData: public VehicleData { MaxSounds, }; DECLARE_SOUNDASSET_ARRAY(FlyingVehicleData, FlyingSounds, Sounds::MaxSounds); - DECLARE_ASSET_ARRAY_SETGET(FlyingVehicleData, FlyingSounds); enum Jets { // These enums index into a static name list. diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 60c24434f4..c24d78a86e 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -158,9 +158,6 @@ HoverVehicleData::HoverVehicleData() for (S32 j = 0; j < MaxJetEmitters; j++) jetEmitter[j] = 0; - - for (S32 i = 0; i < MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(HoverSounds, i); } HoverVehicleData::~HoverVehicleData() @@ -313,7 +310,7 @@ bool HoverVehicleData::preload(bool server, String &errorStr) for (S32 i = 0; i < MaxSounds; i++) { - if (!isHoverSoundsValid(i)) + if (!getHoverSoundsSFXTrack(i)) { //return false; -TODO: trigger asset download } @@ -365,10 +362,7 @@ void HoverVehicleData::packData(BitStream* stream) stream->write(triggerTrailHeight); stream->write(dustTrailFreqMod); - for (S32 i = 0; i < MaxSounds; i++) - { - PACKDATA_SOUNDASSET_ARRAY(HoverSounds, i); - } + PACKDATA_ASSET_ARRAY_REFACTOR(HoverSounds, MaxSounds); for (S32 j = 0; j < MaxJetEmitters; j++) { @@ -414,10 +408,7 @@ void HoverVehicleData::unpackData(BitStream* stream) stream->read(&triggerTrailHeight); stream->read(&dustTrailFreqMod); - for (S32 i = 0; i < MaxSounds; i++) - { - UNPACKDATA_SOUNDASSET_ARRAY(HoverSounds, i); - } + UNPACKDATA_ASSET_ARRAY_REFACTOR(HoverSounds, MaxSounds); for (S32 j = 0; j < MaxJetEmitters; j++) { jetEmitter[j] = NULL; @@ -539,14 +530,14 @@ bool HoverVehicle::onNewDataBlock(GameBaseData* dptr, bool reload) SFX_DELETE( mFloatSound ); SFX_DELETE( mJetSound ); - if ( mDataBlock->getHoverSounds(HoverVehicleData::EngineSound) ) - mEngineSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::EngineSound), &getTransform() ); + if ( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::EngineSound) ) + mEngineSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::EngineSound), &getTransform() ); - if ( !mDataBlock->getHoverSounds(HoverVehicleData::FloatSound) ) - mFloatSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::FloatSound), &getTransform() ); + if ( !mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::FloatSound) ) + mFloatSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::FloatSound), &getTransform() ); - if ( mDataBlock->getHoverSounds(HoverVehicleData::JetSound) ) - mJetSound = SFX->createSource( mDataBlock->getHoverSoundsProfile(HoverVehicleData::JetSound), &getTransform() ); + if ( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::JetSound) ) + mJetSound = SFX->createSource( mDataBlock->getHoverSoundsSFXTrack(HoverVehicleData::JetSound), &getTransform() ); } // Todo: Uncomment if this is a "leaf" class diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index 18ea38e104..43f85719ec 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -882,27 +882,27 @@ void Vehicle::updatePos(F32 dt) if (collSpeed >= mDataBlock->softImpactSpeed) impactSound = RigidShapeData::Body::SoftImpactSound; - if (impactSound != -1 && mDataBlock->getBodySoundsProfile(impactSound) != NULL) - SFX->playOnce( mDataBlock->getBodySoundsProfile(impactSound), &getTransform() ); + if (impactSound != -1 && mDataBlock->getBodySoundsSFXTrack(impactSound) != NULL) + SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(impactSound), &getTransform() ); } // Water volume sounds F32 vSpeed = getVelocity().len(); if (!inLiquid && mWaterCoverage >= 0.8f) { if (vSpeed >= mDataBlock->hardSplashSoundVel) - SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactHard), &getTransform() ); + SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactHard), &getTransform() ); else if (vSpeed >= mDataBlock->medSplashSoundVel) - SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactMedium), &getTransform() ); + SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactMedium), &getTransform() ); else if (vSpeed >= mDataBlock->softSplashSoundVel) - SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ImpactSoft), &getTransform() ); + SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ImpactSoft), &getTransform() ); inLiquid = true; } else if(inLiquid && mWaterCoverage < 0.8f) { if (vSpeed >= mDataBlock->exitSplashSoundVel) - SFX->playOnce( mDataBlock->getWaterSoundsProfile(RigidShapeData::ExitWater), &getTransform() ); + SFX->playOnce( mDataBlock->getBodySoundsSFXTrack(RigidShapeData::ExitWater), &getTransform() ); inLiquid = false; } } diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 44b8b0623a..bb94711cfe 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -312,8 +312,6 @@ WheeledVehicleData::WheeledVehicleData() steeringSequence = -1; wheelCount = 0; dMemset(&wheel, 0, sizeof(wheel)); - for (S32 i = 0; i < MaxSounds; i++) - INIT_SOUNDASSET_ARRAY(WheeledVehicleSounds, i); mDownForce = 0; } @@ -348,7 +346,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr) if (!server) { for (S32 i = 0; i < MaxSounds; i++) { - if (!isWheeledVehicleSoundsValid(i)) + if (!getWheeledVehicleSoundsSFXTrack(i)) { //return false; -TODO: trigger asset download } @@ -493,10 +491,7 @@ void WheeledVehicleData::packData(BitStream* stream) stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter): tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); - for (S32 i = 0; i < MaxSounds; i++) - { - PACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i); - } + PACKDATA_ASSET_ARRAY_REFACTOR(WheeledVehicleSounds, MaxSounds); stream->write(maxWheelSpeed); stream->write(engineTorque); @@ -513,10 +508,8 @@ void WheeledVehicleData::unpackData(BitStream* stream) (ParticleEmitterData*)(uintptr_t)stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast): 0; - for (S32 i = 0; i < MaxSounds; i++) - { - UNPACKDATA_SOUNDASSET_ARRAY(WheeledVehicleSounds, i); - } + UNPACKDATA_ASSET_ARRAY_REFACTOR(WheeledVehicleSounds, MaxSounds); + stream->read(&maxWheelSpeed); stream->read(&engineTorque); @@ -700,14 +693,14 @@ bool WheeledVehicle::onNewDataBlock(GameBaseData* dptr, bool reload) SFX_DELETE( mSquealSound ); SFX_DELETE( mJetSound ); - if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::EngineSound) ) - mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::EngineSound), &getTransform() ); + if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::EngineSound) ) + mEngineSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::EngineSound), &getTransform() ); - if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::SquealSound) ) - mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::SquealSound), &getTransform() ); + if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::SquealSound) ) + mSquealSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::SquealSound), &getTransform() ); - if ( mDataBlock->getWheeledVehicleSounds(WheeledVehicleData::JetSound) ) - mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsProfile(WheeledVehicleData::JetSound), &getTransform() ); + if ( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::JetSound) ) + mJetSound = SFX->createSource( mDataBlock->getWheeledVehicleSoundsSFXTrack(WheeledVehicleData::JetSound), &getTransform() ); } scriptOnNewDataBlock(reload); diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 645ca4d32f..c864661e6a 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -141,8 +141,6 @@ U32 Projectile::smProjectileWarpTicks = 5; // afxMagicMissileData::afxMagicMissileData() { - INIT_ASSET(ProjectileSound); - /* From stock Projectile code... explosion = NULL; explosionId = 0; @@ -247,9 +245,9 @@ afxMagicMissileData::afxMagicMissileData() afxMagicMissileData::afxMagicMissileData(const afxMagicMissileData& other, bool temp_clone) : GameBaseData(other, temp_clone) { - mProjectileShapeAsset = other.mProjectileShapeAsset; + mProjectileShapeAsset = other.mProjectileShapeAsset; projectileShape = other.projectileShape; // -- TSShape loads using projectileShapeName - CLONE_ASSET(ProjectileSound); + mProjectileSoundAsset = other.mProjectileSoundAsset; splash = other.splash; splashId = other.splashId; // -- for pack/unpack of splash ptr lightDesc = other.lightDesc; @@ -522,7 +520,7 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); */ - if (!isProjectileSoundValid()) + if (!getProjectileSoundSFXTrack()) { //return false; -TODO: trigger asset download } @@ -622,7 +620,7 @@ void afxMagicMissileData::packData(BitStream* stream) DataBlockObjectIdLast); */ - PACKDATA_ASSET(ProjectileSound); + PACKDATA_ASSET_REFACTOR(ProjectileSound); if ( stream->writeFlag(lightDesc != NULL)) stream->writeRangedU32(lightDesc->getId(), DataBlockObjectIdFirst, @@ -728,7 +726,7 @@ void afxMagicMissileData::unpackData(BitStream* stream) decalId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); */ - UNPACKDATA_ASSET(ProjectileSound); + UNPACKDATA_ASSET_REFACTOR(ProjectileSound); if (stream->readFlag()) lightDescId = stream->readRangedU32(DataBlockObjectIdFirst, DataBlockObjectIdLast); @@ -1152,8 +1150,7 @@ bool afxMagicMissile::onNewDataBlock(GameBaseData* dptr, bool reload) SFX_DELETE( mSound ); - if (mDataBlock->getProjectileSound()) - mSound = SFX->createSource(mDataBlock->getProjectileSoundProfile()); + mSound = SFX->createSource(mDataBlock->getProjectileSoundSFXTrack()); } return true; @@ -1988,7 +1985,7 @@ void afxMagicMissile::get_launch_data(Point3F& pos, Point3F& vel) void afxMagicMissile::updateSound() { - if (!mDataBlock->isProjectileSoundValid()) + if (!mDataBlock->getProjectileSoundAsset().isNull()) return; if ( mSound ) diff --git a/Engine/source/afx/afxMagicMissile.h b/Engine/source/afx/afxMagicMissile.h index 15c8b2b71e..f169c8ebb0 100644 --- a/Engine/source/afx/afxMagicMissile.h +++ b/Engine/source/afx/afxMagicMissile.h @@ -124,7 +124,6 @@ class afxMagicMissileData : public GameBaseData, protected AssetPtrCallback S32 splashId; // Water splash ID DECLARE_SOUNDASSET(afxMagicMissileData, ProjectileSound); - DECLARE_ASSET_SETGET(afxMagicMissileData, ProjectileSound); LightDescription *lightDesc; S32 lightDescId; diff --git a/Engine/source/forest/hlsl/windDeformationHLSL.cpp b/Engine/source/forest/hlsl/windDeformationHLSL.cpp index 6122024dda..d921495565 100644 --- a/Engine/source/forest/hlsl/windDeformationHLSL.cpp +++ b/Engine/source/forest/hlsl/windDeformationHLSL.cpp @@ -120,7 +120,7 @@ void WindDeformationHLSL::processVert( Vector &componentList, { accumTime = new Var( "accumTime", "float" ); accumTime->uniform = true; - accumTime->constSortPos = cspPass; + accumTime->constSortPos = cspScene; } // Get the transform to world space. diff --git a/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp b/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp index 2a545ffe16..7fbcd61048 100644 --- a/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp +++ b/Engine/source/gui/buttons/guiButtonBaseCtrl.cpp @@ -258,8 +258,7 @@ void GuiButtonBaseCtrl::onMouseDown(const GuiEvent& event) if (mProfile->mCanKeyFocus) setFirstResponder(); - if (mProfile->isSoundButtonDownValid()) - SFX->playOnce(mProfile->getSoundButtonDownProfile()); + SFX->playOnce(mProfile->getSoundButtonDownSFXTrack()); mMouseDownPoint = event.mousePoint; mMouseDragged = false; @@ -299,8 +298,7 @@ void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent& event) } else { - if (mProfile->isSoundButtonOverValid()) - SFX->playOnce(mProfile->getSoundButtonOverProfile()); + SFX->playOnce(mProfile->getSoundButtonOverSFXTrack()); mHighlighted = true; messageSiblings(mRadioGroup); @@ -388,8 +386,7 @@ bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent& event) if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE) && event.modifier == 0) { - if (mProfile->isSoundButtonDownValid()) - SFX->playOnce(mProfile->getSoundButtonDownProfile()); + SFX->playOnce(mProfile->getSoundButtonDownSFXTrack()); return true; } diff --git a/Engine/source/gui/controls/guiMLTextCtrl.cpp b/Engine/source/gui/controls/guiMLTextCtrl.cpp index 5e2f124697..48b02664d9 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.cpp +++ b/Engine/source/gui/controls/guiMLTextCtrl.cpp @@ -282,7 +282,6 @@ GuiMLTextCtrl::GuiMLTextCtrl() { mActive = true; //mInitialText = StringTable->EmptyString(); - INIT_ASSET(DeniedSound); } //-------------------------------------------------------------------------- @@ -344,8 +343,6 @@ bool GuiMLTextCtrl::onAdd() if (!mTextBuffer.length() && mInitialText[0] != 0) setText(mInitialText, dStrlen(mInitialText)+1); - _setDeniedSound(getDeniedSound()); - return true; } @@ -964,8 +961,8 @@ void GuiMLTextCtrl::insertChars(const char* inputChars, if (numCharsToInsert <= 0) { // Play the "Denied" sound: - if ( numInputChars > 0 && getDeniedSoundProfile()) - SFX->playOnce(getDeniedSoundProfile()); + if ( numInputChars > 0) + SFX->playOnce(getDeniedSoundSFXTrack()); return; } diff --git a/Engine/source/gui/controls/guiMLTextCtrl.h b/Engine/source/gui/controls/guiMLTextCtrl.h index fb825a451a..a50962011a 100644 --- a/Engine/source/gui/controls/guiMLTextCtrl.h +++ b/Engine/source/gui/controls/guiMLTextCtrl.h @@ -265,7 +265,6 @@ class GuiMLTextCtrl : public GuiControl // Too many chars sound: DECLARE_SOUNDASSET(GuiMLTextCtrl, DeniedSound); - DECLARE_ASSET_SETGET(GuiMLTextCtrl, DeniedSound); // Typeout over time bool mUseTypeOverTime; U32 mTypeOverTimeStartMS; diff --git a/Engine/source/gui/controls/guiSliderCtrl.cpp b/Engine/source/gui/controls/guiSliderCtrl.cpp index 4ab0d6850e..07ba364182 100644 --- a/Engine/source/gui/controls/guiSliderCtrl.cpp +++ b/Engine/source/gui/controls/guiSliderCtrl.cpp @@ -205,8 +205,7 @@ void GuiSliderCtrl::onMouseDown(const GuiEvent &event) setFirstResponder(); mDepressed = true; - if (mProfile->isSoundButtonDownValid()) - SFX->playOnce(mProfile->getSoundButtonDownProfile()); + SFX->playOnce(mProfile->getSoundButtonDownSFXTrack()); Point2I curMousePos = globalToLocalCoord( event.mousePoint ); F32 value; @@ -262,11 +261,9 @@ void GuiSliderCtrl::onMouseEnter(const GuiEvent &event) } else { - if( mActive && mProfile->mSoundButtonOver ) + if( mActive ) { - //F32 pan = (F32(event.mousePoint.x)/F32(getRoot()->getWidth())*2.0f-1.0f)*0.8f; - if (mProfile->isSoundButtonOverValid()) - SFX->playOnce(mProfile->getSoundButtonOverProfile()); + SFX->playOnce(mProfile->getSoundButtonOverSFXTrack()); } mMouseOver = true; diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index f0dbf8ebc4..095c67b3a1 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -244,8 +244,6 @@ GuiControlProfile::GuiControlProfile(void) : mTextOffset(0,0), mBitmapArrayRects(0) { - INIT_ASSET(SoundButtonDown); - INIT_ASSET(SoundButtonOver); mLoadCount = 0; mUseCount = 0; @@ -321,21 +319,6 @@ GuiControlProfile::GuiControlProfile(void) : mUseBitmapArray = def->mUseBitmapArray; mTextOffset = def->mTextOffset; - // default sound - _setSoundButtonDown(def->getSoundButtonDown()); - if (getSoundButtonDown() != StringTable->EmptyString()) - { - if (!getSoundButtonDownProfile()) - Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button pressed sound asset."); - } - - _setSoundButtonOver(def->getSoundButtonOver()); - if (getSoundButtonOver() != StringTable->EmptyString()) - { - if (!getSoundButtonOverProfile()) - Con::errorf(ConsoleLogEntry::General, "GuiControlProfile: Can't get default button hover sound asset."); - } - //used by GuiTextCtrl mModal = def->mModal; mAlignment = def->mAlignment; diff --git a/Engine/source/gui/core/guiTypes.h b/Engine/source/gui/core/guiTypes.h index 9c21e54de5..2f8590849b 100644 --- a/Engine/source/gui/core/guiTypes.h +++ b/Engine/source/gui/core/guiTypes.h @@ -467,10 +467,8 @@ class GuiControlProfile : public SimObject Vector mBitmapArrayRects; ///< Used for controls which use an array of bitmaps such as checkboxes DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonDown); ///< Sound played when a button is pressed. - DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonDown); DECLARE_SOUNDASSET(GuiControlProfile, SoundButtonOver); ///< Sound played when a button is hovered. - DECLARE_ASSET_SETGET(GuiControlProfile, SoundButtonOver); StringTableEntry mChildrenProfileName; ///< The name of the profile to use for the children controls diff --git a/Engine/source/gui/shiny/guiAudioCtrl.cpp b/Engine/source/gui/shiny/guiAudioCtrl.cpp index c40f8042c0..d02c6717c4 100644 --- a/Engine/source/gui/shiny/guiAudioCtrl.cpp +++ b/Engine/source/gui/shiny/guiAudioCtrl.cpp @@ -40,7 +40,6 @@ ConsoleDocClass( GuiAudioCtrl, GuiAudioCtrl::GuiAudioCtrl() { - INIT_ASSET(Sound); mTickPeriodMS = 100; mLastThink = 0; mCurrTick = 0; @@ -85,7 +84,7 @@ void GuiAudioCtrl::processTick() { mCurrTick = 0; mLastThink = 0; - if (isSoundValid()) + if (getSoundAsset().notNull()) { _update(); } @@ -154,14 +153,11 @@ void GuiAudioCtrl::_update() if (testCondition() && isAwake()) { - bool useTrackDescriptionOnly = (mUseTrackDescriptionOnly && getSoundProfile()); + bool useTrackDescriptionOnly = mUseTrackDescriptionOnly; - if (getSoundProfile()) + if (mSoundPlaying == NULL) { - if (mSoundPlaying == NULL) - { - mSoundPlaying = SFX->createSource(getSoundProfile(), &(SFX->getListener().getTransform())); - } + mSoundPlaying = SFX->createSource(getSoundSFXTrack(), &(SFX->getListener().getTransform())); } if ( mSoundPlaying && !mSoundPlaying->isPlaying()) diff --git a/Engine/source/gui/shiny/guiAudioCtrl.h b/Engine/source/gui/shiny/guiAudioCtrl.h index dabd32f60d..b1d4edf124 100644 --- a/Engine/source/gui/shiny/guiAudioCtrl.h +++ b/Engine/source/gui/shiny/guiAudioCtrl.h @@ -84,7 +84,6 @@ class GuiAudioCtrl : public GuiTickCtrl public: DECLARE_SOUNDASSET(GuiAudioCtrl, Sound); - DECLARE_ASSET_SETGET(GuiAudioCtrl, Sound); GuiAudioCtrl(); ~GuiAudioCtrl(); // GuiControl. diff --git a/Engine/source/materials/materialDefinition.cpp b/Engine/source/materials/materialDefinition.cpp index 4c0e3a61fa..c9d9f3b847 100644 --- a/Engine/source/materials/materialDefinition.cpp +++ b/Engine/source/materials/materialDefinition.cpp @@ -228,8 +228,6 @@ Material::Material() mFootstepSoundId = -1; mImpactSoundId = -1; mImpactFXIndex = -1; - INIT_ASSET(CustomFootstepSound); - INIT_ASSET(CustomImpactSound); mFriction = 0.0; mDirectSoundOcclusion = 1.f; diff --git a/Engine/source/materials/materialDefinition.h b/Engine/source/materials/materialDefinition.h index cecbdc7b30..eb5af659f2 100644 --- a/Engine/source/materials/materialDefinition.h +++ b/Engine/source/materials/materialDefinition.h @@ -356,9 +356,7 @@ class Material : public BaseMaterialDefinition /// If defined, overrides mFootstepSoundId. /// @see mFootstepSoundId DECLARE_SOUNDASSET(Material, CustomFootstepSound); - DECLARE_ASSET_SETGET(Material, CustomFootstepSound); DECLARE_SOUNDASSET(Material, CustomImpactSound); - DECLARE_ASSET_SETGET(Material, CustomImpactSound); F32 mFriction; ///< Friction coefficient when moving along surface. diff --git a/Engine/source/sfx/sfxAmbience.cpp b/Engine/source/sfx/sfxAmbience.cpp index 285ffc03a0..530529779c 100644 --- a/Engine/source/sfx/sfxAmbience.cpp +++ b/Engine/source/sfx/sfxAmbience.cpp @@ -88,7 +88,6 @@ SFXAmbience::SFXAmbience() mEnvironment( NULL ) { dMemset( mState, 0, sizeof( mState ) ); - INIT_ASSET(SoundTrack); } //----------------------------------------------------------------------------- @@ -133,7 +132,6 @@ bool SFXAmbience::onAdd() Sim::getSFXAmbienceSet()->addObject( this ); - _setSoundTrack(getSoundTrack()); return true; } @@ -153,7 +151,7 @@ bool SFXAmbience::preload( bool server, String& errorStr ) if( !sfxResolve( &mEnvironment, errorStr ) ) return false; - if (!isSoundTrackValid()) + if (!getSoundTrackSFXTrack()) { //return false; -TODO: trigger asset download } @@ -173,7 +171,7 @@ void SFXAmbience::packData( BitStream* stream ) Parent::packData( stream ); sfxWrite( stream, mEnvironment ); - PACKDATA_ASSET(SoundTrack); + PACKDATA_ASSET_REFACTOR(SoundTrack); stream->write( mRolloffFactor ); stream->write( mDopplerFactor ); @@ -189,7 +187,7 @@ void SFXAmbience::unpackData( BitStream* stream ) Parent::unpackData( stream ); sfxRead( stream, &mEnvironment ); - UNPACKDATA_ASSET(SoundTrack); + UNPACKDATA_ASSET_REFACTOR(SoundTrack); stream->read( &mRolloffFactor ); stream->read( &mDopplerFactor ); diff --git a/Engine/source/sfx/sfxAmbience.h b/Engine/source/sfx/sfxAmbience.h index bd36a1547f..acc3e3d704 100644 --- a/Engine/source/sfx/sfxAmbience.h +++ b/Engine/source/sfx/sfxAmbience.h @@ -67,7 +67,6 @@ class SFXAmbience : public SimDataBlock /// Sound track to play when inside the ambient space. DECLARE_SOUNDASSET(SFXAmbience, SoundTrack); - DECLARE_ASSET_SETGET(SFXAmbience, SoundTrack); /// Reverb environment to apply when inside the ambient space. SFXEnvironment* mEnvironment; diff --git a/Engine/source/sfx/sfxCommon.h b/Engine/source/sfx/sfxCommon.h index 784f612f63..d7b5aa5562 100644 --- a/Engine/source/sfx/sfxCommon.h +++ b/Engine/source/sfx/sfxCommon.h @@ -178,7 +178,7 @@ inline F32 SFXDistanceAttenuation( SFXDistanceModel model, F32 minDistance, F32 distance = getMax( distance, minDistance ); distance = getMin( distance, maxDistance ); - gain = ( 1 - ( distance - minDistance ) / ( maxDistance - minDistance ) ); + gain = ( 1 - rolloffFactor * ( distance - minDistance ) / ( maxDistance - minDistance ) ); break; case SFXDistanceModelLogarithmic: @@ -363,8 +363,8 @@ class SFXReverbProperties flGain = 0.0f; flGainHF = 0.0f; flGainLF = 0.0000f; - flDecayTime = 0.0f; - flDecayHFRatio = 0.0f; + flDecayTime = 0.1f; + flDecayHFRatio = 0.1f; flDecayLFRatio = 0.0f; flReflectionsGain = 0.0f; flReflectionsDelay = 0.0f; @@ -372,15 +372,17 @@ class SFXReverbProperties flLateReverbGain = 0.0f; flLateReverbDelay = 0.0f; dMemset(flLateReverbPan, 0, sizeof(flLateReverbPan)); - flEchoTime = 0.0f; + flEchoTime = 0.075f; flEchoDepth = 0.0f; - flModulationTime = 0.0f; + flModulationTime = 0.04f; flModulationDepth = 0.0f; - flAirAbsorptionGainHF = 0.0f; + flAirAbsorptionGainHF = 0.892f; flHFReference = 0.0f; flLFReference = 0.0f; flRoomRolloffFactor = 0.0f; iDecayHFLimit = 0; + + validate(); } void validate() diff --git a/Engine/source/sfx/sfxDescription.cpp b/Engine/source/sfx/sfxDescription.cpp index 4bb1524419..2a568f0469 100644 --- a/Engine/source/sfx/sfxDescription.cpp +++ b/Engine/source/sfx/sfxDescription.cpp @@ -173,7 +173,6 @@ SFXDescription::SFXDescription( const SFXDescription& desc ) mStreamPacketSize( desc.mStreamPacketSize ), mUseReverb( desc.mUseReverb ), mStreamReadAhead( desc.mStreamReadAhead ), - mReverb( desc.mReverb ), mScatterDistance( desc.mScatterDistance ), mPriority( desc.mPriority ) { @@ -206,7 +205,6 @@ SFXDescription::SFXDescription(const SFXDescription& other, bool temp_clone) mStreamPacketSize( other.mStreamPacketSize ), mStreamReadAhead( other.mStreamReadAhead ), mUseReverb( other.mUseReverb ), - mReverb( other.mReverb ), mPriority( other.mPriority ), mScatterDistance( other.mScatterDistance ) { @@ -390,54 +388,12 @@ void SFXDescription::initPersistFields() addGroup( "Reverb" ); - addField("useCustomReverb", TypeBool, Offset(mUseReverb, SFXDescription), + addField("allowReverb", TypeBool, Offset(mUseReverb, SFXDescription), "If true, use the reverb properties defined here on sounds.\n" "By default, sounds will be assigned a generic reverb profile. By setting this flag to true, " "a custom reverb setup can be defined using the \"Reverb\" properties that will then be assigned " "to sounds playing with the description.\n\n" "@ref SFX_reverb"); - addFieldV("reverbDensity", TypeRangedF32, Offset(mReverb.flDensity, SFXDescription), &CommonValidators::PositiveFloat, - "Density of reverb environment."); - addFieldV("reverbDiffusion", TypeRangedF32, Offset(mReverb.flDiffusion, SFXDescription), &CommonValidators::PositiveFloat, - "Environment diffusion."); - addFieldV("reverbGain", TypeRangedF32, Offset(mReverb.flGain, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb Gain Level."); - addFieldV("reverbGainHF", TypeRangedF32, Offset(mReverb.flGainHF, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb Gain to high frequencies"); - addFieldV("reverbGainLF", TypeRangedF32, Offset(mReverb.flGainLF, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb Gain to high frequencies"); - addFieldV("reverbDecayTime", TypeRangedF32, Offset(mReverb.flDecayTime, SFXDescription), &CommonValidators::PositiveFloat, - "Decay time for the reverb."); - addFieldV("reverbDecayHFRatio", TypeRangedF32, Offset(mReverb.flDecayHFRatio, SFXDescription), &CommonValidators::PositiveFloat, - "High frequency decay time ratio."); - addFieldV("reverbDecayLFRatio", TypeRangedF32, Offset(mReverb.flDecayLFRatio, SFXDescription), &CommonValidators::PositiveFloat, - "High frequency decay time ratio."); - addFieldV("reflectionsGain", TypeRangedF32, Offset(mReverb.flReflectionsGain, SFXDescription), &CommonValidators::PositiveFloat, - "Reflection Gain."); - addFieldV("reflectionDelay", TypeRangedF32, Offset(mReverb.flReflectionsDelay, SFXDescription), &CommonValidators::PositiveFloat, - "How long to delay reflections."); - addFieldV("lateReverbGain", TypeRangedF32, Offset(mReverb.flLateReverbGain, SFXDescription), &CommonValidators::PositiveFloat, - "Late reverb gain amount."); - addFieldV("lateReverbDelay", TypeRangedF32, Offset(mReverb.flLateReverbDelay, SFXDescription), &CommonValidators::PositiveFloat, - "Late reverb delay time."); - addFieldV("reverbEchoTime", TypeRangedF32, Offset(mReverb.flEchoTime, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb echo time."); - addFieldV("reverbEchoDepth", TypeRangedF32, Offset(mReverb.flEchoDepth, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb echo depth."); - addFieldV("reverbModTime", TypeRangedF32, Offset(mReverb.flModulationTime, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb Modulation time."); - addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXDescription), &CommonValidators::NormalizedFloat, - "Reverb Modulation Depth."); - addFieldV("airAbsorbtionGainHF", TypeRangedF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription), &CommonValidators::PositiveFloat, - "High Frequency air absorbtion"); - addFieldV("reverbHFRef", TypeRangedF32, Offset(mReverb.flHFReference, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb High Frequency Reference."); - addFieldV("reverbLFRef", TypeRangedF32, Offset(mReverb.flLFReference, SFXDescription), &CommonValidators::PositiveFloat, - "Reverb Low Frequency Reference."); - addFieldV("roomRolloffFactor", TypeRangedF32, Offset(mReverb.flRoomRolloffFactor, SFXDescription), &CommonValidators::NegDefaultF32, - "Rolloff factor for reverb."); - addFieldV("decayHFLimit", TypeRangedS32, Offset(mReverb.iDecayHFLimit, SFXDescription), &CommonValidators::PositiveInt, - "High Frequency decay limit."); endGroup("Reverb"); Parent::initPersistFields(); @@ -495,11 +451,6 @@ void SFXDescription::validate() mConeInsideAngle = mClamp( mConeInsideAngle, 0, 360 ); mConeOutsideAngle = mClamp( mConeOutsideAngle, mConeInsideAngle, 360 ); mConeOutsideVolume = mClampF( mConeOutsideVolume, 0, 1 ); - - if( !mIs3D ) - mUseReverb = false; - - mReverb.validate(); } //----------------------------------------------------------------------------- @@ -534,30 +485,6 @@ void SFXDescription::packData( BitStream *stream ) stream->writeFloat( mConeOutsideVolume, 6 ); - if( mUseReverb ) - { - stream->write(mReverb.flDensity); - stream->write(mReverb.flDiffusion); - stream->write(mReverb.flGain); - stream->write(mReverb.flGainHF); - stream->write(mReverb.flGainLF); - stream->write(mReverb.flDecayTime); - stream->write(mReverb.flDecayHFRatio); - stream->write(mReverb.flDecayLFRatio); - stream->write(mReverb.flReflectionsGain); - stream->write(mReverb.flReflectionsDelay); - stream->write(mReverb.flLateReverbGain); - stream->write(mReverb.flLateReverbDelay); - stream->write(mReverb.flEchoTime); - stream->write(mReverb.flEchoDepth); - stream->write(mReverb.flModulationTime); - stream->write(mReverb.flModulationDepth); - stream->write(mReverb.flAirAbsorptionGainHF); - stream->write(mReverb.flHFReference); - stream->write(mReverb.flLFReference); - stream->write(mReverb.flRoomRolloffFactor); - stream->write(mReverb.iDecayHFLimit); - } } stream->write( mFadeInTime ); @@ -607,30 +534,6 @@ void SFXDescription::unpackData( BitStream *stream ) mConeOutsideVolume = stream->readFloat( 6 ); - if( mUseReverb ) - { - stream->read(&mReverb.flDensity); - stream->read(&mReverb.flDiffusion); - stream->read(&mReverb.flGain); - stream->read(&mReverb.flGainHF); - stream->read(&mReverb.flGainLF); - stream->read(&mReverb.flDecayTime); - stream->read(&mReverb.flDecayHFRatio); - stream->read(&mReverb.flDecayLFRatio); - stream->read(&mReverb.flReflectionsGain); - stream->read(&mReverb.flReflectionsDelay); - stream->read(&mReverb.flLateReverbGain); - stream->read(&mReverb.flLateReverbDelay); - stream->read(&mReverb.flEchoTime); - stream->read(&mReverb.flEchoDepth); - stream->read(&mReverb.flModulationTime); - stream->read(&mReverb.flModulationDepth); - stream->read(&mReverb.flAirAbsorptionGainHF); - stream->read(&mReverb.flHFReference); - stream->read(&mReverb.flLFReference); - stream->read(&mReverb.flRoomRolloffFactor); - stream->read(&mReverb.iDecayHFLimit); - } } stream->read( &mFadeInTime ); diff --git a/Engine/source/sfx/sfxDescription.h b/Engine/source/sfx/sfxDescription.h index 8f4d311343..1bbdd05267 100644 --- a/Engine/source/sfx/sfxDescription.h +++ b/Engine/source/sfx/sfxDescription.h @@ -171,9 +171,6 @@ class SFXDescription : public SimDataBlock /// Only relevant if "isStreaming" is true. U32 mStreamReadAhead; - /// Reverb properties for sound playback. - SFXSoundReverbProperties mReverb; - /// Parameters to which sources playing with this description should automatically /// connect when created. StringTableEntry mParameters[ MaxNumParameters ]; @@ -202,4 +199,4 @@ class SFXDescription : public SimDataBlock }; -#endif // _SFXDESCRIPTION_H_ \ No newline at end of file +#endif // _SFXDESCRIPTION_H_ diff --git a/Engine/source/sfx/sfxSound.cpp b/Engine/source/sfx/sfxSound.cpp index 447eb993bd..0f6b8dd4d8 100644 --- a/Engine/source/sfx/sfxSound.cpp +++ b/Engine/source/sfx/sfxSound.cpp @@ -261,10 +261,8 @@ bool SFXSound::_allocVoice( SFXDevice* device ) _setCone( mConeInsideAngle, mConeOutsideAngle, mConeOutsideVolume ); } - // Set reverb, if enabled. - - if( mDescription->mUseReverb ) - mVoice->setReverb( mDescription->mReverb ); + // Set reverb, if the source group allows it. + mVoice->setReverb(getSourceGroup()->getDescription()->mUseReverb); // Update the duration... it shouldn't have changed, but // its probably better that we're accurate if it did. diff --git a/Engine/source/sfx/sfxSoundscape.cpp b/Engine/source/sfx/sfxSoundscape.cpp index b65c573d7b..9640b500f4 100644 --- a/Engine/source/sfx/sfxSoundscape.cpp +++ b/Engine/source/sfx/sfxSoundscape.cpp @@ -157,7 +157,7 @@ void SFXSoundscapeManager::update() if( !soundscape->_isOverridden() ) { - SFXTrack* track = ambience->getSoundTrackProfile(); + SFXTrack* track = ambience->getSoundTrackSFXTrack(); if( !soundscape->mSource || soundscape->mSource->getTrack() != track ) { if( soundscape->mSource != NULL ) diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index 37133de0db..d36916d9e2 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -1621,13 +1621,13 @@ DefineEngineFunction( sfxPlayOnce, S32, (StringTableEntry assetId, const char* a if (String::isEmpty(arg0) || !tempSoundAsset->is3D()) { - source = SFX->playOnce(tempSoundAsset->getSfxProfile()); + source = SFX->playOnce(tempSoundAsset->getSFXTrack()); } else { MatrixF transform; transform.set(EulerF(0, 0, 0), Point3F(dAtof(arg0), dAtof(arg1), dAtof(arg2))); - source = SFX->playOnce(tempSoundAsset->getSfxProfile(), &transform, NULL, dAtof(arg3)); + source = SFX->playOnce(tempSoundAsset->getSFXTrack(), &transform, NULL, dAtof(arg3)); } } else diff --git a/Engine/source/sfx/sfxVoice.h b/Engine/source/sfx/sfxVoice.h index 74e40293e8..4cb903c15b 100644 --- a/Engine/source/sfx/sfxVoice.h +++ b/Engine/source/sfx/sfxVoice.h @@ -212,7 +212,7 @@ class SFXVoice : public StrongRefBase, /// Set the reverb properties for playback of this sound. /// @note Has no effect on devices that do not support reverb. - virtual void setReverb( const SFXSoundReverbProperties& reverb ) {} + virtual void setReverb( bool useReverb ) {} /// Set the priority of this voice. Default 1.0. /// @note Has no effect on devices that do not support voice management. diff --git a/Engine/source/shaderGen/HLSL/depthHLSL.cpp b/Engine/source/shaderGen/HLSL/depthHLSL.cpp index 45d002c565..d94b076586 100644 --- a/Engine/source/shaderGen/HLSL/depthHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/depthHLSL.cpp @@ -50,7 +50,7 @@ void EyeSpaceDepthOutHLSL::processVert( Vector &componentLis eyePos->setType("float3"); eyePos->setName("eyePosWorld"); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } meta->addStatement( new GenOp( " @ = float4( @.xyz - @, 1 );\r\n", outWSEyeVec, wsPosition, eyePos ) ); @@ -74,7 +74,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector &componentList, vEye->setType("float3"); vEye->setName("vEye"); vEye->uniform = true; - vEye->constSortPos = cspPass; + vEye->constSortPos = cspScene; // Expose the depth to the depth format feature Var *depthOut = new Var; @@ -99,7 +99,7 @@ void EyeSpaceDepthOutHLSL::processPix( Vector &componentList, farDist->setType("float4"); farDist->setName("oneOverFarplane"); farDist->uniform = true; - farDist->constSortPos = cspPass; + farDist->constSortPos = cspScene; } meta->addStatement( new GenOp( " @ = length( @.xyz / @.w ) * @.x;\r\n", depthOutDecl, wsEyeVec, wsEyeVec, farDist ) ); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index d65cced8f1..5705e18ce8 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -593,7 +593,7 @@ Var* ShaderFeatureHLSL::getModelView( Vector &componentList, viewProj->setType( "float4x4" ); viewProj->setName( "viewProj" ); viewProj->uniform = true; - viewProj->constSortPos = cspPass; + viewProj->constSortPos = cspScene; } modelview = new Var; @@ -893,7 +893,7 @@ Var* ShaderFeatureHLSL::getSurface(Vector& componentList, Mult { wsEyePos = new Var("eyePosWorld", "float3"); wsEyePos->uniform = true; - wsEyePos->constSortPos = cspPass; + wsEyePos->constSortPos = cspScene; } Var *wsPosition = getInWsPosition(componentList); @@ -1867,7 +1867,7 @@ void ReflectCubeFeatHLSL::processVert( Vector &componentList, { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } // eye to vert @@ -2152,7 +2152,7 @@ void RTLightingFeatHLSL::processVert( Vector &componentList, { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } //Temporarily disabled while we figure out how to better handle normals without a normal map @@ -2237,43 +2237,43 @@ void RTLightingFeatHLSL::processPix( Vector &componentList, Var *inLightPos = new Var( "inLightPos", "float4" ); inLightPos->uniform = true; inLightPos->arraySize = 4; - inLightPos->constSortPos = cspPotentialPrimitive; + inLightPos->constSortPos = cspLightBuffer; Var * inLightConfigData = new Var( "inLightConfigData", "float4" ); inLightConfigData->uniform = true; inLightConfigData->arraySize = 4; - inLightConfigData->constSortPos = cspPotentialPrimitive; + inLightConfigData->constSortPos = cspLightBuffer; Var *inLightColor = new Var( "inLightColor", "float4" ); inLightColor->uniform = true; inLightColor->arraySize = 4; - inLightColor->constSortPos = cspPotentialPrimitive; + inLightColor->constSortPos = cspLightBuffer; Var *inLightSpotDir = new Var( "inLightSpotDir", "float4" ); inLightSpotDir->uniform = true; inLightSpotDir->arraySize = 4; - inLightSpotDir->constSortPos = cspPotentialPrimitive; + inLightSpotDir->constSortPos = cspLightBuffer; Var * lightSpotParams = new Var( "inlightSpotParams", "float2" ); lightSpotParams->uniform = true; lightSpotParams->arraySize = 4; - lightSpotParams->constSortPos = cspPotentialPrimitive; + lightSpotParams->constSortPos = cspLightBuffer; Var* hasVectorLight = new Var("hasVectorLight", "int"); hasVectorLight->uniform = true; - hasVectorLight->constSortPos = cspPotentialPrimitive; + hasVectorLight->constSortPos = cspLightBuffer; Var* vectorLightDirection = new Var("vectorLightDirection", "float4"); vectorLightDirection->uniform = true; - vectorLightDirection->constSortPos = cspPotentialPrimitive; + vectorLightDirection->constSortPos = cspLightBuffer; Var* vectorLightColor = new Var("vectorLightColor", "float4"); vectorLightColor->uniform = true; - vectorLightColor->constSortPos = cspPotentialPrimitive; + vectorLightColor->constSortPos = cspLightBuffer; Var* vectorLightBrightness = new Var("vectorLightBrightness", "float"); vectorLightBrightness->uniform = true; - vectorLightBrightness->constSortPos = cspPotentialPrimitive; + vectorLightBrightness->constSortPos = cspLightBuffer; Var* surface = getSurface(componentList, meta, fd); if (!surface) @@ -2289,7 +2289,7 @@ void RTLightingFeatHLSL::processPix( Vector &componentList, { ambient = new Var("ambient", "float4"); ambient->uniform = true; - ambient->constSortPos = cspPass; + ambient->constSortPos = cspScene; } Var* lighting = new Var("lighting", "float4"); @@ -2349,12 +2349,12 @@ void FogFeatHLSL::processVert( Vector &componentList, { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } Var *fogData = new Var( "fogData", "float3" ); fogData->uniform = true; - fogData->constSortPos = cspPass; + fogData->constSortPos = cspScene; Var *wsPosition = new Var( "fogPos", "float3" ); getWsPosition( componentList, @@ -2393,7 +2393,7 @@ void FogFeatHLSL::processPix( Vector &componentList, fogColor->setType( "float4" ); fogColor->setName( "fogColor" ); fogColor->uniform = true; - fogColor->constSortPos = cspPass; + fogColor->constSortPos = cspScene; // Get the out color. Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget)); @@ -2429,12 +2429,12 @@ void FogFeatHLSL::processPix( Vector &componentList, { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } Var *fogData = new Var( "fogData", "float3" ); fogData->uniform = true; - fogData->constSortPos = cspPass; + fogData->constSortPos = cspScene; /// Get the fog amount. fogAmount = new Var( "fogAmount", "float" ); @@ -2695,7 +2695,7 @@ void FoliageFeatureHLSL::processVert( Vector &componentList, { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } // All actual work is offloaded to this method. @@ -2832,7 +2832,7 @@ void ImposterVertFeatureHLSL::processVert( Vector &component { eyePos = new Var( "eyePosWorld", "float3" ); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } // Declare the outputs from this feature. @@ -3153,7 +3153,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList eyePos->setType("float3"); eyePos->setName("eyePosWorld"); eyePos->uniform = true; - eyePos->constSortPos = cspPass; + eyePos->constSortPos = cspScene; } Var* accumTime = (Var*)LangElement::find("accumTime"); @@ -3161,7 +3161,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList { accumTime = new Var("accumTime", "float"); accumTime->uniform = true; - accumTime->constSortPos = cspPass; + accumTime->constSortPos = cspScene; } Var* dampness = (Var*)LangElement::find("dampness"); @@ -3169,7 +3169,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList { dampness = new Var("dampness", "float"); dampness->uniform = true; - dampness->constSortPos = cspPass; + dampness->constSortPos = cspScene; } String computeForwardProbes = String(" @ = computeForwardProbes(@,@,@,@,@,@,@,@,@,\r\n\t\t"); @@ -3185,7 +3185,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList { ambient = new Var("ambient","float4"); ambient->uniform = true; - ambient->constSortPos = cspPass; + ambient->constSortPos = cspScene; } meta->addStatement(new GenOp(" @.rgb *= @.rgb;\r\n", ibl, ambient)); meta->addStatement(new GenOp(" @.rgb = @.rgb;\r\n", curColor, ibl)); diff --git a/Engine/source/shaderGen/langElement.h b/Engine/source/shaderGen/langElement.h index c6f25b77ab..ec818ac2e0 100644 --- a/Engine/source/shaderGen/langElement.h +++ b/Engine/source/shaderGen/langElement.h @@ -73,10 +73,14 @@ enum ConstantSortPosition cspUninit = 0, /// Updated before every draw primitive call. cspPrimitive, - /// Potentially updated every draw primitive call, but not necessarily (lights for example) + /// Potentially updated every draw primitive call cspPotentialPrimitive, - /// Updated one per pass + /// Unique buffer just for lights. + cspLightBuffer, + /// Updated per pass cspPass, + /// per scene const buffers (should only be set once) + cspScene, /// Count var, do not use csp_Count }; diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml b/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml index 1ccdee6d99..52a441a040 100644 --- a/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml +++ b/Templates/BaseGame/game/core/gui/sounds/buttonClick.asset.taml @@ -1,10 +1,9 @@ + sourceGroup="AudioChannelGui" + originalFilePath="core/gui/sounds/buttonClick.wav"> + SoundFile="@assetFile=@buttonClick.wav"/> diff --git a/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml b/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml index 45200a3731..bc1acc4270 100644 --- a/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml +++ b/Templates/BaseGame/game/core/gui/sounds/buttonHover.asset.taml @@ -1,10 +1,9 @@ + sourceGroup="AudioChannelGui" + originalFilePath="core/gui/sounds/buttonHover.wav"> + SoundFile="@assetFile=@buttonHover.wav"/> diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.tscript b/Templates/BaseGame/game/core/sfx/Core_SFX.tscript index 771048b323..81a6b952b9 100644 --- a/Templates/BaseGame/game/core/sfx/Core_SFX.tscript +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.tscript @@ -3,10 +3,10 @@ function Core_SFX::onCreate(%this) { exec("./scripts/audio." @ $TorqueScriptFileExtension); exec("./scripts/audioData." @ $TorqueScriptFileExtension); + exec("./scripts/audioStates." @ $TorqueScriptFileExtension); + exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension); exec("./scripts/audioAmbience." @ $TorqueScriptFileExtension); exec("./scripts/audioDescriptions." @ $TorqueScriptFileExtension); - exec("./scripts/audioEnvironments." @ $TorqueScriptFileExtension); - exec("./scripts/audioStates." @ $TorqueScriptFileExtension); exec("./scripts/audioOptions." @ $TorqueScriptFileExtension); } diff --git a/Templates/BaseGame/game/core/sfx/scripts/audio.tscript b/Templates/BaseGame/game/core/sfx/scripts/audio.tscript index 2d8726afcd..fdb222bde1 100644 --- a/Templates/BaseGame/game/core/sfx/scripts/audio.tscript +++ b/Templates/BaseGame/game/core/sfx/scripts/audio.tscript @@ -35,6 +35,13 @@ singleton SFXDescription( AudioChannel ) sourceGroup = AudioChannelMaster; }; +singleton SFXDescription( AudioEffectChannel ) +{ + sourceGroup = AudioChannelMaster; + allowReverb = true; +}; + + singleton SFXSource( AudioChannelDefault ) { description = AudioChannel; @@ -45,7 +52,7 @@ singleton SFXSource( AudioChannelGui ) }; singleton SFXSource( AudioChannelEffects ) { - description = AudioChannel; + description = AudioEffectChannel; }; singleton SFXSource( AudioChannelMessages ) { @@ -66,7 +73,7 @@ AudioChannelMusic.play(); AudioChannelMessages.play(); // Stop in-game effects channels. -AudioChannelEffects.stop(); +AudioChannelEffects.play(); //----------------------------------------------------------------------------- // Master SFXDescriptions. diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.tscript b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.tscript index 8c2bf270c2..523194c5f4 100644 --- a/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.tscript +++ b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.tscript @@ -22,23 +22,28 @@ singleton SFXAmbience( AudioAmbienceDefault ) { - environment = AudioEnvOff; + environment = "AudioEnvGeneric"; + dopplerFactor = "1"; }; singleton SFXAmbience( AudioAmbienceOutside ) { - environment = AudioEnvPlain; + environment = "AudioEnvPlain"; states[ 0 ] = AudioLocationOutside; + dopplerFactor = "1"; }; singleton SFXAmbience( AudioAmbienceInside ) { - environment = AudioEnvRoom; + environment = "AudioEnvRoom"; states[ 0 ] = AudioLocationInside; + dopplerFactor = "1"; }; singleton SFXAmbience( AudioAmbienceUnderwater ) { - environment = AudioEnvUnderwater; - states[ 0 ] = AudioLocationUnderwater; + environment = "AudioEnvUnderwater"; + states[0] = AudioLocationUnderwater; + dopplerFactor = "0.5"; + speedOfSound = "1500.0"; }; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.tscript b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.tscript index 671825b6be..e66b863c6e 100644 --- a/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.tscript +++ b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.tscript @@ -24,893 +24,678 @@ // // For customized presets, best derive from one of these presets. -singleton SFXEnvironment( AudioEnvOff ) +singleton SFXEnvironment(AudioEnvOff) { - envSize = "7.5"; - envDiffusion = "1.0"; - room = "-10000"; - roomHF = "-10000"; - roomLF = "0"; - decayTime = "1.0"; - decayHFRatio = "1.0"; - decayLFRatio = "1.0"; - reflections = "-2602"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "200"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "0.0"; - density = "0.0"; - flags = 0x33; -}; - -singleton SFXEnvironment( AudioEnvGeneric ) -{ - envSize = "7.5"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-100"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.83"; - decayLFRatio = "1.0"; - reflections = "-2602"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "200"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.0"; + reverbDiffusion = "0.0"; + reverbGain = "0.0"; + reverbGainHF = "0.0"; + reverbGainLF = "0.0"; + reverbDecayTime = "0.1"; + reverbDecayHFRatio = "1.0"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.0"; + reflectionDelay = "0.0"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.0"; + lateReverbDelay = "0.0"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.075"; + reverbEchoDepth = "0.0"; + reverbModTime = "0.04"; + reverbModDepth = "0.0"; + airAbsorbtionGainHF = "1.0"; + reverbHFRef = "1000"; + reverbLFRef = "20"; + roomRolloffFactor = "0.0"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvRoom ) +singleton SFXEnvironment(AudioEnvGeneric) { - envSize = "1.9"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-454"; - roomLF = "0"; - decayTime = "0.4"; - decayHFRatio = "0.83"; - decayLFRatio = "1.0"; - reflections = "-1646"; - reflectionsDelay = "0.002"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "53"; - reverbDelay = "0.003"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.5"; + reverbDiffusion = "0.5"; + reverbGain = "0.15"; + reverbGainHF = "0.15"; + reverbGainLF = "0.1"; + reverbDecayTime = "1.0"; + reverbDecayHFRatio = "1.0"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.2"; + reflectionDelay = "0.02"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.25"; + lateReverbDelay = "0.03"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.08"; + reverbEchoDepth = "0.05"; + reverbModTime = "0.1"; + reverbModDepth = "0.05"; + airAbsorbtionGainHF = "0.95"; + reverbHFRef = "5000"; + reverbLFRef = "100"; + roomRolloffFactor = "0.2"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvPaddedCell ) +singleton SFXEnvironment(AudioEnvPlain) { - envSize = "1.4"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-6000"; - roomLF = "0"; - decayTime = "0.17"; - decayHFRatio = "0.1"; - decayLFRatio = "1.0"; - reflections = "-1204"; - reflectionsDelay = "0.001"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "207"; - reverbDelay = "0.002"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.05"; + reverbDiffusion = "0.15"; + reverbGain = "0.18"; + reverbGainHF = "0.12"; + reverbGainLF = "0.30"; + reverbDecayTime = "5.0"; + reverbDecayHFRatio = "0.5"; + reverbDecayLFRatio = "1.4"; + reflectionsGain = "0.005"; + reflectionDelay = "0.02"; + reflectionsPan = "0 0 0"; + lateReverbGain = "0.35"; + lateReverbDelay = "0.15"; + lateReverbPan = "0 0 0"; + reverbEchoTime = "0.17"; + reverbEchoDepth = "0.08"; + reverbModTime = "2.8"; + reverbModDepth = "0.25"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "6500"; + reverbLFRef = "90"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvBathroom ) +singleton SFXEnvironment(AudioEnvRoom) { - envSize = "1.4"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-1200"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.54"; - decayLFRatio = "1.0"; - reflections = "-370"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "1030"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "60.0"; - flags = 0x3f; + reverbDensity = "0.8"; + reverbDiffusion = "0.85"; + reverbGain = "0.35"; + reverbGainHF = "0.4"; + reverbGainLF = "0.25"; + reverbDecayTime = "1.8"; + reverbDecayHFRatio = "0.9"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.8"; + reflectionDelay = "0.03"; + reflectionsPan = "0.2 0.0 -0.2"; + lateReverbGain = "0.9"; + lateReverbDelay = "0.05"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.09"; + reverbEchoDepth = "0.15"; + reverbModTime = "0.2"; + reverbModDepth = "0.1"; + airAbsorbtionGainHF = "0.9"; + reverbHFRef = "7000"; + reverbLFRef = "60"; + roomRolloffFactor = "0.5"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvLivingRoom ) +singleton SFXEnvironment(AudioEnvPaddedCell) { - envSize = "2.5"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-6000"; - roomLF = "0"; - decayTime = "0.5"; - decayHFRatio = "0.1"; - decayLFRatio = "1.0"; - reflections = "-1376"; - reflectionsDelay = "0.003"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1104"; - reverbDelay = "0.004"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.7"; + reverbDiffusion = "0.9"; + reverbGain = "0.5"; + reverbGainHF = "0.25"; + reverbGainLF = "0.15"; + reverbDecayTime = "2.0"; + reverbDecayHFRatio = "0.7"; + reverbDecayLFRatio = "0.9"; + reflectionsGain = "1.0"; + reflectionDelay = "0.015"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.2"; + lateReverbDelay = "0.02"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.1"; + reverbEchoDepth = "0.2"; + reverbModTime = "0.15"; + reverbModDepth = "0.1"; + airAbsorbtionGainHF = "0.85"; + reverbHFRef = "5000"; + reverbLFRef = "100"; + roomRolloffFactor = "0.8"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvStoneRoom ) +singleton SFXEnvironment(AudioEnvBathroom) { - envSize = "11.6"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "300"; - roomLF = "0"; - decayTime = "2.31"; - decayHFRatio = "0.64"; - decayLFRatio = "1.0"; - reflections = "-711"; - reflectionsDelay = "0.012"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "83"; - reverbDelay = "0.017"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "-5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.9"; + reverbDiffusion = "0.95"; + reverbGain = "0.45"; + reverbGainHF = "0.8"; + reverbGainLF = "0.25"; + reverbDecayTime = "1.2"; + reverbDecayHFRatio = "1.5"; + reverbDecayLFRatio = "0.9"; + reflectionsGain = "2.5"; + reflectionDelay = "0.025"; + reflectionsPan = "0.5 -0.5 0.0"; + lateReverbGain = "0.9"; + lateReverbDelay = "0.04"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.08"; + reverbEchoDepth = "0.1"; + reverbModTime = "0.15"; + reverbModDepth = "0.05"; + airAbsorbtionGainHF = "0.95"; + reverbHFRef = "12000"; + reverbLFRef = "80"; + roomRolloffFactor = "0.8"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvAuditorium ) -{ - envSize = "21.6"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-476"; - roomLF = "0"; - decayTime = "4.32"; - decayHFRatio = "0.59"; - decayLFRatio = "1.0"; - reflections = "1"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-289"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; -}; -singleton SFXEnvironment( AudioEnvConcertHall ) +singleton SFXEnvironment(AudioEnvLivingRoom) { - envSize = "19.6"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-500"; - roomLF = "0"; - decayTime = "3.92"; - decayHFRatio = "0.7"; - decayLFRatio = "1.0"; - reflections = "-1230"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-2"; - reverbDelay = "0.029"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.45"; + reverbDiffusion = "0.65"; + reverbGain = "0.30"; + reverbGainHF = "0.35"; + reverbGainLF = "0.20"; + reverbDecayTime = "0.7"; + reverbDecayHFRatio = "0.9"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.45"; + reflectionDelay = "0.010"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.45"; + lateReverbDelay = "0.025"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.09"; + reverbEchoDepth = "0.02"; + reverbModTime = "0.20"; + reverbModDepth = "0.02"; + airAbsorbtionGainHF = "0.95"; + reverbHFRef = "5000"; + reverbLFRef = "120"; + roomRolloffFactor = "0.2"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvCave ) +singleton SFXEnvironment(AudioEnvStoneRoom) { - envSize = "14.6"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "0"; - roomLF = "0"; - decayTime = "2.91"; - decayHFRatio = "1.3"; - decayLFRatio = "1.0"; - reflections = "-602"; - reflectionsDelay = "0.015"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-302"; - reverbDelay = "0.022"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x1f; + reverbDensity = "0.70"; + reverbDiffusion = "0.85"; + reverbGain = "0.55"; + reverbGainHF = "0.45"; + reverbGainLF = "0.35"; + reverbDecayTime = "2.2"; + reverbDecayHFRatio = "0.8"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "1.1"; + reflectionDelay = "0.015"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.1"; + lateReverbDelay = "0.035"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.12"; + reverbEchoDepth = "0.05"; + reverbModTime = "0.30"; + reverbModDepth = "0.05"; + airAbsorbtionGainHF = "0.92"; + reverbHFRef = "4500"; + reverbLFRef = "80"; + roomRolloffFactor = "0.1"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvArena ) +singleton SFXEnvironment(AudioEnvAuditorium) { - envSize = "36.2f"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-698"; - roomLF = "0"; - decayTime = "7.24"; - decayHFRatio = "0.33"; - decayLFRatio = "1.0"; - reflections = "-1166"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "16"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.65"; + reverbDiffusion = "0.85"; + reverbGain = "0.40"; + reverbGainHF = "0.42"; + reverbGainLF = "0.30"; + reverbDecayTime = "3.6"; + reverbDecayHFRatio = "0.7"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.20"; + reflectionDelay = "0.025"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.9"; + lateReverbDelay = "0.06"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.14"; + reverbEchoDepth = "0.02"; + reverbModTime = "0.25"; + reverbModDepth = "0.03"; + airAbsorbtionGainHF = "0.93"; + reverbHFRef = "5000"; + reverbLFRef = "100"; + roomRolloffFactor = "0.05"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvHangar ) +singleton SFXEnvironment(AudioEnvConcertHall) { - envSize = "50.3"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-1000"; - roomLF = "0"; - decayTime = "10.05"; - decayHFRatio = "0.23"; - decayLFRatio = "1.0"; - reflections = "-602"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "198"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.66"; + reverbDiffusion = "0.88"; + reverbGain = "0.42"; + reverbGainHF = "0.40"; + reverbGainLF = "0.30"; + reverbDecayTime = "3.8"; + reverbDecayHFRatio = "0.75"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.18"; + reflectionDelay = "0.022"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.95"; + lateReverbDelay = "0.05"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.13"; + reverbEchoDepth = "0.02"; + reverbModTime = "0.22"; + reverbModDepth = "0.03"; + airAbsorbtionGainHF = "0.93"; + reverbHFRef = "4800"; + reverbLFRef = "100"; + roomRolloffFactor = "0.05"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvCarpettedHallway ) +singleton SFXEnvironment(AudioEnvCave) { - envSize = "1.9"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-4000"; - roomLF = "0"; - decayTime = "0.3"; - decayHFRatio = "0.1"; - decayLFRatio = "1.0"; - reflections = "-1831"; - reflectionsDelay = "0.002"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1630"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.55"; + reverbDiffusion = "0.70"; + reverbGain = "0.60"; + reverbGainHF = "0.30"; + reverbGainLF = "0.40"; + reverbDecayTime = "3.0"; + reverbDecayHFRatio = "1.1"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "1.6"; + reflectionDelay = "0.020"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.6"; + lateReverbDelay = "0.04"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.16"; + reverbEchoDepth = "0.06"; + reverbModTime = "0.30"; + reverbModDepth = "0.06"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4500"; + reverbLFRef = "70"; + roomRolloffFactor = "0.1"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvHallway ) +singleton SFXEnvironment(AudioEnvArena) { - envSize = "1.8"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-300"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.59"; - decayLFRatio = "1.0"; - reflections = "-1219"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "441"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.60"; + reverbDiffusion = "0.85"; + reverbGain = "0.48"; + reverbGainHF = "0.38"; + reverbGainLF = "0.32"; + reverbDecayTime = "5.5"; + reverbDecayHFRatio = "0.6"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.6"; + reflectionDelay = "0.025"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.2"; + lateReverbDelay = "0.06"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.18"; + reverbEchoDepth = "0.04"; + reverbModTime = "0.30"; + reverbModDepth = "0.04"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4500"; + reverbLFRef = "90"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvStoneCorridor ) +singleton SFXEnvironment(AudioEnvHangar) { - envSize = "13.5"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-237"; - roomLF = "0"; - decayTime = "2.7"; - decayHFRatio = "0.79"; - decayLFRatio = "1.0"; - reflections = "-1214"; - reflectionsDelay = "0.013"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "395"; - reverbDelay = "0.02"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.50"; + reverbDiffusion = "0.60"; + reverbGain = "0.55"; + reverbGainHF = "0.30"; + reverbGainLF = "0.45"; + reverbDecayTime = "7.5"; + reverbDecayHFRatio = "0.5"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.8"; + reflectionDelay = "0.03"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.6"; + lateReverbDelay = "0.07"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.18"; + reverbEchoDepth = "0.03"; + reverbModTime = "0.35"; + reverbModDepth = "0.04"; + airAbsorbtionGainHF = "0.88"; + reverbHFRef = "4000"; + reverbLFRef = "80"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvAlley ) +singleton SFXEnvironment(AudioEnvCarpettedHallway) { - envSize = "7.5"; - envDiffusion = "0.3"; - room = "-1000"; - roomHF = "-270"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.86"; - decayLFRatio = "1.0"; - reflections = "-1204"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-4"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.125"; - echoDepth = "0.95"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.35"; + reverbDiffusion = "0.50"; + reverbGain = "0.18"; + reverbGainHF = "0.08"; + reverbGainLF = "0.18"; + reverbDecayTime = "0.35"; + reverbDecayHFRatio = "0.5"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.25"; + reflectionDelay = "0.004"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.22"; + lateReverbDelay = "0.02"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.09"; + reverbEchoDepth = "0.01"; + reverbModTime = "0.18"; + reverbModDepth = "0.02"; + airAbsorbtionGainHF = "0.88"; + reverbHFRef = "5000"; + reverbLFRef = "120"; + roomRolloffFactor = "0.25"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvForest ) +singleton SFXEnvironment(AudioEnvHallway) { - envSize = "38.0"; - envDiffusion = "0.3"; - room = "-1000"; - roomHF = "-3300"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.54"; - decayLFRatio = "1.0"; - reflections = "-2560"; - reflectionsDelay = "0.162"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-229"; - reverbDelay = "0.088"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.125"; - echoDepth = "1.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "79.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.45"; + reverbDiffusion = "0.60"; + reverbGain = "0.30"; + reverbGainHF = "0.28"; + reverbGainLF = "0.22"; + reverbDecayTime = "1.2"; + reverbDecayHFRatio = "0.7"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.9"; + reflectionDelay = "0.007"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.8"; + lateReverbDelay = "0.03"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.10"; + reverbEchoDepth = "0.02"; + reverbModTime = "0.20"; + reverbModDepth = "0.03"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4500"; + reverbLFRef = "80"; + roomRolloffFactor = "0.12"; + decayHFLimit = "1"; }; -singleton SFXEnvironment( AudioEnvCity ) +singleton SFXEnvironment(AudioEnvStoneCorridor) { - envSize = "7.5"; - envDiffusion = "0.5"; - room = "-1000"; - roomHF = "-800"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.67"; - decayLFRatio = "1.0"; - reflections = "-2273"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1691"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "50.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.60"; + reverbDiffusion = "0.75"; + reverbGain = "0.50"; + reverbGainHF = "0.30"; + reverbGainLF = "0.32"; + reverbDecayTime = "2.6"; + reverbDecayHFRatio = "0.8"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "1.0"; + reflectionDelay = "0.013"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.0"; + lateReverbDelay = "0.04"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.14"; + reverbEchoDepth = "0.04"; + reverbModTime = "0.25"; + reverbModDepth = "0.05"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4200"; + reverbLFRef = "80"; + roomRolloffFactor = "0.1"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvMountains ) +singleton SFXEnvironment(AudioEnvAlley) { - envSize = "100.0"; - envDiffusion = "0.27"; - room = "-1000"; - roomHF = "-2500"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.21"; - decayLFRatio = "1.0"; - reflections = "-2780"; - reflectionsDelay = "0.3"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1434"; - reverbDelay = "0.1"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "1.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "27.0"; - density = "100.0"; - flags = 0x1f; + reverbDensity = "0.22"; + reverbDiffusion = "0.30"; + reverbGain = "0.15"; + reverbGainHF = "0.12"; + reverbGainLF = "0.22"; + reverbDecayTime = "1.1"; + reverbDecayHFRatio = "0.6"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.3"; + reflectionDelay = "0.007"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.25"; + lateReverbDelay = "0.02"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.12"; + reverbEchoDepth = "0.18"; + reverbModTime = "0.25"; + reverbModDepth = "0.02"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "5000"; + reverbLFRef = "100"; + roomRolloffFactor = "0.08"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvQuary ) +singleton SFXEnvironment(AudioEnvForest) { - envSize = "17.5"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-1000"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.83"; - decayLFRatio = "1.0"; - reflections = "-10000"; - reflectionsDelay = "0.061"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "500"; - reverbDelay = "0.025"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.125"; - echoDepth = "0.7"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.10"; + reverbDiffusion = "0.20"; + reverbGain = "0.10"; + reverbGainHF = "0.08"; + reverbGainLF = "0.18"; + reverbDecayTime = "1.1"; + reverbDecayHFRatio = "0.5"; + reverbDecayLFRatio = "1.2"; + reflectionsGain = "0.02"; + reflectionDelay = "0.12"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.20"; + lateReverbDelay = "0.10"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.14"; + reverbEchoDepth = "0.60"; + reverbModTime = "0.40"; + reverbModDepth = "0.06"; + airAbsorbtionGainHF = "0.88"; + reverbHFRef = "4000"; + reverbLFRef = "90"; + roomRolloffFactor = "0.02"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvPlain ) +singleton SFXEnvironment(AudioEnvCity) { - envSize = "42.5"; - envDiffusion = "0.21"; - room = "-1000"; - roomHF = "-2000"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.5"; - decayLFRatio = "1.0"; - reflections = "-2466"; - reflectionsDelay = "0.179"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1926"; - reverbDelay = "0.1"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "1.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "21.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.18"; + reverbDiffusion = "0.35"; + reverbGain = "0.18"; + reverbGainHF = "0.16"; + reverbGainLF = "0.22"; + reverbDecayTime = "1.4"; + reverbDecayHFRatio = "0.6"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.25"; + reflectionDelay = "0.010"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.22"; + lateReverbDelay = "0.06"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.16"; + reverbEchoDepth = "0.12"; + reverbModTime = "0.30"; + reverbModDepth = "0.04"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "5000"; + reverbLFRef = "100"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvParkingLot ) +singleton SFXEnvironment(AudioEnvMountains) { - envSize = "8.3"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "0"; - roomLF = "0"; - decayTime = "1.65"; - decayHFRatio = "1.5"; - decayLFRatio = "1.0"; - reflections = "-1363"; - reflectionsDelay = "0.008"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-1153"; - reverbDelay = "0.012"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x1f; + reverbDensity = "0.06"; + reverbDiffusion = "0.18"; + reverbGain = "0.12"; + reverbGainHF = "0.10"; + reverbGainLF = "0.20"; + reverbDecayTime = "3.2"; + reverbDecayHFRatio = "0.45"; + reverbDecayLFRatio = "1.3"; + reflectionsGain = "0.01"; + reflectionDelay = "0.30"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.25"; + lateReverbDelay = "0.10"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.20"; + reverbEchoDepth = "0.40"; + reverbModTime = "1.2"; + reverbModDepth = "0.10"; + airAbsorbtionGainHF = "0.88"; + reverbHFRef = "4500"; + reverbLFRef = "80"; + roomRolloffFactor = "0.02"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvSewerPipe ) +singleton SFXEnvironment(AudioEnvQuary) { - envSize = "1.7"; - envDiffusion = "0.8"; - room = "-1000"; - roomHF = "-1000"; - roomLF = "0"; - decayTime = "2.81"; - decayHFRatio = "0.14"; - decayLFRatio = "1.0"; - reflections = "429"; - reflectionsDelay = "0.014"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "1023"; - reverbDelay = "0.21"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "0.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "80.0"; - density = "60.0"; - flags = 0x3f; + reverbDensity = "0.25"; + reverbDiffusion = "0.45"; + reverbGain = "0.28"; + reverbGainHF = "0.20"; + reverbGainLF = "0.30"; + reverbDecayTime = "2.1"; + reverbDecayHFRatio = "0.7"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.9"; + reflectionDelay = "0.060"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.9"; + lateReverbDelay = "0.04"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.14"; + reverbEchoDepth = "0.45"; + reverbModTime = "0.30"; + reverbModDepth = "0.06"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4200"; + reverbLFRef = "80"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvUnderwater ) +singleton SFXEnvironment(AudioEnvParkingLot) { - envSize = "1.8"; - envDiffusion = "1.0"; - room = "-1000"; - roomHF = "-4000"; - roomLF = "0"; - decayTime = "1.49"; - decayHFRatio = "0.1"; - decayLFRatio = "1.0"; - reflections = "-449"; - reflectionsDelay = "0.007"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "1700"; - reverbDelay = "0.011"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "1.18"; - modulationDepth = "0.348"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x3f; + reverbDensity = "0.20"; + reverbDiffusion = "0.40"; + reverbGain = "0.16"; + reverbGainHF = "0.12"; + reverbGainLF = "0.22"; + reverbDecayTime = "1.3"; + reverbDecayHFRatio = "1.1"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.20"; + reflectionDelay = "0.010"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.22"; + lateReverbDelay = "0.03"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.12"; + reverbEchoDepth = "0.05"; + reverbModTime = "0.25"; + reverbModDepth = "0.04"; + airAbsorbtionGainHF = "0.90"; + reverbHFRef = "4800"; + reverbLFRef = "100"; + roomRolloffFactor = "0.04"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvDrugged ) +singleton SFXEnvironment(AudioEnvSewerPipe) { - envSize = "1.9"; - envDiffusion = "0.5"; - room = "-1000"; - roomHF = "0"; - roomLF = "0"; - decayTime = "8.39"; - decayHFRatio = "1.39"; - decayLFRatio = "1.0"; - reflections = "-115"; - reflectionsDelay = "0.002"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "985"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "0.25"; - modulationDepth = "1.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x1f; + reverbDensity = "0.42"; + reverbDiffusion = "0.60"; + reverbGain = "0.65"; + reverbGainHF = "0.18"; + reverbGainLF = "0.40"; + reverbDecayTime = "2.6"; + reverbDecayHFRatio = "0.35"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "1.8"; + reflectionDelay = "0.014"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.8"; + lateReverbDelay = "0.09"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.14"; + reverbEchoDepth = "0.02"; + reverbModTime = "0.20"; + reverbModDepth = "0.03"; + airAbsorbtionGainHF = "0.86"; + reverbHFRef = "3500"; + reverbLFRef = "60"; + roomRolloffFactor = "0.08"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvDizzy ) +singleton SFXEnvironment(AudioEnvUnderwater) { - envSize = "1.8"; - envDiffusion = "0.6"; - room = "-1000.0"; - roomHF = "-400"; - roomLF = "0"; - decayTime = "17.23"; - decayHFRatio = "0.56"; - decayLFRatio = "1.0"; - reflections = "-1713"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "-613"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "1.0"; - modulationTime = "0.81"; - modulationDepth = "0.31"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x1f; + reverbDensity = "0.85"; + reverbDiffusion = "0.95"; + reverbGain = "0.70"; + reverbGainHF = "0.20"; + reverbGainLF = "0.60"; + reverbDecayTime = "2.0"; + reverbDecayHFRatio = "0.3"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.6"; + reflectionDelay = "0.012"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "0.9"; + lateReverbDelay = "0.06"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.10"; + reverbEchoDepth = "0.12"; + reverbModTime = "1.2"; + reverbModDepth = "0.25"; + airAbsorbtionGainHF = "0.80"; + reverbHFRef = "1200"; + reverbLFRef = "50"; + roomRolloffFactor = "0.0"; + decayHFLimit = "0"; }; -singleton SFXEnvironment( AudioEnvPsychotic ) +singleton SFXEnvironment(AudioEnvDrugged) { - envSize = "1.0"; - envDiffusion = "0.5"; - room = "-1000"; - roomHF = "-151"; - roomLF = "0"; - decayTime = "7.56"; - decayHFRatio = "0.91"; - decayLFRatio = "1.0"; - reflections = "-626"; - reflectionsDelay = "0.02"; - reflectionsPan[ 0 ] = "0.0"; - reflectionsPan[ 1 ] = "0.0"; - reflectionsPan[ 2 ] = "0.0"; - reverb = "774"; - reverbDelay = "0.03"; - reverbPan[ 0 ] = "0.0"; - reverbPan[ 1 ] = "0.0"; - reverbPan[ 2 ] = "0.0"; - echoTime = "0.25"; - echoDepth = "0.0"; - modulationTime = "4.0"; - modulationDepth = "1.0"; - airAbsorptionHF = "-5.0"; - HFReference = "5000.0"; - LFReference = "250.0"; - roomRolloffFactor = "0.0"; - diffusion = "100.0"; - density = "100.0"; - flags = 0x1f; -}; + reverbDensity = "0.40"; + reverbDiffusion = "0.55"; + reverbGain = "0.50"; + reverbGainHF = "0.30"; + reverbGainLF = "0.35"; + reverbDecayTime = "4.0"; + reverbDecayHFRatio = "1.1"; + reverbDecayLFRatio = "1.0"; + reflectionsGain = "0.8"; + reflectionDelay = "0.010"; + reflectionsPan = "0.0 0.0 0.0"; + lateReverbGain = "1.1"; + lateReverbDelay = "0.04"; + lateReverbPan = "0.0 0.0 0.0"; + reverbEchoTime = "0.20"; + reverbEchoDepth = "0.20"; + reverbModTime = "0.75"; + reverbModDepth = "0.40"; + airAbsorbtionGainHF = "0.88"; + reverbHFRef = "4200"; + reverbLFRef = "90"; + roomRolloffFactor = "0.05"; + decayHFLimit = "0"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript index f1c1560193..bdae5c6aa3 100644 --- a/Templates/BaseGame/game/data/UI/scripts/profiles.tscript +++ b/Templates/BaseGame/game/data/UI/scripts/profiles.tscript @@ -170,8 +170,8 @@ singleton GuiControlProfile( GuiMenuButtonProfile ) justify = "center"; canKeyFocus = false; hasBitmapArray = false; - soundButtonDown = "UI:buttonClick"; - soundButtonOver = "UI:buttonHover"; + soundButtonDownAsset = "UI:buttonClick"; + soundButtonOverAsset = "UI:buttonHover"; category = "BaseUI"; fontColors[0] = "200 200 200 255"; fontColors[2] = "108 108 108 255"; diff --git a/Templates/BaseGame/game/data/UI/sounds/buttonClick.asset.taml b/Templates/BaseGame/game/data/UI/sounds/buttonClick.asset.taml index 8616da297e..4da69070db 100644 --- a/Templates/BaseGame/game/data/UI/sounds/buttonClick.asset.taml +++ b/Templates/BaseGame/game/data/UI/sounds/buttonClick.asset.taml @@ -1,10 +1,8 @@ - \ No newline at end of file + + + + + diff --git a/Templates/BaseGame/game/data/UI/sounds/buttonHover.asset.taml b/Templates/BaseGame/game/data/UI/sounds/buttonHover.asset.taml index 4d0eb338ec..173554d97b 100644 --- a/Templates/BaseGame/game/data/UI/sounds/buttonHover.asset.taml +++ b/Templates/BaseGame/game/data/UI/sounds/buttonHover.asset.taml @@ -1,10 +1,9 @@ - \ No newline at end of file + + + + + diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript index 5a90c3d6b9..85851106cc 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript @@ -13,6 +13,54 @@ function SoundAsset::onChanged(%this) sfxStop($PreviewSoundSource); } +function SoundAsset::onShowActionMenu(%this) +{ + GenericAsset::onShowActionMenu(%this); + + %assetId = %this.getAssetId(); + + EditAssetPopup.objectData = %assetId; + EditAssetPopup.objectType = AssetDatabase.getAssetType(%assetId); + + EditAssetPopup.reloadItems(); + + EditAssetPopup.showPopup(Canvas); +} + + +function SoundAsset::onEditProperties(%this) +{ + Canvas.pushDialog(AssetBrowser_editAsset); + + AssetBrowser_editAssetWindow.text = "Asset Properties - " @ %this.getAssetId(); + + AssetEditInspector.tempAsset = %this.deepClone(); + + AssetEditInspector.inspect(%this); + AssetBrowser_editAsset.editedObjectData = %this.getAssetId(); + AssetBrowser_editAsset.editedObject = %this; + AssetBrowser_editAsset.editedObjectType = AssetDatabase.getAssetType(%this.getAssetId()); + + //remove some of the groups we don't need: + for(%i=0; %i < AssetEditInspector.getCount(); %i++) + { + %caption = AssetEditInspector.getObject(%i).caption; + + if(%caption $= "Ungrouped" || %caption $= "Object" || %caption $= "Editing" + || %caption $= "Persistence" || %caption $= "Dynamic Fields") + { + AssetEditInspector.remove(AssetEditInspector.getObject(%i)); + %i--; + } + } +} + +//Called when the AssetType has it's properties saved from the onEditProperties process +function SoundAsset::onSaveProperties(%this) +{ + %this.refreshAsset(); +} + function SoundAsset::buildBrowserElement(%this, %previewData) { %previewData.assetName = %this.assetName;