root/trunk/libffado/src/libavc/audiosubunit/avc_function_block.h

Revision 864, 8.8 kB (checked in by ppalmers, 16 years ago)

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

Line 
1 /*
2  * Copyright (C) 2005-2008 by Daniel Wagner
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 AVCFUNCTIONBLOCK_H
25 #define AVCFUNCTIONBLOCK_H
26
27 #include "../general/avc_extended_cmd_generic.h"
28 #include "../general/avc_generic.h"
29
30 #include <libavc1394/avc1394.h>
31 #include <vector>
32 using namespace std;
33
34 namespace AVC {
35
36
37 class FunctionBlockFeatureVolume: public IBusData
38 {
39 public:
40     FunctionBlockFeatureVolume();
41     FunctionBlockFeatureVolume( const FunctionBlockFeatureVolume& rhs );
42     virtual ~FunctionBlockFeatureVolume();
43
44     virtual bool serialize( Util::Cmd::IOSSerialize& se );
45     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
46     virtual FunctionBlockFeatureVolume* clone() const;
47
48     control_data_length_t  m_controlDataLength;
49     u_int16_t              m_volume;
50 };
51
52 ///////////////////////////////////////////
53
54 class FunctionBlockProcessingMixer: public IBusData
55 {
56 public:
57     FunctionBlockProcessingMixer();
58     FunctionBlockProcessingMixer( const FunctionBlockProcessingMixer& rhs );
59     virtual ~FunctionBlockProcessingMixer();
60
61     virtual bool serialize( Util::Cmd::IOSSerialize& se );
62     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
63     virtual FunctionBlockProcessingMixer* clone() const;
64
65     control_selector_t m_controlSelector;
66 };
67
68 ///////////////////////////////////////////
69
70 /*
71  * The enhanced mixer feature function block is not
72  * working on all current BeBoB devices.  This code
73  * is there for not really tested or even working.
74  */
75 class FunctionBlockProcessingEnhancedMixer: public IBusData
76 {
77 public:
78     enum EStatusSelector {
79         eSS_ProgramableState = 0x00,
80         eSS_Level            = 0x01,
81     };
82
83     FunctionBlockProcessingEnhancedMixer();
84     FunctionBlockProcessingEnhancedMixer(
85         const FunctionBlockProcessingEnhancedMixer& rhs );
86     virtual ~FunctionBlockProcessingEnhancedMixer();
87
88     virtual bool serialize( Util::Cmd::IOSSerialize& se );
89     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
90     virtual FunctionBlockProcessingEnhancedMixer* clone() const;
91
92     control_selector_t        m_controlSelector;
93     status_selector_t         m_statusSelector;
94     control_data_ext_length_t m_controlDataLength;
95     vector<mixer_programmable_state_t> m_ProgramableStateData;
96     vector<mixer_level_t>              m_LevelData;
97 };
98
99 ///////////////////////////////////////////
100 ///////////////////////////////////////////
101
102 class FunctionBlockSelector: public IBusData
103 {
104 // untested
105 public:
106     // Control selector encoding
107     enum EControlSelectorEncoding {
108         eCSE_Selector_Unknown           = 0x00,
109         eCSE_Selector_Selector          = 0x01,
110     };
111
112     FunctionBlockSelector();
113     FunctionBlockSelector( const FunctionBlockSelector& rhs );
114     virtual ~FunctionBlockSelector();
115
116     virtual bool serialize( Util::Cmd::IOSSerialize& se );
117     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
118     virtual FunctionBlockSelector* clone() const;
119
120     selector_length_t      m_selectorLength;
121     input_fb_plug_number_t m_inputFbPlugNumber;
122     control_selector_t     m_controlSelector;
123 };
124
125 ///////////////////////////////////////////
126
127 class FunctionBlockFeature: public IBusData
128 {
129 // no complete implementation
130 public:
131     // Control selector encoding
132     enum EControlSelectorEncoding {
133         eCSE_Feature_Unknown            = 0x00,
134         eCSE_Feature_Mute               = 0x01,
135         eCSE_Feature_Volume             = 0x02,
136         eCSE_Feature_LRBalance          = 0x03,
137         eCSE_Feature_FRBalance          = 0x04,
138         eCSE_Feature_Bass               = 0x05,
139         eCSE_Feature_Mid                = 0x06,
140         eCSE_Feature_Treble             = 0x07,
141         eCSE_Feature_GEQ                = 0x08,
142         eCSE_Feature_AGC                = 0x09,
143         eCSE_Feature_Delay              = 0x0a,
144         eCSE_Feature_BassBoost          = 0x0b,
145         eCSE_Feature_Loudness           = 0x0c,
146     };
147
148     FunctionBlockFeature();
149     FunctionBlockFeature( const FunctionBlockFeature& rhs );
150     virtual ~FunctionBlockFeature();
151
152     virtual bool serialize( Util::Cmd::IOSSerialize& se );
153     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
154     virtual FunctionBlockFeature* clone() const;
155
156     selector_length_t           m_selectorLength;
157     audio_channel_number_t      m_audioChannelNumber;
158     control_selector_t          m_controlSelector;
159
160     FunctionBlockFeatureVolume*     m_pVolume;
161 };
162
163 ///////////////////////////////////////////
164
165 class FunctionBlockProcessing: public IBusData
166 {
167 // no complete implementation
168 public:
169     // Function block selector
170     enum EProcessingTypeEncoding {
171         ePTE_Mixer                      = 0x01,
172         ePTE_Generic                    = 0x02,
173         ePTE_UpDown                     = 0x03,
174         ePTE_DolbyProLogic              = 0x04,
175         ePTE_3dStereoExtender           = 0x05,
176         ePTE_Reverberation              = 0x06,
177         ePTE_Chorus                     = 0x07,
178         ePTE_DynamicRangeCompression    = 0x08,
179     };
180
181     // Control selector encoding
182     enum EControlSelectorEncoding {
183         eCSE_Processing_Unknown         = 0x00,
184         eCSE_Processing_Enable          = 0x01,
185         eCSE_Processing_Mode            = 0x02,
186         eCSE_Processing_Mixer           = 0x03,
187         eCSE_Processing_EnhancedMixer   = 0xf1,
188
189         // lots of definitions missing
190
191     };
192
193     FunctionBlockProcessing();
194     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
195     virtual ~FunctionBlockProcessing();
196
197     virtual bool serialize( Util::Cmd::IOSSerialize& se );
198     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
199     virtual FunctionBlockProcessing* clone() const;
200
201     selector_length_t             m_selectorLength;
202     input_fb_plug_number_t        m_fbInputPlugNumber;
203     input_audio_channel_number_t  m_inputAudioChannelNumber;
204     output_audio_channel_number_t m_outputAudioChannelNumber;
205
206     FunctionBlockProcessingMixer*         m_pMixer;
207     FunctionBlockProcessingEnhancedMixer* m_pEnhancedMixer;
208 };
209
210 ///////////////////////////////////////////
211
212 class FunctionBlockCodec: public IBusData
213 {
214 // dummy implementation
215 public:
216     // CODEC type endcoding
217     enum ECodecTypeEncoding {
218         eCTE_Unknown                    = 0x00,
219         eCTE_Ac3Decoder                 = 0x01,
220         eCTE_MpegDecoder                = 0x02,
221         eCTE_DtsDecoder                 = 0x03,
222     };
223
224     FunctionBlockCodec();
225     FunctionBlockCodec( const FunctionBlockCodec& rhs );
226     virtual ~FunctionBlockCodec();
227
228     virtual bool serialize( Util::Cmd::IOSSerialize& se );
229     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
230     virtual FunctionBlockCodec* clone() const;
231 };
232
233 ///////////////////////////////////////////
234 ///////////////////////////////////////////
235
236 #define AVC1394_FUNCTION_BLOCK_CMD 0xB8
237
238 class FunctionBlockCmd: public AVCCommand
239 {
240 public:
241     enum EFunctionBlockType {
242         eFBT_Selector   = 0x80,
243         eFBT_Feature    = 0x81,
244         eFBT_Processing = 0x82,
245         eFBT_Codec      = 0x83,
246     };
247
248     enum EControlAttribute {
249         eCA_Resolution = 0x01,
250         eCA_Minimum    = 0x02,
251         eCA_Maximum    = 0x03,
252         eCA_Default    = 0x04,
253         eCA_Duration   = 0x08,
254         eCA_Current    = 0x10,
255         eCA_Move       = 0x18,
256         eCA_Delta      = 0x19,
257     };
258
259     FunctionBlockCmd( Ieee1394Service& ieee1394service,
260                       EFunctionBlockType eType,
261                       function_block_id_t id,
262                       EControlAttribute eCtrlAttrib );
263     FunctionBlockCmd( const FunctionBlockCmd& rhs );
264     virtual ~FunctionBlockCmd();
265
266     virtual bool serialize( Util::Cmd::IOSSerialize& se );
267     virtual bool deserialize( Util::Cmd::IISDeserialize& de );
268     virtual FunctionBlockCmd* clone() const;
269
270     virtual const char* getCmdName() const
271         { return "FunctionBlockCmd"; }
272
273     function_block_type_t m_functionBlockType;
274     function_block_id_t   m_functionBlockId;
275     control_attribute_t   m_controlAttribute;
276
277     FunctionBlockSelector*      m_pFBSelector;
278     FunctionBlockFeature*       m_pFBFeature;
279     FunctionBlockProcessing*    m_pFBProcessing;
280     FunctionBlockCodec*         m_pFBCodec;
281 };
282
283 }
284
285 #endif
Note: See TracBrowser for help on using the browser.