root/branches/echoaudio/src/libavc/audiosubunit/avc_function_block.h

Revision 503, 8.5 kB (checked in by ppalmers, 17 years ago)

- put all libavc stuff into it's own name namespace (AVC)

Line 
1 /*
2  * Copyright (C) 2005-2007 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 library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License version 2.1, as published by the Free Software Foundation;
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21  * MA 02110-1301 USA
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( IOSSerialize& se );
45     virtual bool deserialize( 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( IOSSerialize& se );
62     virtual bool deserialize( IISDeserialize& de );
63     virtual FunctionBlockProcessingMixer* clone() const;
64
65     control_selector_t m_controlSelector;
66 };
67
68 ///////////////////////////////////////////
69
70 class FunctionBlockProcessingEnhancedMixer: public IBusData
71 {
72 public:
73     enum EStatusSelector {
74         eSS_ProgramableState = 0x00,
75         eSS_Level            = 0x01,
76     };
77
78     FunctionBlockProcessingEnhancedMixer();
79     FunctionBlockProcessingEnhancedMixer(
80         const FunctionBlockProcessingEnhancedMixer& rhs );
81     virtual ~FunctionBlockProcessingEnhancedMixer();
82
83     virtual bool serialize( IOSSerialize& se );
84     virtual bool deserialize( IISDeserialize& de );
85     virtual FunctionBlockProcessingEnhancedMixer* clone() const;
86
87     control_selector_t        m_controlSelector;
88     status_selector_t         m_statusSelector;
89     control_data_ext_length_t m_controlDataLength;
90     vector<mixer_programmable_state_t> m_ProgramableStateData;
91     vector<mixer_level_t>              m_LevelData;
92 };
93
94 ///////////////////////////////////////////
95 ///////////////////////////////////////////
96
97 class FunctionBlockSelector: public IBusData
98 {
99 // untested
100 public:
101     // Control selector encoding
102     enum EControlSelectorEncoding {
103         eCSE_Selector_Unknown           = 0x00,
104         eCSE_Selector_Selector          = 0x01,
105     };
106
107     FunctionBlockSelector();
108     FunctionBlockSelector( const FunctionBlockSelector& rhs );
109     virtual ~FunctionBlockSelector();
110
111     virtual bool serialize( IOSSerialize& se );
112     virtual bool deserialize( IISDeserialize& de );
113     virtual FunctionBlockSelector* clone() const;
114
115     selector_length_t      m_selectorLength;
116     input_fb_plug_number_t m_inputFbPlugNumber;
117     control_selector_t     m_controlSelector;
118 };
119
120 ///////////////////////////////////////////
121
122 class FunctionBlockFeature: public IBusData
123 {
124 // no complete implementation
125 public:
126     // Control selector encoding
127     enum EControlSelectorEncoding {
128         eCSE_Feature_Unknown            = 0x00,
129         eCSE_Feature_Mute               = 0x01,
130         eCSE_Feature_Volume             = 0x02,
131         eCSE_Feature_LRBalance          = 0x03,
132         eCSE_Feature_FRBalance          = 0x04,
133         eCSE_Feature_Bass               = 0x05,
134         eCSE_Feature_Mid                = 0x06,
135         eCSE_Feature_Treble             = 0x07,
136         eCSE_Feature_GEQ                = 0x08,
137         eCSE_Feature_AGC                = 0x09,
138         eCSE_Feature_Delay              = 0x0a,
139         eCSE_Feature_BassBoost          = 0x0b,
140         eCSE_Feature_Loudness           = 0x0c,
141     };
142
143     FunctionBlockFeature();
144     FunctionBlockFeature( const FunctionBlockFeature& rhs );
145     virtual ~FunctionBlockFeature();
146
147     virtual bool serialize( IOSSerialize& se );
148     virtual bool deserialize( IISDeserialize& de );
149     virtual FunctionBlockFeature* clone() const;
150
151     selector_length_t           m_selectorLength;
152     audio_channel_number_t      m_audioChannelNumber;
153     control_selector_t          m_controlSelector;
154
155     FunctionBlockFeatureVolume*     m_pVolume;
156 };
157
158 ///////////////////////////////////////////
159
160 class FunctionBlockProcessing: public IBusData
161 {
162 // no complete implementation
163 public:
164     // Function block selector
165     enum EProcessingTypeEncoding {
166         ePTE_Mixer                      = 0x01,
167         ePTE_Generic                    = 0x02,
168         ePTE_UpDown                     = 0x03,
169         ePTE_DolbyProLogic              = 0x04,
170         ePTE_3dStereoExtender           = 0x05,
171         ePTE_Reverberation              = 0x06,
172         ePTE_Chorus                     = 0x07,
173         ePTE_DynamicRangeCompression    = 0x08,
174     };
175
176     // Control selector encoding
177     enum EControlSelectorEncoding {
178         eCSE_Processing_Unknown         = 0x00,
179         eCSE_Processing_Enable          = 0x01,
180         eCSE_Processing_Mode            = 0x02,
181         eCSE_Processing_Mixer           = 0x03,
182         eCSE_Processing_EnhancedMixer   = 0xf1,
183
184         // lots of definitions missing
185
186     };
187
188     FunctionBlockProcessing();
189     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
190     virtual ~FunctionBlockProcessing();
191
192     virtual bool serialize( IOSSerialize& se );
193     virtual bool deserialize( IISDeserialize& de );
194     virtual FunctionBlockProcessing* clone() const;
195
196     selector_length_t             m_selectorLength;
197     input_fb_plug_number_t        m_fbInputPlugNumber;
198     input_audio_channel_number_t  m_inputAudioChannelNumber;
199     output_audio_channel_number_t m_outputAudioChannelNumber;
200
201     FunctionBlockProcessingMixer*         m_pMixer;
202     FunctionBlockProcessingEnhancedMixer* m_pEnhancedMixer;
203 };
204
205 ///////////////////////////////////////////
206
207 class FunctionBlockCodec: public IBusData
208 {
209 // dummy implementation
210 public:
211     // CODEC type endcoding
212     enum ECodecTypeEncoding {
213         eCTE_Unknown                    = 0x00,
214         eCTE_Ac3Decoder                 = 0x01,
215         eCTE_MpegDecoder                = 0x02,
216         eCTE_DtsDecoder                 = 0x03,
217     };
218
219     FunctionBlockCodec();
220     FunctionBlockCodec( const FunctionBlockCodec& rhs );
221     virtual ~FunctionBlockCodec();
222
223     virtual bool serialize( IOSSerialize& se );
224     virtual bool deserialize( IISDeserialize& de );
225     virtual FunctionBlockCodec* clone() const;
226 };
227
228 ///////////////////////////////////////////
229 ///////////////////////////////////////////
230
231 #define AVC1394_FUNCTION_BLOCK_CMD 0xB8
232
233 class FunctionBlockCmd: public AVCCommand
234 {
235 public:
236     enum EFunctionBlockType {
237         eFBT_Selector   = 0x80,
238         eFBT_Feature    = 0x81,
239         eFBT_Processing = 0x82,
240         eFBT_Codec      = 0x83,
241     };
242
243     enum EControlAttribute {
244         eCA_Resolution = 0x01,
245         eCA_Minimum    = 0x02,
246         eCA_Maximum    = 0x03,
247         eCA_Default    = 0x04,
248         eCA_Duration   = 0x08,
249         eCA_Current    = 0x10,
250         eCA_Move       = 0x18,
251         eCA_Delta      = 0x19,
252     };
253
254     FunctionBlockCmd( Ieee1394Service& ieee1394service,
255                       EFunctionBlockType eType,
256                       function_block_id_t id,
257                       EControlAttribute eCtrlAttrib );
258     FunctionBlockCmd( const FunctionBlockCmd& rhs );
259     virtual ~FunctionBlockCmd();
260
261     virtual bool serialize( IOSSerialize& se );
262     virtual bool deserialize( IISDeserialize& de );
263     virtual FunctionBlockCmd* clone() const;
264
265     virtual const char* getCmdName() const
266         { return "FunctionBlockCmd"; }
267
268     function_block_type_t m_functionBlockType;
269     function_block_id_t   m_functionBlockId;
270     control_attribute_t   m_controlAttribute;
271
272     FunctionBlockSelector*      m_pFBSelector;
273     FunctionBlockFeature*       m_pFBFeature;
274     FunctionBlockProcessing*    m_pFBProcessing;
275     FunctionBlockCodec*         m_pFBCodec;
276 };
277
278 }
279
280 #endif
Note: See TracBrowser for help on using the browser.