/xbmc/visualizations/XBMCProjectM/libprojectM/CustomWave.hpp

http://github.com/xbmc/xbmc · C++ Header · 139 lines · 76 code · 26 blank · 37 comment · 0 complexity · d8cd9c91ef5a0d27d914aee46482108b MD5 · raw file

  1. /**
  2. * projectM -- Milkdrop-esque visualisation SDK
  3. * Copyright (C)2003-2007 projectM Team
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. * See 'LICENSE.txt' included within this release
  19. *
  20. */
  21. /**
  22. * $Id$
  23. *
  24. * Encapsulation of a custom wave
  25. *
  26. * $Log$
  27. */
  28. #ifndef _CUSTOM_WAVE_H
  29. #define _CUSTOM_WAVE_H
  30. #define CUSTOM_WAVE_DEBUG 0
  31. class CustomWave;
  32. class GenExpr;
  33. class PerPointEqn;
  34. class Preset;
  35. #include <vector>
  36. #include "Common.hpp"
  37. #include "Param.hpp"
  38. #include "PerFrameEqn.hpp"
  39. #include <map>
  40. class CustomWave {
  41. public:
  42. /** Empty constructor leaves wave in undefined state **/
  43. CustomWave() {}
  44. /** Initializes a custom wave id given the integer id */
  45. CustomWave(int id);
  46. /** Destructor is necessary so we can free the per point matrices **/
  47. ~CustomWave();
  48. /* Numerical id */
  49. int id;
  50. int per_frame_count;
  51. /* Parameter tree associated with this custom wave */
  52. std::map<std::string,Param*> param_tree;
  53. /* Engine variables */
  54. float x; /* x position for per point equations */
  55. float y; /* y position for per point equations */
  56. float r; /* red color value */
  57. float g; /* green color value */
  58. float b; /* blue color value */
  59. float a; /* alpha color value */
  60. float * x_mesh;
  61. float * y_mesh;
  62. float * r_mesh;
  63. float * b_mesh;
  64. float * g_mesh;
  65. float * a_mesh;
  66. float * value1;
  67. float * value2;
  68. float * sample_mesh;
  69. bool enabled; /* if true then wave is visible, hidden otherwise */
  70. int samples; /* number of samples associated with this wave form. Usually powers of 2 */
  71. float sample;
  72. bool bSpectrum; /* spectrum data or pcm data */
  73. bool bUseDots; /* draw wave as dots or lines */
  74. bool bDrawThick; /* draw thicker lines */
  75. bool bAdditive; /* add color values together */
  76. float scaling; /* scale factor of waveform */
  77. float smoothing; /* smooth factor of waveform */
  78. int sep; /* no idea what this is yet... */
  79. /* stupid t variables */
  80. float t1;
  81. float t2;
  82. float t3;
  83. float t4;
  84. float t5;
  85. float t6;
  86. float t7;
  87. float t8;
  88. /* stupider q variables */
  89. float q1;
  90. float q2;
  91. float q3;
  92. float q4;
  93. float q5;
  94. float q6;
  95. float q7;
  96. float q8;
  97. float v1,v2;
  98. /* Data structures to hold per frame and per point equations */
  99. std::map<std::string,InitCond*> init_cond_tree;
  100. std::vector<PerFrameEqn*> per_frame_eqn_tree;
  101. std::vector<PerPointEqn*> per_point_eqn_tree;
  102. std::map<std::string,InitCond*> per_frame_init_eqn_tree;
  103. /* Denotes the index of the last character for each string buffer */
  104. int per_point_eqn_string_index;
  105. int per_frame_eqn_string_index;
  106. int per_frame_init_eqn_string_index;
  107. int add_per_point_eqn(char * name, GenExpr * gen_expr);
  108. void evalCustomWaveInitConditions(Preset *preset);
  109. void evalPerPointEqns();
  110. void loadUnspecInitConds();
  111. void evalInitConds();
  112. };
  113. #endif /** !_CUSTOM_WAVE_H */