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.

125 lines
5.2KB

  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 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 isNear(a, b, epsilon);}
  33. DEPRECATED inline float clampf(float x, float min, float max) {return 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 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. // string
  50. ////////////////////
  51. using string::stringf;
  52. ////////////////////
  53. // logger
  54. ////////////////////
  55. /** Deprecated lowercase log functions */
  56. #define debug(...) DEBUG(__VA_ARGS__)
  57. #define info(...) INFO(__VA_ARGS__)
  58. #define warn(...) WARN(__VA_ARGS__)
  59. #define fatal(...) FATAL(__VA_ARGS__)
  60. ////////////////////
  61. // asset
  62. ////////////////////
  63. DEPRECATED inline std::string assetGlobal(std::string filename) {return asset::global(filename);}
  64. DEPRECATED inline std::string assetLocal(std::string filename) {return asset::local(filename);}
  65. DEPRECATED inline std::string assetPlugin(Plugin *plugin, std::string filename) {return asset::plugin(plugin, filename);}
  66. ////////////////////
  67. // color
  68. ////////////////////
  69. DEPRECATED inline NVGcolor colorClip(NVGcolor a) {return color::clip(a);}
  70. DEPRECATED inline NVGcolor colorMinus(NVGcolor a, NVGcolor b) {return color::minus(a, b);}
  71. DEPRECATED inline NVGcolor colorPlus(NVGcolor a, NVGcolor b) {return color::plus(a, b);}
  72. DEPRECATED inline NVGcolor colorMult(NVGcolor a, NVGcolor b) {return color::mult(a, b);}
  73. DEPRECATED inline NVGcolor colorMult(NVGcolor a, float x) {return color::mult(a, x);}
  74. DEPRECATED inline NVGcolor colorScreen(NVGcolor a, NVGcolor b) {return color::screen(a, b);}
  75. DEPRECATED inline NVGcolor colorAlpha(NVGcolor a, float alpha) {return color::alpha(a, alpha);}
  76. DEPRECATED inline NVGcolor colorFromHexString(std::string s) {return color::fromHexString(s);}
  77. DEPRECATED inline std::string colorToHexString(NVGcolor c) {return color::toHexString(c);}
  78. ////////////////////
  79. // componentlibrary
  80. ////////////////////
  81. DEPRECATED static const NVGcolor COLOR_BLACK_TRANSPARENT = SCHEME_BLACK_TRANSPARENT;
  82. DEPRECATED static const NVGcolor COLOR_BLACK = SCHEME_BLACK;
  83. DEPRECATED static const NVGcolor COLOR_WHITE = SCHEME_WHITE;
  84. DEPRECATED static const NVGcolor COLOR_RED = SCHEME_RED;
  85. DEPRECATED static const NVGcolor COLOR_ORANGE = SCHEME_ORANGE;
  86. DEPRECATED static const NVGcolor COLOR_YELLOW = SCHEME_YELLOW;
  87. DEPRECATED static const NVGcolor COLOR_GREEN = SCHEME_GREEN;
  88. DEPRECATED static const NVGcolor COLOR_CYAN = SCHEME_CYAN;
  89. DEPRECATED static const NVGcolor COLOR_BLUE = SCHEME_BLUE;
  90. DEPRECATED static const NVGcolor COLOR_PURPLE = SCHEME_PURPLE;
  91. DEPRECATED static const NVGcolor COLOR_LIGHT_PANEL = SCHEME_LIGHT_PANEL;
  92. DEPRECATED static const NVGcolor COLOR_DARK_PANEL = SCHEME_DARK_PANEL;
  93. ////////////////////
  94. // helpers
  95. ////////////////////
  96. template <class TScrew>
  97. DEPRECATED TScrew *createScrew(math::Vec pos) {
  98. return createWidget<TScrew>(pos);
  99. }
  100. } // namespace rack