root/branches/libffado-2.0/src/bebob/bebob_mixer.h

Revision 1321, 3.3 kB (checked in by wagi, 12 years ago)

Implement getMinimum and getMaximum for the generic mixer.
This makes the input volume fader working for the FA-101.

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 __FFAD0_BEBOB_MIXER__
25 #define __FFAD0_BEBOB_MIXER__
26
27 #include "src/debugmodule/debugmodule.h"
28
29 #include "libcontrol/BasicElements.h"
30
31 #include <vector>
32
33 namespace BeBoB {
34
35 class AvDevice;
36 class FunctionBlock;
37 class FunctionBlockFeature;
38 class FunctionBlockSelector;
39 class FunctionBlockEnhancedMixer;
40
41 class Mixer
42     : public Control::Container
43 {
44 public:
45     Mixer(AvDevice &d);
46     virtual ~Mixer();
47
48     virtual std::string getName()
49         { return "Mixer"; };
50     virtual bool setName( std::string n )
51         { return false; };
52
53     bool addElementForFunctionBlock(FunctionBlock& b);
54     bool addElementForAllFunctionBlocks();
55
56     // manipulation of the contained elements
57     bool addElement(Control::Element *)
58         {debugWarning("not allowed"); return false;};
59     bool deleteElement(Control::Element *);
60     bool clearElements();
61
62     AvDevice& getParent()
63         {return m_device;};
64
65 protected:
66     AvDevice&            m_device;
67 protected:
68     DECLARE_DEBUG_MODULE;
69 };
70
71 class MixerFBFeature
72     : public Control::Continuous
73 {
74 public:
75     MixerFBFeature(Mixer& parent, FunctionBlockFeature&);
76
77     virtual bool setValue(double v);
78     virtual double getValue();
79     virtual bool setValue(int idx, double v);
80     virtual double getValue(int idx);
81     virtual double getMinimum();
82     virtual double getMaximum();
83
84 private:
85     Mixer&                  m_Parent;
86     FunctionBlockFeature&   m_Slave;
87 };
88
89 class EnhancedMixerFBFeature
90     : public Control::Continuous
91 {
92 public:
93     EnhancedMixerFBFeature(Mixer& parent, FunctionBlockEnhancedMixer&);
94
95     virtual bool setValue(double v);
96     virtual double getValue();
97     virtual bool setValue(int idx, double v)
98         {return setValue(v);};
99     virtual double getValue(int idx)
100         {return getValue();};
101
102     virtual double getMinimum() {return -32768;};
103     virtual double getMaximum() {return 0;};
104
105 private:
106     Mixer&                      m_Parent;
107     FunctionBlockEnhancedMixer& m_Slave;
108 };
109
110 class MixerFBSelector
111     : public Control::Discrete
112 {
113 public:
114     MixerFBSelector(Mixer& parent, FunctionBlockSelector&);
115
116     virtual bool setValue(int v);
117     virtual int getValue();
118     virtual bool setValue(int idx, int v)
119         {return setValue(v);};
120     virtual int getValue(int idx)
121         {return getValue();};
122
123     virtual int getMinimum() {return 0;};
124     virtual int getMaximum() {return 0;};
125
126 private:
127     Mixer&                  m_Parent;
128     FunctionBlockSelector&  m_Slave;
129 };
130
131 } // end of namespace BeBoB
132
133 #endif /* __FFAD0_BEBOB_MIXER__ */
134
135
Note: See TracBrowser for help on using the browser.