demos/spectrum/3rdparty/fftreal/OscSinCos.h
changeset 25 e24348a560a6
equal deleted inserted replaced
23:89e065397ea6 25:e24348a560a6
       
     1 /*****************************************************************************
       
     2 
       
     3         OscSinCos.h
       
     4         Copyright (c) 2005 Laurent de Soras
       
     5 
       
     6 --- Legal stuff ---
       
     7 
       
     8 This library is free software; you can redistribute it and/or
       
     9 modify it under the terms of the GNU Lesser General Public
       
    10 License as published by the Free Software Foundation; either
       
    11 version 2.1 of the License, or (at your option) any later version.
       
    12 
       
    13 This library is distributed in the hope that it will be useful,
       
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    16 Lesser General Public License for more details.
       
    17 
       
    18 You should have received a copy of the GNU Lesser General Public
       
    19 License along with this library; if not, write to the Free Software
       
    20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    21 
       
    22 *Tab=3***********************************************************************/
       
    23 
       
    24 
       
    25 
       
    26 #if ! defined (OscSinCos_HEADER_INCLUDED)
       
    27 #define	OscSinCos_HEADER_INCLUDED
       
    28 
       
    29 #if defined (_MSC_VER)
       
    30 	#pragma once
       
    31 	#pragma warning (4 : 4250) // "Inherits via dominance."
       
    32 #endif
       
    33 
       
    34 
       
    35 
       
    36 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    37 
       
    38 #include	"def.h"
       
    39 
       
    40 
       
    41 
       
    42 template <class T>
       
    43 class OscSinCos
       
    44 {
       
    45 
       
    46 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    47 
       
    48 public:
       
    49 
       
    50 	typedef	T	DataType;
       
    51 
       
    52 						OscSinCos ();
       
    53 
       
    54 	FORCEINLINE void
       
    55 						set_step (double angle_rad);
       
    56 
       
    57 	FORCEINLINE DataType
       
    58 						get_cos () const;
       
    59 	FORCEINLINE DataType
       
    60 						get_sin () const;
       
    61 	FORCEINLINE void
       
    62 						step ();
       
    63 	FORCEINLINE void
       
    64 						clear_buffers ();
       
    65 
       
    66 
       
    67 
       
    68 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    69 
       
    70 protected:
       
    71 
       
    72 
       
    73 
       
    74 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    75 
       
    76 private:
       
    77 
       
    78 	DataType			_pos_cos;		// Current phase expressed with sin and cos. [-1 ; 1]
       
    79 	DataType			_pos_sin;		// -
       
    80 	DataType			_step_cos;		// Phase increment per step, [-1 ; 1]
       
    81 	DataType			_step_sin;		// -
       
    82 
       
    83 
       
    84 
       
    85 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
       
    86 
       
    87 private:
       
    88 
       
    89 						OscSinCos (const OscSinCos &other);
       
    90 	OscSinCos &		operator = (const OscSinCos &other);
       
    91 	bool				operator == (const OscSinCos &other);
       
    92 	bool				operator != (const OscSinCos &other);
       
    93 
       
    94 };	// class OscSinCos
       
    95 
       
    96 
       
    97 
       
    98 #include	"OscSinCos.hpp"
       
    99 
       
   100 
       
   101 
       
   102 #endif	// OscSinCos_HEADER_INCLUDED
       
   103 
       
   104 
       
   105 
       
   106 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/