You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
5.1KB

  1. #pragma once
  2. #include "rack.hpp"
  3. #include "componentlibrary.hpp"
  4. namespace rack {
  5. ////////////////////
  6. // common
  7. ////////////////////
  8. /** Deprecated lowercase macro */
  9. #define defer(...) DEFER(__VA_ARGS__)
  10. ////////////////////
  11. // math
  12. ////////////////////
  13. DEPRECATED inline int min(int a, int b) {return std::min(a, b);}
  14. DEPRECATED inline int max(int a, int b) {return std::max(a, b);}
  15. DEPRECATED inline int eucmod(int a, int base) {return eucMod(a, base);}
  16. DEPRECATED inline bool ispow2(int n) {return isPow2(n);}
  17. DEPRECATED inline int clamp2(int x, int a, int b) {return clampBetween(x, a, b);}
  18. DEPRECATED inline float min(float a, float b) {return std::min(a, b);}
  19. DEPRECATED inline float max(float a, float b) {return std::max(a, b);}
  20. DEPRECATED inline float eucmod(float a, float base) {return eucMod(a, base);}
  21. DEPRECATED inline float clamp2(float x, float a, float b) {return clampBetween(x, a, b);}
  22. DEPRECATED inline int mini(int a, int b) {return std::min(a, b);}
  23. DEPRECATED inline int maxi(int a, int b) {return std::max(a, b);}
  24. DEPRECATED inline int clampi(int x, int min, int max) {return math::clamp(x, min, max);}
  25. DEPRECATED inline int absi(int a) {return std::abs(a);}
  26. DEPRECATED inline int eucmodi(int a, int base) {return eucMod(a, base);}
  27. DEPRECATED inline int log2i(int n) {return log2(n);}
  28. DEPRECATED inline bool ispow2i(int n) {return isPow2(n);}
  29. DEPRECATED inline float absf(float x) {return std::abs(x);}
  30. DEPRECATED inline float sgnf(float x) {return sgn(x);}
  31. DEPRECATED inline float eucmodf(float a, float base) {return eucMod(a, base);}
  32. DEPRECATED inline bool nearf(float a, float b, float epsilon = 1.0e-6f) {return math::isNear(a, b, epsilon);}
  33. DEPRECATED inline float clampf(float x, float min, float max) {return math::clamp(x, min, max);}
  34. DEPRECATED inline float clamp2f(float x, float min, float max) {return clampBetween(x, min, max);}
  35. DEPRECATED inline float chopf(float x, float eps) {return chop(x, eps);}
  36. DEPRECATED inline float rescalef(float x, float a, float b, float yMin, float yMax) {return math::rescale(x, a, b, yMin, yMax);}
  37. DEPRECATED inline float crossf(float a, float b, float frac) {return crossfade(a, b, frac);}
  38. DEPRECATED inline float interpf(const float *p, float x) {return interpolateLinear(p, x);}
  39. DEPRECATED inline void cmultf(float *cr, float *ci, float ar, float ai, float br, float bi) {return cmult(cr, ci, ar, ai, br, bi);}
  40. ////////////////////
  41. // random
  42. ////////////////////
  43. DEPRECATED inline float randomu32() {return random::u32();}
  44. DEPRECATED inline float randomu64() {return random::u64();}
  45. DEPRECATED inline float randomUniform() {return random::uniform();}
  46. DEPRECATED inline float randomNormal() {return random::normal();}
  47. DEPRECATED inline float randomf() {return random::uniform();}
  48. ////////////////////
  49. // logger
  50. ////////////////////
  51. /** Deprecated lowercase log functions */
  52. #define debug(...) DEBUG(__VA_ARGS__)
  53. #define info(...) INFO(__VA_ARGS__)
  54. #define warn(...) WARN(__VA_ARGS__)
  55. #define fatal(...) FATAL(__VA_ARGS__)
  56. ////////////////////
  57. // asset
  58. ////////////////////
  59. DEPRECATED inline std::string assetGlobal(std::string filename) {return asset::system(filename);}
  60. DEPRECATED inline std::string assetLocal(std::string filename) {return asset::user(filename);}
  61. DEPRECATED inline std::string assetPlugin(Plugin *plugin, std::string filename) {return asset::plugin(plugin, filename);}
  62. ////////////////////
  63. // color
  64. ////////////////////
  65. DEPRECATED inline NVGcolor colorClip(NVGcolor a) {return color::clip(a);}
  66. DEPRECATED inline NVGcolor colorMinus(NVGcolor a, NVGcolor b) {return color::minus(a, b);}
  67. DEPRECATED inline NVGcolor colorPlus(NVGcolor a, NVGcolor b) {return color::plus(a, b);}
  68. DEPRECATED inline NVGcolor colorMult(NVGcolor a, NVGcolor b) {return color::mult(a, b);}
  69. DEPRECATED inline NVGcolor colorMult(NVGcolor a, float x) {return color::mult(a, x);}
  70. DEPRECATED inline NVGcolor colorScreen(NVGcolor a, NVGcolor b) {return color::screen(a, b);}
  71. DEPRECATED inline NVGcolor colorAlpha(NVGcolor a, float alpha) {return color::alpha(a, alpha);}
  72. DEPRECATED inline NVGcolor colorFromHexString(std::string s) {return color::fromHexString(s);}
  73. DEPRECATED inline std::string colorToHexString(NVGcolor c) {return color::toHexString(c);}
  74. ////////////////////
  75. // componentlibrary
  76. ////////////////////
  77. DEPRECATED static const NVGcolor COLOR_BLACK_TRANSPARENT = SCHEME_BLACK_TRANSPARENT;
  78. DEPRECATED static const NVGcolor COLOR_BLACK = SCHEME_BLACK;
  79. DEPRECATED static const NVGcolor COLOR_WHITE = SCHEME_WHITE;
  80. DEPRECATED static const NVGcolor COLOR_RED = SCHEME_RED;
  81. DEPRECATED static const NVGcolor COLOR_ORANGE = SCHEME_ORANGE;
  82. DEPRECATED static const NVGcolor COLOR_YELLOW = SCHEME_YELLOW;
  83. DEPRECATED static const NVGcolor COLOR_GREEN = SCHEME_GREEN;
  84. DEPRECATED static const NVGcolor COLOR_CYAN = SCHEME_CYAN;
  85. DEPRECATED static const NVGcolor COLOR_BLUE = SCHEME_BLUE;
  86. DEPRECATED static const NVGcolor COLOR_PURPLE = SCHEME_PURPLE;
  87. DEPRECATED static const NVGcolor COLOR_LIGHT_PANEL = SCHEME_LIGHT_PANEL;
  88. DEPRECATED static const NVGcolor COLOR_DARK_PANEL = SCHEME_DARK_PANEL;
  89. ////////////////////
  90. // helpers
  91. ////////////////////
  92. template <class TScrew>
  93. DEPRECATED TScrew *createScrew(math::Vec pos) {
  94. return createWidget<TScrew>(pos);
  95. }
  96. } // namespace rack