libcm is a C development framework with an emphasis on audio signal processing applications.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /// \file cmFloatTypes.h
  2. /// \brief Declare the types cmReal_t and cmSample_t and define some useful limits.
  3. ///
  4. /// For signal processing functions the cm library uses the types cmSample_t to indicate an audio
  5. /// sample value and cmReal_t to specify a general purpose floating point value. The library
  6. /// is designed in such a way that the actual type, float or double, for these two types may
  7. /// be set at compilation time. Set the preprocessor variable CM_FLOAT_SMP to 1 to indicate
  8. /// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
  9. /// Set the preprocessor variable CM_FLOAT_REAL to 1 to indicate
  10. /// that cmSample_t will be of type 'float' otherwise it will be of type 'double'.
  11. /// By default cmSample_t is float nad cmReal_t is double.
  12. ///
  13. #ifndef cmFloatTypes_h
  14. #define cmFloatTypes_h
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. //-----------------------------------------------------------------
  19. #ifndef CM_FLOAT_SMP
  20. #define CM_FLOAT_SMP 1
  21. #endif
  22. #if CM_FLOAT_SMP == 1
  23. typedef float cmSample_t; ///< cmSample_t is a float
  24. typedef float _Complex cmComplexS_t;///< cmComplexS_t is single precision.
  25. #define cmSample_EPSILON FLT_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
  26. #define cmSample_MAX FLT_MAX ///< Maximum representable number (1E+37).
  27. #define cmSample_MIN FLT_MIN ///< Minimum representable number (1E-37).
  28. #else
  29. typedef double cmSample_t; ///< cmSample_t is a double
  30. typedef double _Complex cmComplexS_t; ///< cmComplexS_t is doulbe precision.
  31. #define cmSample_EPSILON DBL_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-9)
  32. #define cmSample_MAX DBL_MAX ///< Maximum representable number (1E+37).
  33. #define cmSample_MIN DBL_MIN ///< Minimum representable number (1E-37).
  34. #endif
  35. //-----------------------------------------------------------------
  36. //-----------------------------------------------------------------
  37. //-----------------------------------------------------------------
  38. #ifndef CM_FLOAT_REAL
  39. #define CM_FLOAT_REAL 0
  40. #endif
  41. #if CM_FLOAT_REAL == 1
  42. typedef float cmReal_t; ///< cmReal_t is a float
  43. typedef float _Complex cmComplexR_t; ///< cmComplexR_t is single precision.
  44. #define cmReal_EPSILON FLT_EPSILON ///< Minimum increment between 1.0 and the next greaterv value. (1E-5)
  45. #define cmReal_MAX FLT_MAX ///< Maximum representable number (1E+37).
  46. #define cmReal_MIN FLT_MIN ///< Minimum representable number (1E-37).
  47. #else
  48. typedef double cmReal_t; ///< cmReal_t is a double.
  49. typedef double _Complex cmComplexR_t; ///< cmComplexR_t is double precision.
  50. #define cmReal_EPSILON DBL_EPSILON ///< Minimum increment between 1.0 and the next greaterv value (1E-9).
  51. #define cmReal_MAX DBL_MAX ///< Maximum representable number (1E+37).
  52. #define cmReal_MIN DBL_MIN ///< Minimum representable number (1E-37).
  53. #endif
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif