Removing dependencies on legacy code (#2358)
* Removes use of gEnv->mMainThreadId Save off the thread id that was used when initializing audio system and connecting EBuses, use that instead of gEnv. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com> * Replace uses of gEnv->pCryPak with AZ::IO Updated uses of pCryPak to instead go through the AZ::IO::FileIOBase instance. Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
This commit is contained in:
@@ -7,18 +7,16 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
#include <FileIOHandler_wwise.h>
|
||||
|
||||
#include <AzCore/Casting/numeric_cast.h>
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/IStreamer.h>
|
||||
|
||||
#include <IAudioInterfacesCommonData.h>
|
||||
#include <AkPlatformFuncs_Platform.h>
|
||||
#include <AudioEngineWwise_Traits_Platform.h>
|
||||
|
||||
#include <platform.h>
|
||||
#include <ISystem.h>
|
||||
#include <AzFramework/Archive/IArchive.h>
|
||||
#include <cinttypes>
|
||||
|
||||
#define MAX_NUMBER_STRING_SIZE (10) // 4G
|
||||
#define ID_TO_STRING_FORMAT_BANK AKTEXT("%u.bnk")
|
||||
@@ -90,34 +88,36 @@ namespace Audio
|
||||
|
||||
bool CBlockingDevice_wwise::Open(const char* filename, AkOpenMode openMode, AkFileDesc& fileDesc)
|
||||
{
|
||||
const char* openModeString = nullptr;
|
||||
AZ::IO::OpenMode azOpenMode = AZ::IO::OpenMode::ModeBinary;
|
||||
switch (openMode)
|
||||
{
|
||||
case AK_OpenModeRead:
|
||||
openModeString = "rbx";
|
||||
azOpenMode |= AZ::IO::OpenMode::ModeRead;
|
||||
break;
|
||||
case AK_OpenModeWrite:
|
||||
openModeString = "wbx";
|
||||
azOpenMode |= AZ::IO::OpenMode::ModeWrite;
|
||||
break;
|
||||
case AK_OpenModeWriteOvrwr:
|
||||
openModeString = "w+bx";
|
||||
azOpenMode |= (AZ::IO::OpenMode::ModeUpdate | AZ::IO::OpenMode::ModeWrite);
|
||||
break;
|
||||
case AK_OpenModeReadWrite:
|
||||
openModeString = "abx";
|
||||
azOpenMode |= (AZ::IO::OpenMode::ModeRead | AZ::IO::OpenMode::ModeWrite);
|
||||
break;
|
||||
default:
|
||||
AZ_Assert(false, "Unknown Wwise file open mode.");
|
||||
return false;
|
||||
}
|
||||
|
||||
const size_t fileSize = gEnv->pCryPak->FGetSize(filename);
|
||||
if (fileSize > 0)
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
if (AZ::u64 fileSize = 0;
|
||||
fileIO->Size(filename, fileSize) && fileSize != 0)
|
||||
{
|
||||
AZ::IO::HandleType fileHandle = gEnv->pCryPak->FOpen(filename, openModeString, AZ::IO::IArchive::FOPEN_HINT_DIRECT_OPERATION);
|
||||
AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle;
|
||||
fileIO->Open(filename, azOpenMode, fileHandle);
|
||||
if (fileHandle != AZ::IO::InvalidHandle)
|
||||
{
|
||||
fileDesc.hFile = GetAkFileHandle(fileHandle);
|
||||
fileDesc.iFileSize = static_cast<AkInt64>(fileSize);
|
||||
fileDesc.iFileSize = aznumeric_cast<AkInt64>(fileSize);
|
||||
fileDesc.uSector = 0;
|
||||
fileDesc.deviceID = m_deviceID;
|
||||
fileDesc.pCustomParam = nullptr;
|
||||
@@ -132,50 +132,58 @@ namespace Audio
|
||||
|
||||
AKRESULT CBlockingDevice_wwise::Read(AkFileDesc& fileDesc, const AkIoHeuristics&, void* buffer, AkIOTransferInfo& transferInfo)
|
||||
{
|
||||
AZ_Assert(buffer, "Wwise didn't provide a valid buffer to write to.");
|
||||
AZ_Assert(buffer, "Wwise didn't provide a valid desination buffer to Read into.");
|
||||
|
||||
AZ::IO::HandleType fileHandle = GetRealFileHandle(fileDesc.hFile);
|
||||
const uint64_t currentFileReadPos = gEnv->pCryPak->FTell(fileHandle);
|
||||
const uint64_t wantedFileReadPos = static_cast<uint64_t>(transferInfo.uFilePosition);
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
|
||||
if (currentFileReadPos != wantedFileReadPos)
|
||||
AZ::u64 currentFileReadPos = 0;
|
||||
fileIO->Tell(fileHandle, currentFileReadPos);
|
||||
|
||||
if (currentFileReadPos != transferInfo.uFilePosition)
|
||||
{
|
||||
gEnv->pCryPak->FSeek(fileHandle, wantedFileReadPos, SEEK_SET);
|
||||
fileIO->Seek(fileHandle, aznumeric_cast<AZ::s64>(transferInfo.uFilePosition), AZ::IO::SeekType::SeekFromStart);
|
||||
}
|
||||
|
||||
const size_t bytesRead = gEnv->pCryPak->FReadRaw(buffer, 1, transferInfo.uRequestedSize, fileHandle);
|
||||
AZ_Assert(bytesRead == static_cast<size_t>(transferInfo.uRequestedSize),
|
||||
"Number of bytes read (%zu) for Wwise request doesn't match the requested size (%u).", bytesRead, transferInfo.uRequestedSize);
|
||||
return (bytesRead > 0) ? AK_Success : AK_Fail;
|
||||
AZ::u64 bytesRead = 0;
|
||||
fileIO->Read(fileHandle, buffer, aznumeric_cast<AZ::u64>(transferInfo.uRequestedSize), &bytesRead);
|
||||
const bool readOk = (bytesRead == aznumeric_cast<AZ::u64>(transferInfo.uRequestedSize));
|
||||
|
||||
AZ_Assert(readOk,
|
||||
"Number of bytes read (%" PRIu64 ") for read request doesn't match the requested size (%u).",
|
||||
bytesRead, transferInfo.uRequestedSize);
|
||||
return readOk ? AK_Success : AK_Fail;
|
||||
}
|
||||
|
||||
AKRESULT CBlockingDevice_wwise::Write(AkFileDesc& fileDesc, const AkIoHeuristics&, void* data, AkIOTransferInfo& transferInfo)
|
||||
{
|
||||
AZ_Assert(data, "Wwise didn't provide a valid buffer to read from.");
|
||||
AZ_Assert(data, "Wwise didn't provide a valid source buffer to Write from.");
|
||||
|
||||
AZ::IO::HandleType fileHandle = GetRealFileHandle(fileDesc.hFile);
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
|
||||
const uint64_t currentFileWritePos = gEnv->pCryPak->FTell(fileHandle);
|
||||
const uint64_t wantedFileWritePos = static_cast<uint64_t>(transferInfo.uFilePosition);
|
||||
AZ::u64 currentFileWritePos = 0;
|
||||
fileIO->Tell(fileHandle, currentFileWritePos);
|
||||
|
||||
if (currentFileWritePos != wantedFileWritePos)
|
||||
if (currentFileWritePos != transferInfo.uFilePosition)
|
||||
{
|
||||
gEnv->pCryPak->FSeek(fileHandle, wantedFileWritePos, SEEK_SET);
|
||||
fileIO->Seek(fileHandle, aznumeric_cast<AZ::s64>(transferInfo.uFilePosition), AZ::IO::SeekType::SeekFromStart);
|
||||
}
|
||||
|
||||
const size_t bytesWritten = gEnv->pCryPak->FWrite(data, 1, static_cast<size_t>(transferInfo.uRequestedSize), fileHandle);
|
||||
if (bytesWritten != static_cast<size_t>(transferInfo.uRequestedSize))
|
||||
{
|
||||
AZ_Error("Wwise", false, "Number of bytes written (%zu) for Wwise request doesn't match the requested size (%u).",
|
||||
AZ::u64 bytesWritten = 0;
|
||||
fileIO->Write(fileHandle, data, aznumeric_cast<AZ::u64>(transferInfo.uRequestedSize), &bytesWritten);
|
||||
const bool writeOk = (bytesWritten == aznumeric_cast<AZ::u64>(transferInfo.uRequestedSize));
|
||||
|
||||
AZ_Error("Wwise", writeOk,
|
||||
"Number of bytes written (%" PRIu64 ") for write request doesn't match the requested size (%u).",
|
||||
bytesWritten, transferInfo.uRequestedSize);
|
||||
return AK_Fail;
|
||||
}
|
||||
return AK_Success;
|
||||
return writeOk ? AK_Success : AK_Fail;
|
||||
}
|
||||
|
||||
AKRESULT CBlockingDevice_wwise::Close(AkFileDesc& fileDesc)
|
||||
{
|
||||
return gEnv->pCryPak->FClose(GetRealFileHandle(fileDesc.hFile)) ? AK_Success : AK_Fail;
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
return fileIO->Close(GetRealFileHandle(fileDesc.hFile)) ? AK_Success : AK_Fail;
|
||||
}
|
||||
|
||||
AkUInt32 CBlockingDevice_wwise::GetBlockSize([[maybe_unused]] AkFileDesc& fileDesc)
|
||||
@@ -189,7 +197,7 @@ namespace Audio
|
||||
deviceDesc.bCanRead = true;
|
||||
deviceDesc.bCanWrite = true;
|
||||
deviceDesc.deviceID = m_deviceID;
|
||||
AK_CHAR_TO_UTF16(deviceDesc.szDeviceName, "CryPak", AZ_ARRAY_SIZE(deviceDesc.szDeviceName));
|
||||
AK_CHAR_TO_UTF16(deviceDesc.szDeviceName, "IO::IArchive", AZ_ARRAY_SIZE(deviceDesc.szDeviceName));
|
||||
deviceDesc.uStringSize = AKPLATFORM::AkUtf16StrLen(deviceDesc.szDeviceName);
|
||||
}
|
||||
|
||||
@@ -231,12 +239,13 @@ namespace Audio
|
||||
bool CStreamingDevice_wwise::Open(const char* filename, [[maybe_unused]] AkOpenMode openMode, AkFileDesc& fileDesc)
|
||||
{
|
||||
AZ_Assert(openMode == AK_OpenModeRead, "Wwise Async File IO - Only supports opening files for reading.\n");
|
||||
const size_t fileSize = gEnv->pCryPak->FGetSize(filename);
|
||||
if (fileSize)
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
if (AZ::u64 fileSize = 0;
|
||||
fileIO->Size(filename, fileSize) && fileSize != 0)
|
||||
{
|
||||
AZStd::string* filenameStore = azcreate(AZStd::string, (filename));
|
||||
fileDesc.hFile = AkFileHandle();
|
||||
fileDesc.iFileSize = static_cast<AkInt64>(fileSize);
|
||||
fileDesc.iFileSize = aznumeric_cast<AkInt64>(fileSize);
|
||||
fileDesc.uSector = 0;
|
||||
fileDesc.deviceID = m_deviceID;
|
||||
fileDesc.pCustomParam = filenameStore;
|
||||
@@ -326,7 +335,7 @@ namespace Audio
|
||||
deviceDesc.bCanRead = true;
|
||||
deviceDesc.bCanWrite = false;
|
||||
deviceDesc.deviceID = m_deviceID;
|
||||
AK_CHAR_TO_UTF16(deviceDesc.szDeviceName, "Streamer", AZ_ARRAY_SIZE(deviceDesc.szDeviceName));
|
||||
AK_CHAR_TO_UTF16(deviceDesc.szDeviceName, "IO::IStreamer", AZ_ARRAY_SIZE(deviceDesc.szDeviceName));
|
||||
deviceDesc.uStringSize = AKPLATFORM::AkUtf16StrLen(deviceDesc.szDeviceName);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@ namespace Audio
|
||||
extern CAudioLogger g_audioLogger;
|
||||
static constexpr const char AudioControlsBasePath[]{ "libs/gameaudio/" };
|
||||
|
||||
// Save off the threadId of the "Main Thread" that was used to connect EBuses.
|
||||
AZStd::thread_id g_mainThreadId;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// CAudioThread
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -77,6 +80,8 @@ namespace Audio
|
||||
CAudioSystem::CAudioSystem()
|
||||
: m_bSystemInitialized(false)
|
||||
{
|
||||
g_mainThreadId = AZStd::this_thread::get_id();
|
||||
|
||||
m_apAudioProxies.reserve(Audio::CVars::s_AudioObjectPoolSize);
|
||||
m_apAudioProxiesToBeFreed.reserve(16);
|
||||
m_controlsPath.assign(Audio::AudioControlsBasePath);
|
||||
@@ -99,7 +104,7 @@ namespace Audio
|
||||
{
|
||||
CAudioRequestInternal request(audioRequestData);
|
||||
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::PushRequest - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::PushRequest - called from non-Main thread!");
|
||||
AZ_Assert(0 == (request.nFlags & eARF_THREAD_SAFE_PUSH), "AudioSystem::PushRequest - called with flag THREAD_SAFE_PUSH!");
|
||||
AZ_Assert(0 == (request.nFlags & eARF_EXECUTE_BLOCKING), "AudioSystem::PushRequest - called with flag EXECUTE_BLOCKING!");
|
||||
|
||||
@@ -114,7 +119,7 @@ namespace Audio
|
||||
|
||||
CAudioRequestInternal request(audioRequestData);
|
||||
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::PushRequestBlocking - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::PushRequestBlocking - called from non-Main thread!");
|
||||
AZ_Assert(0 != (request.nFlags & eARF_EXECUTE_BLOCKING), "AudioSystem::PushRequestBlocking - called without EXECUTE_BLOCKING flag!");
|
||||
AZ_Assert(0 == (request.nFlags & eARF_THREAD_SAFE_PUSH), "AudioSystem::PushRequestBlocking - called with THREAD_SAFE_PUSH flag!");
|
||||
|
||||
@@ -139,7 +144,7 @@ namespace Audio
|
||||
const EAudioRequestType requestType,
|
||||
const TATLEnumFlagsType specificRequestMask)
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::AddRequestListener - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::AddRequestListener - called from a non-Main thread!");
|
||||
|
||||
if (func)
|
||||
{
|
||||
@@ -155,7 +160,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CAudioSystem::RemoveRequestListener(AudioRequestCallbackType func, void* const callbackOwner)
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::RemoveRequestListener - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::RemoveRequestListener - called from a non-Main thread!");
|
||||
|
||||
SAudioEventListener listener;
|
||||
listener.m_callbackOwner = callbackOwner;
|
||||
@@ -167,7 +172,7 @@ namespace Audio
|
||||
void CAudioSystem::ExternalUpdate()
|
||||
{
|
||||
// Main Thread!
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::ExternalUpdate - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::ExternalUpdate - called from non-Main thread!");
|
||||
|
||||
// Notify callbacks on the pending callbacks queue...
|
||||
// These are requests that were completed then queued for callback processing to happen here.
|
||||
@@ -242,7 +247,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool CAudioSystem::Initialize()
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::Initialize - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::Initialize - called from a non-Main thread!");
|
||||
|
||||
if (!m_bSystemInitialized)
|
||||
{
|
||||
@@ -265,7 +270,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CAudioSystem::Release()
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::Release - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::Release - called from a non-Main thread!");
|
||||
|
||||
for (auto audioProxy : m_apAudioProxies)
|
||||
{
|
||||
@@ -331,14 +336,14 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool CAudioSystem::ReserveAudioListenerID(TAudioObjectID& rAudioObjectID)
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::ReserveAudioListenerID - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::ReserveAudioListenerID - called from a non-Main thread!");
|
||||
return m_oATL.ReserveAudioListenerID(rAudioObjectID);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
bool CAudioSystem::ReleaseAudioListenerID(TAudioObjectID const nAudioObjectID)
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::ReleaseAudioListenerID - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::ReleaseAudioListenerID - called from a non-Main thread!");
|
||||
return m_oATL.ReleaseAudioListenerID(nAudioObjectID);
|
||||
}
|
||||
|
||||
@@ -385,7 +390,7 @@ namespace Audio
|
||||
void CAudioSystem::RefreshAudioSystem([[maybe_unused]] const char* const levelName)
|
||||
{
|
||||
#if !defined(AUDIO_RELEASE)
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::RefreshAudioSystem - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::RefreshAudioSystem - called from a non-Main thread!");
|
||||
|
||||
// Get the controls path and a level-specific preload Id first.
|
||||
// This will be passed with the request so that it doesn't have to lookup this data
|
||||
@@ -409,7 +414,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
IAudioProxy* CAudioSystem::GetFreeAudioProxy()
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::GetFreeAudioProxy - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::GetFreeAudioProxy - called from a non-Main thread!");
|
||||
CAudioProxy* audioProxy = nullptr;
|
||||
|
||||
if (!m_apAudioProxies.empty())
|
||||
@@ -435,7 +440,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
void CAudioSystem::FreeAudioProxy(IAudioProxy* const audioProxyI)
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::FreeAudioProxy - called from a non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::FreeAudioProxy - called from a non-Main thread!");
|
||||
auto const audioProxy = static_cast<CAudioProxy*>(audioProxyI);
|
||||
|
||||
if (AZStd::find(m_apAudioProxiesToBeFreed.begin(), m_apAudioProxiesToBeFreed.end(), audioProxy) != m_apAudioProxiesToBeFreed.end() || AZStd::find(m_apAudioProxies.begin(), m_apAudioProxies.end(), audioProxy) != m_apAudioProxies.end())
|
||||
@@ -469,7 +474,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const char* CAudioSystem::GetAudioControlName([[maybe_unused]] const EAudioControlType controlType, [[maybe_unused]] const TATLIDType atlID) const
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::GetAudioControlName - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::GetAudioControlName - called from non-Main thread!");
|
||||
const char* sResult = nullptr;
|
||||
|
||||
#if !defined(AUDIO_RELEASE)
|
||||
@@ -524,7 +529,7 @@ namespace Audio
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
const char* CAudioSystem::GetAudioSwitchStateName([[maybe_unused]] const TAudioControlID switchID, [[maybe_unused]] const TAudioSwitchStateID stateID) const
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::GetAudioSwitchStateName - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::GetAudioSwitchStateName - called from non-Main thread!");
|
||||
const char* sResult = nullptr;
|
||||
|
||||
#if !defined(AUDIO_RELEASE)
|
||||
@@ -638,7 +643,7 @@ namespace Audio
|
||||
|
||||
AZ_PROFILE_SCOPE_DYNAMIC(AZ::Debug::ProfileCategory::Audio, "Normal Request: %s", request.ToString().c_str());
|
||||
|
||||
AZ_Assert(gEnv->mMainThreadId != CryGetCurrentThreadId(), "AudioSystem::ProcessRequestByPriority - called from Main thread!");
|
||||
AZ_Assert(g_mainThreadId != AZStd::this_thread::get_id(), "AudioSystem::ProcessRequestByPriority - called from Main thread!");
|
||||
|
||||
if (m_oATL.CanProcessRequests())
|
||||
{
|
||||
@@ -698,7 +703,7 @@ namespace Audio
|
||||
#if !defined(AUDIO_RELEASE)
|
||||
void CAudioSystem::DrawAudioDebugData()
|
||||
{
|
||||
AZ_Assert(gEnv->mMainThreadId == CryGetCurrentThreadId(), "AudioSystem::DrawAudioDebugData - called from non-Main thread!");
|
||||
AZ_Assert(g_mainThreadId == AZStd::this_thread::get_id(), "AudioSystem::DrawAudioDebugData - called from non-Main thread!");
|
||||
|
||||
if (CVars::s_debugDrawOptions.GetRawFlags() != 0)
|
||||
{
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include <FileCacheManager.h>
|
||||
|
||||
#include <AzCore/IO/FileIO.h>
|
||||
#include <AzCore/IO/IStreamer.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/std/parallel/binary_semaphore.h>
|
||||
#include <AzCore/StringFunc/StringFunc.h>
|
||||
#include <AzFramework/Archive/IArchive.h>
|
||||
|
||||
#include <AudioAllocators.h>
|
||||
#include <AudioInternalInterfaces.h>
|
||||
@@ -115,9 +115,9 @@ namespace Audio
|
||||
newAudioFileEntry->m_dataScope = dataScope;
|
||||
AZStd::to_lower(newAudioFileEntry->m_filePath.begin(), newAudioFileEntry->m_filePath.end());
|
||||
|
||||
const size_t fileSize = gEnv->pCryPak->FGetSize(newAudioFileEntry->m_filePath.c_str());
|
||||
|
||||
if (fileSize > 0)
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
if (AZ::u64 fileSize = 0;
|
||||
fileIO->Size(newAudioFileEntry->m_filePath.c_str(), fileSize) && fileSize != 0)
|
||||
{
|
||||
newAudioFileEntry->m_fileSize = fileSize;
|
||||
newAudioFileEntry->m_flags.ClearFlags(eAFF_NOTFOUND);
|
||||
@@ -770,9 +770,12 @@ namespace Audio
|
||||
}
|
||||
AZStd::to_lower(audioFileEntry->m_filePath.begin(), audioFileEntry->m_filePath.end());
|
||||
|
||||
audioFileEntry->m_fileSize = gEnv->pCryPak->FGetSize(audioFileEntry->m_filePath.c_str());
|
||||
AZ::u64 fileSize = 0;
|
||||
auto fileIO = AZ::IO::FileIOBase::GetInstance();
|
||||
fileIO->Size(audioFileEntry->m_filePath.c_str(), fileSize);
|
||||
audioFileEntry->m_fileSize = fileSize;
|
||||
|
||||
AZ_Assert(audioFileEntry->m_fileSize > 0, "FileCacheManager - UpdateLocalizedFileEntryData expected file size to be greater than zero!");
|
||||
AZ_Assert(audioFileEntry->m_fileSize != 0, "FileCacheManager - UpdateLocalizedFileEntryData expected file size to be greater than zero!");
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user