00001 00002 // 00003 // Copyright (c) 2006 Audiokinetic Inc. / All Rights Reserved 00004 // 00006 00007 // AkSpeakerVolumes.h 00008 00011 00012 #ifndef _AKSPEAKERVOLUMES_GENERIC_H_ 00013 #define _AKSPEAKERVOLUMES_GENERIC_H_ 00014 00015 #include <AK/SoundEngine/Common/AkTypes.h> 00016 00017 #if defined( AK_CPU_ARM_NEON ) || ( ( defined( AK_CPU_X86 ) || defined( AK_CPU_X86_64 ) ) && !defined(AK_IOS) && !defined(AK_ANDROID)) || defined( AK_WIIU ) 00018 00019 #define AKSIMD_SPEAKER_VOLUME 00020 00021 #endif 00022 00023 #ifdef AKSIMD_SPEAKER_VOLUME 00024 00025 #include <AK/SoundEngine/Common/AkSimd.h> 00026 00027 // Extend AK::SpeakerVolumes. AKSIMD implementation 00028 namespace AK 00029 { 00030 namespace SpeakerVolumes 00031 { 00032 namespace Vector 00033 { 00034 #ifdef AKSIMD_V4F32_SUPPORTED 00035 00037 AkForceInline AkUInt32 GetNumV4F32( AkUInt32 in_uNumChannels ) 00038 { 00039 return ( in_uNumChannels + ( sizeof( AKSIMD_V4F32 ) / 4 ) - 1 ) >> 2; 00040 } 00041 00043 AkForceInline AkUInt32 GetNumElements( AkUInt32 in_uNumChannels ) 00044 { 00045 return GetNumV4F32( in_uNumChannels ) * 4; 00046 } 00047 00049 AkForceInline AkUInt32 GetRequiredSize( AkUInt32 in_uNumChannels ) 00050 { 00051 return GetNumV4F32( in_uNumChannels ) * sizeof( AKSIMD_V4F32 ); 00052 } 00053 00054 #elif defined (AKSIMD_V2F32_SUPPORTED) 00055 00057 AkForceInline AkUInt32 GetNumV2F32( AkUInt32 in_uNumChannels ) 00058 { 00059 return ( in_uNumChannels + ( sizeof( AKSIMD_V2F32 ) / 2 ) - 1 ) >> 1; 00060 } 00061 00063 AkForceInline AkUInt32 GetNumElements( AkUInt32 in_uNumChannels ) 00064 { 00065 return GetNumV2F32( in_uNumChannels ) * 2; 00066 } 00067 00069 AkForceInline AkUInt32 GetRequiredSize( AkUInt32 in_uNumChannels ) 00070 { 00071 return GetNumV2F32( in_uNumChannels ) * sizeof( AKSIMD_V2F32 ); 00072 } 00073 00074 #else 00075 #error Should use scalar implementation. 00076 #endif 00077 } 00078 } 00079 } 00080 00081 #else 00082 00083 // Extend AK::SpeakerVolumes. Scalar implementation. 00084 namespace AK 00085 { 00086 namespace SpeakerVolumes 00087 { 00088 namespace Vector 00089 { 00091 AkForceInline AkUInt32 GetRequiredSize( AkUInt32 in_uNumChannels ) 00092 { 00093 return in_uNumChannels * sizeof( AkReal32 ); 00094 } 00095 00096 AkForceInline AkUInt32 GetNumElements( AkUInt32 in_uNumChannels ) 00097 { 00098 return in_uNumChannels; 00099 } 00100 } 00101 } 00102 } 00103 00104 #endif // AKSIMD_SPEAKER_VOLUME 00105 00106 #endif //_AKSPEAKERVOLUMES_GENERIC_H_ 00107 00108 00109
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageRegister your project and we'll help you get started with no strings attached!
Get started with Wwise