root/trunk/libffado/src/libcontrol/CrossbarRouter.h

Revision 1655, 3.3 kB (checked in by arnonym, 12 years ago)

Thinking about getting structured info about the router-channels.

Line 
1 /*
2  * Copyright (C) 2005-2009 by Pieter Palmers
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 CONTROL_CROSSBAR_ROUTER_H
25 #define CONTROL_CROSSBAR_ROUTER_H
26
27 #include "debugmodule/debugmodule.h"
28
29 #include "Element.h"
30
31 #include <vector>
32 #include <string>
33
34 namespace Control {
35
36 /*!
37 @brief Abstract Base class for Crossbar router elements
38
39 */
40 class CrossbarRouter : public Element
41 {
42 public:
43     CrossbarRouter(Element *p) : Element(p) {};
44     CrossbarRouter(Element *p, std::string n) : Element(p, n) {};
45     virtual ~CrossbarRouter() {};
46
47     virtual void show() = 0;
48
49     typedef std::vector<std::string> NameVector;
50     typedef std::vector<std::string>::iterator NameVectorIterator;
51     typedef std::vector<int> IntVector;
52     typedef std::vector<int>::iterator IntVectorIterator;
53
54     struct PeakValue
55     {
56         int destination;
57         double peakvalue;
58     };
59     typedef std::vector<PeakValue> PeakValues;
60
61     struct Group
62     {
63         std::string name;
64         int nbchannels;
65     };
66     typedef std::vector<Group> Groups;
67
68     virtual std::string getSourceName(const int) = 0;
69     virtual std::string getDestinationName(const int) = 0;
70     virtual int getSourceIndex(std::string) = 0;
71     virtual int getDestinationIndex(std::string) = 0;
72
73     virtual NameVector getSourceNames() = 0;
74     virtual NameVector getDestinationNames() = 0;
75
76     virtual Groups getSources() = 0;
77     virtual Groups getDestinations() = 0;
78
79     virtual IntVector getDestinationsForSource(const int) = 0;
80     virtual int getSourceForDestination(const int) = 0;
81
82     virtual bool canConnect(const int source, const int dest) = 0;
83     virtual bool setConnectionState(const int source, const int dest, const bool enable) = 0;
84     virtual bool getConnectionState(const int source, const int dest) = 0;
85
86     virtual bool canConnect(std::string, std::string) = 0;
87     virtual bool setConnectionState(std::string, std::string, const bool enable) = 0;
88     virtual bool getConnectionState(std::string, std::string) = 0;
89
90     virtual bool clearAllConnections() = 0;
91
92     virtual int getNbSources() = 0;
93     virtual int getNbDestinations() = 0;
94
95     // functions to access the entire routing map at once
96     // idea is that the row/col nodes that are 1 get a routing entry
97     virtual bool getConnectionMap(int *) = 0;
98     virtual bool setConnectionMap(int *) = 0;
99
100     // peak metering
101     virtual bool hasPeakMetering() = 0;
102     virtual double getPeakValue(const int source, const int dest) = 0;
103     virtual bool getPeakValues(double &) = 0;
104     virtual PeakValues getPeakValues() = 0;
105
106 protected:
107
108 };
109
110
111 }; // namespace Control
112
113 #endif // CONTROL_CROSSBAR_ROUTER_H
Note: See TracBrowser for help on using the browser.