123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- #include "Wwise/WwiseFileHandlerModuleImpl.h"
- #include "Wwise/WwiseSoundBankManagerImpl.h"
- #include "Wwise/WwiseExternalSourceManagerImpl.h"
- #include "Wwise/WwiseFileCache.h"
- #include "Wwise/WwiseMediaManagerImpl.h"
- #include "Wwise/WwiseIOHookImpl.h"
- #include "Wwise/Stats/FileHandler.h"
- IMPLEMENT_MODULE(FWwiseFileHandlerModule, WwiseFileHandler)
- FWwiseFileHandlerModule::FWwiseFileHandlerModule()
- {
- }
- IWwiseSoundBankManager* FWwiseFileHandlerModule::GetSoundBankManager()
- {
- Lock.ReadLock();
- if (LIKELY(SoundBankManager))
- {
- Lock.ReadUnlock();
- }
- else
- {
- Lock.ReadUnlock();
- Lock.WriteLock();
- if (LIKELY(!SoundBankManager))
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Initializing default SoundBank Manager."));
- SoundBankManager.Reset(InstantiateSoundBankManager());
- }
- Lock.WriteUnlock();
- }
- return SoundBankManager.Get();
- }
- IWwiseExternalSourceManager* FWwiseFileHandlerModule::GetExternalSourceManager()
- {
- Lock.ReadLock();
- if (LIKELY(ExternalSourceManager))
- {
- Lock.ReadUnlock();
- }
- else
- {
- Lock.ReadUnlock();
- Lock.WriteLock();
- if (LIKELY(!ExternalSourceManager))
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Initializing default External Source Manager."));
- ExternalSourceManager.Reset(InstantiateExternalSourceManager());
- }
- Lock.WriteUnlock();
- }
- return ExternalSourceManager.Get();
- }
- IWwiseMediaManager* FWwiseFileHandlerModule::GetMediaManager()
- {
- Lock.ReadLock();
- if (LIKELY(MediaManager))
- {
- Lock.ReadUnlock();
- }
- else
- {
- Lock.ReadUnlock();
- Lock.WriteLock();
- if (LIKELY(!MediaManager))
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Initializing default Media Manager."));
- MediaManager.Reset(InstantiateMediaManager());
- }
- Lock.WriteUnlock();
- }
- return MediaManager.Get();
- }
- FWwiseFileCache* FWwiseFileHandlerModule::GetFileCache()
- {
- Lock.ReadLock();
- if (LIKELY(FileCache))
- {
- Lock.ReadUnlock();
- }
- else
- {
- Lock.ReadUnlock();
- Lock.WriteLock();
- if (LIKELY(!FileCache))
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Initializing default File Cache."));
- FileCache.Reset(InstantiateFileCache());
- }
- Lock.WriteUnlock();
- }
- return FileCache.Get();
- }
- FWwiseIOHook* FWwiseFileHandlerModule::InstantiateIOHook()
- {
- return new FWwiseIOHookImpl;
- }
- IWwiseSoundBankManager* FWwiseFileHandlerModule::InstantiateSoundBankManager()
- {
- return new FWwiseSoundBankManagerImpl;
- }
- IWwiseExternalSourceManager* FWwiseFileHandlerModule::InstantiateExternalSourceManager()
- {
- return new FWwiseExternalSourceManagerImpl;
- }
- IWwiseMediaManager* FWwiseFileHandlerModule::InstantiateMediaManager()
- {
- return new FWwiseMediaManagerImpl;
- }
- FWwiseFileCache* FWwiseFileHandlerModule::InstantiateFileCache()
- {
- return new FWwiseFileCache;
- }
- void FWwiseFileHandlerModule::StartupModule()
- {
- IWwiseFileHandlerModule::StartupModule();
- }
- void FWwiseFileHandlerModule::ShutdownModule()
- {
- Lock.WriteLock();
- if (SoundBankManager.IsValid())
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Shutting down SoundBank Manager."));
- SoundBankManager.Reset();
- }
- if (ExternalSourceManager.IsValid())
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Shutting down External Source Manager."));
- ExternalSourceManager.Reset();
- }
- if (MediaManager.IsValid())
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Shutting down Media Manager."));
- MediaManager.Reset();
- }
- if (FileCache.IsValid())
- {
- UE_LOG(LogWwiseFileHandler, Display, TEXT("Shutting down File Cache."));
- FileCache.Reset();
- }
- Lock.WriteUnlock();
- IWwiseFileHandlerModule::ShutdownModule();
- }
|