MiniAudioModuleInterface.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AzCore/Memory/SystemAllocator.h>
  9. #include <AzCore/Module/Module.h>
  10. namespace MiniAudio
  11. {
  12. // forwarded here to avoid leaking miniaudio.h into shared files.
  13. extern AZ::ComponentDescriptor* MiniAudioSystemComponent_CreateDescriptor();
  14. extern AZ::TypeId MiniAudioSystemComponent_GetTypeId();
  15. extern AZ::ComponentDescriptor* MiniAudioPlaybackComponent_CreateDescriptor();
  16. extern AZ::ComponentDescriptor* MiniAudioListenerComponent_CreateDescriptor();
  17. class MiniAudioModuleInterface
  18. : public AZ::Module
  19. {
  20. public:
  21. AZ_RTTI(MiniAudioModuleInterface, "{290D3CED-B418-46E5-88A4-69EBF7DFC32C}", AZ::Module);
  22. AZ_CLASS_ALLOCATOR(MiniAudioModuleInterface, AZ::SystemAllocator, 0);
  23. MiniAudioModuleInterface()
  24. {
  25. // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
  26. // Add ALL components descriptors associated with this gem to m_descriptors.
  27. // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
  28. // This happens through the [MyComponent]::Reflect() function.
  29. m_descriptors.insert(m_descriptors.end(), {
  30. MiniAudioSystemComponent_CreateDescriptor(),
  31. MiniAudioPlaybackComponent_CreateDescriptor(),
  32. MiniAudioListenerComponent_CreateDescriptor(),
  33. });
  34. }
  35. /**
  36. * Add required SystemComponents to the SystemEntity.
  37. */
  38. AZ::ComponentTypeList GetRequiredSystemComponents() const override
  39. {
  40. return AZ::ComponentTypeList{
  41. MiniAudioSystemComponent_GetTypeId(),
  42. };
  43. }
  44. };
  45. }// namespace MiniAudio