PageRenderTime 39ms CodeModel.GetById 11ms app.highlight 21ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 29#ifndef _CUSTOM_WAVE_H
 30#define _CUSTOM_WAVE_H
 31
 32#define CUSTOM_WAVE_DEBUG 0
 33
 34class CustomWave;
 35class GenExpr;
 36class PerPointEqn;
 37class Preset;
 38
 39#include <vector>
 40
 41#include "Common.hpp"
 42#include "Param.hpp"
 43#include "PerFrameEqn.hpp"
 44
 45#include <map>
 46
 47class CustomWave {
 48public:
 49
 50     /** Empty constructor leaves wave in undefined state **/
 51     CustomWave() {}
 52
 53     /** Initializes a custom wave id given the integer id */
 54     CustomWave(int id);
 55
 56    /** Destructor is necessary so we can free the per point matrices **/
 57    ~CustomWave();
 58
 59    /* Numerical id */
 60    int id;
 61    int per_frame_count;
 62
 63    /* Parameter tree associated with this custom wave */
 64    std::map<std::string,Param*> param_tree;
 65
 66    /* Engine variables */
 67    float x; /* x position for per point equations */
 68    float y; /* y position for per point equations */
 69    float r; /* red color value */
 70    float g; /* green color value */
 71    float b; /* blue color value */
 72    float a; /* alpha color value */
 73    float * x_mesh;
 74    float * y_mesh;
 75    float * r_mesh;
 76    float * b_mesh;
 77    float * g_mesh;
 78    float * a_mesh;
 79    float * value1;
 80    float * value2;
 81    float * sample_mesh;
 82    
 83    bool enabled; /* if true then wave is visible, hidden otherwise */
 84    int samples; /* number of samples associated with this wave form. Usually powers of 2 */
 85    float sample;
 86    bool bSpectrum; /* spectrum data or pcm data */
 87    bool bUseDots; /* draw wave as dots or lines */
 88    bool bDrawThick; /* draw thicker lines */
 89    bool bAdditive; /* add color values together */
 90    
 91    float scaling; /* scale factor of waveform */
 92    float smoothing; /* smooth factor of waveform */
 93    int sep;  /* no idea what this is yet... */
 94    
 95    /* stupid t variables */
 96    float t1;
 97    float t2;
 98    float t3;
 99    float t4;
100    float t5;
101    float t6;
102    float t7;
103    float t8;
104
105
106    /* stupider q variables */
107    float q1;
108    float q2;
109    float q3;
110    float q4;
111    float q5;
112    float q6;
113    float q7;
114    float q8;
115
116    float v1,v2;
117
118    /* Data structures to hold per frame and per point equations */
119    std::map<std::string,InitCond*>  init_cond_tree;
120    std::vector<PerFrameEqn*>  per_frame_eqn_tree;
121    std::vector<PerPointEqn*>  per_point_eqn_tree;
122    std::map<std::string,InitCond*>  per_frame_init_eqn_tree;
123
124    /* Denotes the index of the last character for each string buffer */
125    int per_point_eqn_string_index;
126    int per_frame_eqn_string_index;
127    int per_frame_init_eqn_string_index;
128
129    int add_per_point_eqn(char * name, GenExpr * gen_expr);
130    void evalCustomWaveInitConditions(Preset *preset);
131    void evalPerPointEqns();
132
133    void loadUnspecInitConds();
134    
135    void evalInitConds();
136
137};
138
139#endif /** !_CUSTOM_WAVE_H */