root/branches/echoaudio/src/libavc/general/avc_subunit.h

Revision 524, 3.3 kB (checked in by ppalmers, 17 years ago)

echo discovery works, audio I/O works, still some issues with midi and channel naming

Line 
1 /*
2  * Copyright (C)      2007 by Pieter Palmers
3  * Copyright (C) 2005-2007 by Daniel Wagner
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License version 2.1, as published by the Free Software Foundation;
13  *
14  * This library 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 GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
22  * MA 02110-1301 USA
23  */
24
25 #ifndef AVC_SUBUNIT_H
26 #define AVC_SUBUNIT_H
27
28 #include "debugmodule/debugmodule.h"
29
30 #include "../avc_definitions.h"
31 #include "../general/avc_plug.h"
32 #include "../general/avc_extended_subunit_info.h"
33 #include "../general/avc_generic.h"
34 #include "../audiosubunit/avc_function_block.h"
35
36 #include <vector>
37
38 #warning merge with bebob functionblock
39 #include "bebob/bebob_functionblock.h"
40
41 namespace AVC {
42
43 class Unit;
44
45 class Subunit {
46  public:
47     Subunit( Unit& avDevice,
48              ESubunitType type,
49              subunit_t id );
50     virtual ~Subunit();
51
52     virtual bool discover();
53     virtual bool discoverConnections();
54     virtual const char* getName() = 0;
55
56     subunit_t getSubunitId()
57     { return m_sbId; }
58     ESubunitType getSubunitType()
59     { return m_sbType; }
60
61     Unit& getUnit() const
62         { return *m_unit; }
63     Subunit& getSubunit()
64         { return *this; }
65
66     virtual Plug *createPlug( AVC::Unit* unit,
67                               AVC::Subunit* subunit,
68                               AVC::function_block_type_t functionBlockType,
69                               AVC::function_block_type_t functionBlockId,
70                               AVC::Plug::EPlugAddressType plugAddressType,
71                               AVC::Plug::EPlugDirection plugDirection,
72                               AVC::plug_id_t plugId );
73
74     bool addPlug( Plug& plug );
75     virtual bool initPlugFromDescriptor( Plug& plug );
76
77     PlugVector& getPlugs()
78     { return m_plugs; }
79     Plug* getPlug(Plug::EPlugDirection direction, plug_id_t plugId);
80
81     virtual void setVerboseLevel(int l)
82         { setDebugLevel(l);};
83
84     bool serialize( Glib::ustring basePath, Util::IOSerialize& ser ) const;
85     static Subunit* deserialize( Glib::ustring basePath,
86                      Util::IODeserialize& deser, Unit& avDevice );
87  protected:
88     Subunit();
89
90     virtual bool serializeChild( Glib::ustring basePath,
91                                  Util::IOSerialize& ser ) const = 0;
92     virtual bool deserializeChild( Glib::ustring basePath,
93                                    Util::IODeserialize& deser,
94                                    Unit& avDevice ) = 0;
95     bool discoverPlugs();
96     bool discoverPlugs(Plug::EPlugDirection plugDirection,
97                        AVC::plug_id_t plugMaxId );
98
99  protected:
100     Unit*           m_unit;
101     ESubunitType    m_sbType;
102     subunit_t       m_sbId;
103
104     PlugVector      m_plugs;
105
106     DECLARE_DEBUG_MODULE;
107 };
108
109 typedef std::vector<Subunit*> SubunitVector;
110
111 }
112
113 #endif
Note: See TracBrowser for help on using the browser.