Version

menu_open

include/AK/Plugin/PluginServices/AkVectorValueRamp.h

Go to the documentation of this file.
00001 
00002 //
00003 // Copyright (c) 2010 Audiokinetic Inc. / All Rights Reserved
00004 //
00006 
00007 #ifndef _AK_VECTORVALUERAMP_H_
00008 #define _AK_VECTORVALUERAMP_H_
00009 
00010 #include <AK/SoundEngine/Common/AkSimd.h>
00011 
00014 class CAkVectorValueRampV4
00015 {
00016 public:
00017 
00018     AkForceInline AKSIMD_V4F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
00019     {
00020         const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
00021         const AkReal32 f4xInc = 4.f*fIncrement;
00022         vIncrement = AKSIMD_LOAD1_V4F32( f4xInc);
00023         AK_ALIGN_SIMD( AkReal32 fVal[4] );
00024         fVal[0] = in_fStartValue;
00025         fVal[1] = fVal[0] + fIncrement;
00026         fVal[2] = fVal[1] + fIncrement;
00027         fVal[3] = fVal[2] + fIncrement;
00028         vValueRamp = AKSIMD_LOAD_V4F32( fVal );
00029         return vValueRamp;
00030     }
00031 
00032     AkForceInline AKSIMD_V4F32 Tick( )
00033     {
00034         vValueRamp = AKSIMD_ADD_V4F32( vValueRamp, vIncrement );
00035         return vValueRamp;
00036     }
00037 
00038 private:
00039     AKSIMD_V4F32 vIncrement;
00040     AKSIMD_V4F32 vValueRamp;
00041 };
00042 
00043 
00044 #ifdef AKSIMD_V2F32_SUPPORTED
00045 
00046 
00047 class CAkVectorValueRampV2
00048 {
00049 public:
00050 
00051     AkForceInline AKSIMD_V2F32 Setup( AkReal32 in_fStartValue, AkReal32 in_fStopValue, AkUInt32 in_uNumFrames )
00052     {
00053         const AkReal32 fIncrement = (in_fStopValue-in_fStartValue)/in_uNumFrames;
00054         const AkReal32 f2xInc = 2.f*fIncrement;
00055         vIncrement = AKSIMD_SET_V2F32( f2xInc );
00056         AKSIMD_BUILD_V2F32( const AKSIMD_V2F32 vStartOffset, 0.f, fIncrement );
00057         AKSIMD_V2F32 l_vValueRamp = AKSIMD_SET_V2F32( in_fStartValue );
00058         l_vValueRamp = AKSIMD_ADD_V2F32( l_vValueRamp, vStartOffset );
00059         vValueRamp = l_vValueRamp;
00060         return l_vValueRamp;
00061     }
00062 
00063     AkForceInline AKSIMD_V2F32 Tick( )
00064     {
00065         vValueRamp = AKSIMD_ADD_V2F32( vValueRamp, vIncrement );
00066         return vValueRamp;
00067     }
00068 
00069 private:
00070     AKSIMD_V2F32 vIncrement;
00071     AKSIMD_V2F32 vValueRamp;
00072 };
00073 #endif
00074 
00075 // By default, CAkVectorValueRamp uses the V4 implementation.
00076 typedef CAkVectorValueRampV4 CAkVectorValueRamp;
00077 
00078 #endif //_AK_VECTORVALUERAMP_H_

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise