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

Revision 445, 8.4 kB (checked in by pieterpalmers, 17 years ago)

* name change from FreeBoB to FFADO
* replaced tabs by 4 spaces
* got rid of end-of-line spaces
* made all license and copyrights conform

library becomes LGPL, apps become GPL
explicitly state LGPL v2.1 and GPL v2 (don't like v3 draft)

copyrights are 2005-2007 Daniel & Pieter
except for the MotU stuff (C) Jonathan, Pieter

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