/*---------------------------------------------------------------------------* Project: NintendoWare File: snd_CurveLfo.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 13145 $ *---------------------------------------------------------------------------*/ #ifndef NW_SND_CURVE_LFO_H_ #define NW_SND_CURVE_LFO_H_ #include namespace nw { namespace snd { namespace internal { /* ======================================================================== structure definition ======================================================================== */ struct CurveLfoParam { f32 depth; f32 speed; // [Hz] u32 delay; u8 range; u8 padding[3]; CurveLfoParam() { Initialize(); } void Initialize(); }; /* ======================================================================== class definition ======================================================================== */ class CurveLfo { /* ------------------------------------------------------------------------ constant declaration ------------------------------------------------------------------------ */ private: static const int TABLE_SIZE = 32; static const int PERIOD = TABLE_SIZE * 4; /* ------------------------------------------------------------------------ static member ------------------------------------------------------------------------ */ private: static s8 GetSinIdx( int index ); /* ------------------------------------------------------------------------ class member ------------------------------------------------------------------------ */ public: CurveLfo() : m_DelayCounter(0), m_Counter( 0.0f ) {} void Reset(); void Update( int msec ); f32 GetValue() const; void SetParam( const CurveLfoParam& lfoParam ) { m_Param = lfoParam; /* copy */ } CurveLfoParam& GetParam() { return m_Param; } const CurveLfoParam& GetParam() const { return m_Param; } private: CurveLfoParam m_Param; u32 m_DelayCounter; f32 m_Counter; }; } // namespace nw::snd::internal } // namespace nw::snd } // namespace nw #endif /* NW_SND_CURVE_LFO_H_ */