1 /*
2  * Audacious - a cross-platform multimedia player
3  * Copyright (c) 2007-2011  Audacious development team.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; under version 3 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses>.
16  *
17  * The Audacious team does not consider modular code linking to
18  * Audacious or using our public API to be a derived work.
19  */
20 
21 #ifndef SKINS_UI_VIS_H
22 #define SKINS_UI_VIS_H
23 
24 #include <stdint.h>
25 #include "widget.h"
26 
27 typedef enum {
28     VIS_ANALYZER, VIS_SCOPE, VIS_VOICEPRINT, VIS_OFF
29 } VisType;
30 
31 typedef enum {
32     ANALYZER_NORMAL, ANALYZER_FIRE, ANALYZER_VLINES
33 } AnalyzerMode;
34 
35 typedef enum {
36     ANALYZER_LINES, ANALYZER_BARS
37 } AnalyzerType;
38 
39 typedef enum {
40     SCOPE_DOT, SCOPE_LINE, SCOPE_SOLID
41 } ScopeMode;
42 
43 typedef enum {
44     VOICEPRINT_NORMAL, VOICEPRINT_FIRE, VOICEPRINT_ICE
45 } VoiceprintMode;
46 
47 typedef enum {
48     VU_NORMAL, VU_SMOOTH
49 } VUMode;
50 
51 typedef enum {
52     FALLOFF_SLOWEST, FALLOFF_SLOW, FALLOFF_MEDIUM, FALLOFF_FAST, FALLOFF_FASTEST
53 } FalloffSpeed;
54 
55 class SkinnedVis : public Widget
56 {
57 public:
58     SkinnedVis ();
59     void set_colors ();
60     void clear ();
61     void render (const unsigned char * data);
62 
63 private:
64     void draw (cairo_t * cr);
65 
66     uint32_t m_voice_color[256];
67     uint32_t m_voice_color_fire[256];
68     uint32_t m_voice_color_ice[256];
69     uint32_t m_pattern_fill[76 * 2];
70 
71     bool m_active, m_voiceprint_advance;
72     float m_data[75], m_peak[75], m_peak_speed[75];
73     unsigned char m_voiceprint_data[76 * 16];
74 };
75 
76 class SmallVis : public Widget
77 {
78 public:
79     SmallVis ();
80     void clear ();
81     void render (const unsigned char * data);
82 
83 private:
84     void draw (cairo_t * cr);
85 
86     bool m_active;
87     int m_data[75];
88 };
89 
90 #endif
91