/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #include #include #include #include namespace Audio::Platform { void InitializeAudioAllocators() { // Create audio system memory pool if (!AZ::AllocatorInstance::IsReady()) { const size_t heapSize = Audio::CVars::s_ATLMemorySize << 10; AudioSystemAllocator::Descriptor allocDesc; // Generic Allocator: allocDesc.m_allocationRecords = true; allocDesc.m_heap.m_numFixedMemoryBlocks = 1; allocDesc.m_heap.m_fixedMemoryBlocksByteSize[0] = heapSize; allocDesc.m_heap.m_fixedMemoryBlocks[0] = AZ::AllocatorInstance::Get().Allocate( allocDesc.m_heap.m_fixedMemoryBlocksByteSize[0], allocDesc.m_heap.m_memoryBlockAlignment ); AZ::AllocatorInstance::Create(allocDesc); } // Create the Bank allocator... if (!AZ::AllocatorInstance::IsReady()) { const size_t heapSize = Audio::CVars::s_FileCacheManagerMemorySize << 10; AudioBankAllocator::Descriptor allocDesc; allocDesc.m_allocationRecords = true; allocDesc.m_heap.m_numFixedMemoryBlocks = 1; allocDesc.m_heap.m_fixedMemoryBlocksByteSize[0] = heapSize; allocDesc.m_heap.m_fixedMemoryBlocks[0] = AZ::AllocatorInstance::Get().Allocate( allocDesc.m_heap.m_fixedMemoryBlocksByteSize[0], allocDesc.m_heap.m_memoryBlockAlignment ); AZ::AllocatorInstance::Create(allocDesc); } } void ShutdownAudioAllocators() { if (AZ::AllocatorInstance::IsReady()) { AZ::AllocatorInstance::Destroy(); } if (AZ::AllocatorInstance::IsReady()) { AZ::AllocatorInstance::Destroy(); } } } // namespace Audio::Platform