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

Revision 1338, 3.9 kB (checked in by wagi, 12 years ago)

- Add AV/C command for LRBalance feature function block
- Expose for each found feature function block one level feature

function mixer element and one left right balance feature
function mixer element.

- Add 'Volume' or 'LRBalance' as dbus

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     template<typename FBType, typename MixerType> bool addElementForFunctionBlock(FBType& 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 MixerFBFeatureVolume
72     : public Control::Continuous
73 {
74 public:
75     MixerFBFeatureVolume(Mixer& parent, FunctionBlockFeature&);
76     virtual ~MixerFBFeatureVolume();
77
78     virtual bool setValue(double v);
79     virtual double getValue();
80     virtual bool setValue(int idx, double v);
81     virtual double getValue(int idx);
82     virtual double getMinimum();
83     virtual double getMaximum();
84
85 private:
86     Mixer&                  m_Parent;
87     FunctionBlockFeature&   m_Slave;
88 };
89
90 class MixerFBFeatureLRBalance
91     : public Control::Continuous
92 {
93 public:
94     MixerFBFeatureLRBalance(Mixer& parent, FunctionBlockFeature&);
95     virtual ~MixerFBFeatureLRBalance();
96
97     virtual bool setValue(double v);
98     virtual double getValue();
99     virtual bool setValue(int idx, double v);
100     virtual double getValue(int idx);
101     virtual double getMinimum();
102     virtual double getMaximum();
103
104 private:
105     Mixer&                  m_Parent;
106     FunctionBlockFeature&   m_Slave;
107 };
108
109 class EnhancedMixerFBFeature
110     : public Control::Continuous
111 {
112 public:
113     EnhancedMixerFBFeature(Mixer& parent, FunctionBlockEnhancedMixer&);
114     virtual ~EnhancedMixerFBFeature();
115
116     virtual bool setValue(double v);
117     virtual double getValue();
118     virtual bool setValue(int idx, double v)
119         {return setValue(v);};
120     virtual double getValue(int idx)
121         {return getValue();};
122
123     virtual double getMinimum() {return -32768;};
124     virtual double getMaximum() {return 0;};
125
126 private:
127     Mixer&                      m_Parent;
128     FunctionBlockEnhancedMixer& m_Slave;
129 };
130
131 class MixerFBSelector
132     : public Control::Discrete
133 {
134 public:
135     MixerFBSelector(Mixer& parent, FunctionBlockSelector&);
136     virtual ~MixerFBSelector();
137
138     virtual bool setValue(int v);
139     virtual int getValue();
140     virtual bool setValue(int idx, int v)
141         {return setValue(v);};
142     virtual int getValue(int idx)
143         {return getValue();};
144
145     virtual int getMinimum() {return 0;};
146     virtual int getMaximum() {return 0;};
147
148 private:
149     Mixer&                  m_Parent;
150     FunctionBlockSelector&  m_Slave;
151 };
152
153 } // end of namespace BeBoB
154
155 #endif /* __FFAD0_BEBOB_MIXER__ */
156
157
Note: See TracBrowser for help on using the browser.