OscSinCos.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*****************************************************************************
  2. OscSinCos.h
  3. By Laurent de Soras
  4. --- Legal stuff ---
  5. This program is free software. It comes without any warranty, to
  6. the extent permitted by applicable law. You can redistribute it
  7. and/or modify it under the terms of the Do What The Fuck You Want
  8. To Public License, Version 2, as published by Sam Hocevar. See
  9. http://sam.zoy.org/wtfpl/COPYING for more details.
  10. *Tab=3***********************************************************************/
  11. #if ! defined (ffft_OscSinCos_HEADER_INCLUDED)
  12. #define ffft_OscSinCos_HEADER_INCLUDED
  13. #if defined (_MSC_VER)
  14. #pragma once
  15. #pragma warning (4 : 4250) // "Inherits via dominance."
  16. #endif
  17. /*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  18. #include "def.h"
  19. namespace ffft
  20. {
  21. template <class T>
  22. class OscSinCos
  23. {
  24. /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  25. public:
  26. typedef T DataType;
  27. OscSinCos ();
  28. ffft_FORCEINLINE void
  29. set_step (double angle_rad);
  30. ffft_FORCEINLINE DataType
  31. get_cos () const;
  32. ffft_FORCEINLINE DataType
  33. get_sin () const;
  34. ffft_FORCEINLINE void
  35. step ();
  36. ffft_FORCEINLINE void
  37. clear_buffers ();
  38. /*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  39. protected:
  40. /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  41. private:
  42. DataType _pos_cos; // Current phase expressed with sin and cos. [-1 ; 1]
  43. DataType _pos_sin; // -
  44. DataType _step_cos; // Phase increment per step, [-1 ; 1]
  45. DataType _step_sin; // -
  46. /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
  47. private:
  48. OscSinCos (const OscSinCos &other);
  49. OscSinCos & operator = (const OscSinCos &other);
  50. bool operator == (const OscSinCos &other);
  51. bool operator != (const OscSinCos &other);
  52. }; // class OscSinCos
  53. } // namespace ffft
  54. #include "OscSinCos.hpp"
  55. #endif // ffft_OscSinCos_HEADER_INCLUDED
  56. /*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/