libcm is a C development framework with an emphasis on audio signal processing applications.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

cmFloatTypes.h 3.0KB

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