root/trunk/libffado/src/bebob/bebob_functionblock.h

Revision 451, 7.5 kB (checked in by ppalmers, 15 years ago)

- First attempt at a OSC controlled mixer. The level of

abstraction is very low, meaning that you have to know
how the function blocks work. It however allows control
applications to be written and to experiment with them.

- This version only does Selector function blocks.

The following message switches the phase88 input to the

  • front (or is is back?)
    /devicemanager/dev0/GenericMixer set selector 10 0
  • back (or is it front?)
    /devicemanager/dev0/GenericMixer set selector 10 1

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 BEBOB_FUNCTION_BLOCK_H
25 #define BEBOB_FUNCTION_BLOCK_H
26
27 #include "bebob/bebob_avplug.h"
28
29 #include "libavc/avc_definitions.h"
30 #include "debugmodule/debugmodule.h"
31
32 namespace BeBoB {
33
34 class AvDeviceSubunit;
35
36 class FunctionBlock {
37 public:
38     enum EFunctionBlockType {
39         eFBT_AllFunctionBlockType   = 0xff,
40         eFBT_AudioSubunitSelector   = 0x80,
41         eFBT_AudioSubunitFeature    = 0x81,
42         eFBT_AudioSubunitProcessing = 0x82,
43         eFBT_AudioSubunitCodec      = 0x83,
44     };
45
46     enum ESpecialPurpose {
47         eSP_InputGain,
48         eSP_OutputVolume,
49         eSP_NoSpecialPurpose
50     };
51
52     FunctionBlock( AvDeviceSubunit& subunit,
53            function_block_type_t type,
54                    function_block_type_t subtype,
55                    function_block_id_t id,
56                    ESpecialPurpose purpose,
57                    no_of_input_plugs_t nrOfInputPlugs,
58                    no_of_output_plugs_t nrOfOutputPlugs,
59                    int verbose );
60     FunctionBlock( const FunctionBlock& rhs );
61     FunctionBlock();
62     virtual ~FunctionBlock();
63
64     virtual bool discover();
65     virtual bool discoverConnections();
66
67     virtual const char* getName() = 0;
68    
69     function_block_type_t getType() {return m_type;};
70     function_block_type_t getSubtype() {return m_subtype;};
71     function_block_id_t getId() {return m_id;};
72
73     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
74     static FunctionBlock* deserialize( Glib::ustring basePath,
75                        Util::IODeserialize& deser,
76                        AvDevice& avDevice,
77                                        AvDeviceSubunit& subunit);
78 protected:
79     bool discoverPlugs( AvPlug::EAvPlugDirection plugDirection,
80                         plug_id_t plugMaxId );
81
82 protected:
83     AvDeviceSubunit*      m_subunit;
84     function_block_type_t m_type;
85     function_block_type_t m_subtype;
86     function_block_id_t   m_id;
87     ESpecialPurpose       m_purpose;
88     no_of_input_plugs_t   m_nrOfInputPlugs;
89     no_of_output_plugs_t  m_nrOfOutputPlugs;
90     int                   m_verbose;
91     AvPlugVector          m_plugs;
92
93     DECLARE_DEBUG_MODULE;
94 };
95
96 typedef std::vector<FunctionBlock*> FunctionBlockVector;
97
98 /////////////////////////////////////
99 /////////////////////////////////////
100
101 class FunctionBlockSelector: public FunctionBlock
102 {
103 public:
104     FunctionBlockSelector(AvDeviceSubunit& subunit,
105                           function_block_id_t id,
106                           ESpecialPurpose purpose,
107                           no_of_input_plugs_t nrOfInputPlugs,
108                           no_of_output_plugs_t nrOfOutputPlugs,
109                           int verbose);
110     FunctionBlockSelector( const FunctionBlockSelector& rhs );
111     FunctionBlockSelector();
112     virtual ~FunctionBlockSelector();
113
114     virtual const char* getName();
115
116 protected:
117     virtual bool serializeChild( Glib::ustring basePath,
118                                  Util::IOSerialize& ser ) const;
119     virtual bool deserializeChild( Glib::ustring basePath,
120                                    Util::IODeserialize& deser,
121                                    AvDevice& avDevice );
122 };
123
124 /////////////////////////////////////
125
126 class FunctionBlockFeature: public FunctionBlock
127 {
128 public:
129     FunctionBlockFeature(AvDeviceSubunit& subunit,
130                          function_block_id_t id,
131                          ESpecialPurpose purpose,
132                          no_of_input_plugs_t nrOfInputPlugs,
133                          no_of_output_plugs_t nrOfOutputPlugs,
134                          int verbose);
135     FunctionBlockFeature( const FunctionBlockFeature& rhs );
136     FunctionBlockFeature();
137     virtual ~FunctionBlockFeature();
138
139     virtual const char* getName();
140
141 protected:
142     virtual bool serializeChild( Glib::ustring basePath,
143                                  Util::IOSerialize& ser ) const;
144     virtual bool deserializeChild( Glib::ustring basePath,
145                                    Util::IODeserialize& deser,
146                                    AvDevice& avDevice );
147 };
148
149 /////////////////////////////////////
150
151 class FunctionBlockEnhancedMixer: public FunctionBlock
152 {
153 public:
154     FunctionBlockEnhancedMixer( AvDeviceSubunit& subunit,
155                                 function_block_id_t id,
156                                 ESpecialPurpose purpose,
157                                 no_of_input_plugs_t nrOfInputPlugs,
158                                 no_of_output_plugs_t nrOfOutputPlugs,
159                                 int verbose );
160     FunctionBlockEnhancedMixer();
161     FunctionBlockEnhancedMixer( const FunctionBlockEnhancedMixer& rhs );
162     virtual ~FunctionBlockEnhancedMixer();
163
164     virtual const char* getName();
165
166 protected:
167     virtual bool serializeChild( Glib::ustring basePath,
168                                  Util::IOSerialize& ser ) const;
169     virtual bool deserializeChild( Glib::ustring basePath,
170                                    Util::IODeserialize& deser,
171                                    AvDevice& avDevice );
172 };
173
174 /////////////////////////////////////
175
176 class FunctionBlockProcessing: public FunctionBlock
177 {
178 public:
179     FunctionBlockProcessing( AvDeviceSubunit& subunit,
180                              function_block_id_t id,
181                              ESpecialPurpose purpose,
182                              no_of_input_plugs_t nrOfInputPlugs,
183                              no_of_output_plugs_t nrOfOutputPlugs,
184                              int verbose );
185     FunctionBlockProcessing( const FunctionBlockProcessing& rhs );
186     FunctionBlockProcessing();
187     virtual ~FunctionBlockProcessing();
188
189     virtual const char* getName();
190
191 protected:
192     virtual bool serializeChild( Glib::ustring basePath,
193                                  Util::IOSerialize& ser ) const;
194     virtual bool deserializeChild( Glib::ustring basePath,
195                                    Util::IODeserialize& deser,
196                                    AvDevice& avDevice );
197 };
198
199 /////////////////////////////////////
200
201 class FunctionBlockCodec: public FunctionBlock
202 {
203 public:
204     FunctionBlockCodec(AvDeviceSubunit& subunit,
205                        function_block_id_t id,
206                        ESpecialPurpose purpose,
207                        no_of_input_plugs_t nrOfInputPlugs,
208                        no_of_output_plugs_t nrOfOutputPlugs,
209                        int verbose);
210     FunctionBlockCodec( const FunctionBlockCodec& rhs );
211     FunctionBlockCodec();
212     virtual ~FunctionBlockCodec();
213
214     virtual const char* getName();
215
216 protected:
217     virtual bool serializeChild( Glib::ustring basePath,
218                                  Util::IOSerialize& ser ) const;
219     virtual bool deserializeChild( Glib::ustring basePath,
220                                    Util::IODeserialize& deser,
221                                    AvDevice& avDevice );
222 };
223
224 }
225
226 #endif
Note: See TracBrowser for help on using the browser.