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

Revision 1498, 9.3 kB (checked in by ppalmers, 11 years ago)

Merge all changes from 2.0 branch into trunk (since r1361). This _should_ contain all forward merges done in the mean time. At this moment in time both branches should be in sync.

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