root/trunk/libffado/src/libcontrol/BasicElements.h

Revision 973, 3.6 kB (checked in by ppalmers, 16 years ago)

make quatafire mixer more useful

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #ifndef CONTROL_BASICELEMENTS_H
25 #define CONTROL_BASICELEMENTS_H
26
27 #include "debugmodule/debugmodule.h"
28
29 #include <vector>
30 #include <string>
31
32 #include "Element.h"
33
34 namespace Control {
35
36 /*!
37 @brief Base class for contignous control elements
38 */
39 class Continuous
40 : public Element
41 {
42 public:
43     Continuous();
44     Continuous(std::string n);
45     virtual ~Continuous() {};
46    
47     virtual bool setValue(double v);
48     virtual double getValue();
49     virtual bool setValue(int idx, double v);
50     virtual double getValue(int idx);
51
52     virtual void show();
53
54 private:
55     double m_Value;
56 };
57
58 /*!
59 @brief Base class for discrete control elements
60 */
61 class Discrete
62 : public Element
63 {
64 public:
65     Discrete();
66     Discrete(std::string n);
67     virtual ~Discrete() {};
68    
69     virtual bool setValue(int v);
70     virtual int getValue();
71     virtual bool setValue(int idx, int v);
72     virtual int getValue(int idx);
73
74     virtual void show();
75
76 private:
77     int m_Value;
78 };
79
80 /*!
81 @brief Base class for textual control elements
82 */
83 class Text
84 : public Element
85 {
86 public:
87     Text();
88     Text(std::string n);
89     virtual ~Text() {};
90
91     virtual bool setValue(std::string v);
92     virtual std::string getValue();
93
94     virtual void show();
95
96 private:
97     std::string m_Value;
98 };
99
100 /*!
101 @brief Base class for register access control elements
102 */
103 class Register
104 : public Element
105 {
106 public:
107     Register() : Element() {};
108     Register(std::string n) : Element(n) {};
109     virtual ~Register() {};
110
111     virtual bool setValue(uint64_t addr, uint64_t value) = 0;
112     virtual uint64_t getValue(uint64_t addr) = 0;
113 private:
114 };
115
116 /*!
117 @brief Base class for basic enumerated control elements
118 */
119 class Enum
120 : public Element
121 {
122 public:
123     Enum();
124     Enum(std::string n);
125     virtual ~Enum() {};
126
127     virtual bool select(int idx);
128     virtual int selected();
129     virtual int count();
130     virtual std::string getEnumLabel(int idx);
131
132     virtual void show();
133 //private: // HACK
134     int m_selected;
135 };
136
137 /*!
138 @brief Base class for attribute enumerated control elements
139
140 The idea of this is that one can have a set of config values
141 available for a certain enum choice.
142
143 Example: for clock source selection:
144 idx Label     signal  locked  available
145   0 WordClock   0       0        1
146   1 S/PDIF      1       0        1
147   ...
148
149 Attributes:
150  0 signal
151  1 locked
152  2 available
153
154 */
155 class AttributeEnum
156 : public Enum
157 {
158 public:
159     AttributeEnum();
160     AttributeEnum(std::string n);
161     virtual ~AttributeEnum() {};
162
163     virtual int attributeCount();
164     ///> get a specific attribute value for the selected enum
165     virtual std::string getAttributeValue(int attridx);
166     ///> get the name of the attribute with a certain index
167     virtual std::string getAttributeName(int attridx);
168
169     virtual void show();
170 private:
171 };
172
173 }; // namespace Control
174
175 #endif // CONTROL_BASICELEMENTS_H
Note: See TracBrowser for help on using the browser.