BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

OscSinCos.h (2249B)


      1 /*****************************************************************************
      2 
      3         OscSinCos.h
      4         By Laurent de Soras
      5 
      6 --- Legal stuff ---
      7 
      8 This program is free software. It comes without any warranty, to
      9 the extent permitted by applicable law. You can redistribute it
     10 and/or modify it under the terms of the Do What The Fuck You Want
     11 To Public License, Version 2, as published by Sam Hocevar. See
     12 http://sam.zoy.org/wtfpl/COPYING for more details.
     13 
     14 *Tab=3***********************************************************************/
     15 
     16 
     17 
     18 #if ! defined (ffft_OscSinCos_HEADER_INCLUDED)
     19 #define	ffft_OscSinCos_HEADER_INCLUDED
     20 
     21 #if defined (_MSC_VER)
     22 	#pragma once
     23 	#pragma warning (4 : 4250) // "Inherits via dominance."
     24 #endif
     25 
     26 
     27 
     28 /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
     29 
     30 #include	"ffft/def.h"
     31 
     32 
     33 
     34 namespace ffft
     35 {
     36 
     37 
     38 
     39 template <class T>
     40 class OscSinCos
     41 {
     42 
     43 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
     44 
     45 public:
     46 
     47 	typedef	T	DataType;
     48 
     49 						OscSinCos ();
     50 
     51 	ffft_FORCEINLINE void
     52 						set_step (double angle_rad);
     53 
     54 	ffft_FORCEINLINE DataType
     55 						get_cos () const;
     56 	ffft_FORCEINLINE DataType
     57 						get_sin () const;
     58 	ffft_FORCEINLINE void
     59 						step ();
     60 	ffft_FORCEINLINE void
     61 						clear_buffers ();
     62 
     63 
     64 
     65 /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
     66 
     67 protected:
     68 
     69 
     70 
     71 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
     72 
     73 private:
     74 
     75 	DataType			_pos_cos;		// Current phase expressed with sin and cos. [-1 ; 1]
     76 	DataType			_pos_sin;		// -
     77 	DataType			_step_cos;		// Phase increment per step, [-1 ; 1]
     78 	DataType			_step_sin;		// -
     79 
     80 
     81 
     82 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
     83 
     84 private:
     85 
     86 						OscSinCos (const OscSinCos &other);
     87 	OscSinCos &		operator = (const OscSinCos &other);
     88 	bool				operator == (const OscSinCos &other);
     89 	bool				operator != (const OscSinCos &other);
     90 
     91 };	// class OscSinCos
     92 
     93 
     94 
     95 }	// namespace ffft
     96 
     97 
     98 
     99 #include	"ffft/OscSinCos.hpp"
    100 
    101 
    102 
    103 #endif	// ffft_OscSinCos_HEADER_INCLUDED
    104 
    105 
    106 
    107 /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/