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

Revision 1653, 3.1 kB (checked in by arnonym, 12 years ago)

Implement getting a simple list of all current peaks.

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     virtual std::string getSourceName(const int) = 0;
62     virtual std::string getDestinationName(const int) = 0;
63     virtual int getSourceIndex(std::string) = 0;
64     virtual int getDestinationIndex(std::string) = 0;
65
66     virtual NameVector getSourceNames() = 0;
67     virtual NameVector getDestinationNames() = 0;
68
69     virtual IntVector getDestinationsForSource(const int) = 0;
70     virtual int getSourceForDestination(const int) = 0;
71
72     virtual bool canConnect(const int source, const int dest) = 0;
73     virtual bool setConnectionState(const int source, const int dest, const bool enable) = 0;
74     virtual bool getConnectionState(const int source, const int dest) = 0;
75
76     virtual bool canConnect(std::string, std::string) = 0;
77     virtual bool setConnectionState(std::string, std::string, const bool enable) = 0;
78     virtual bool getConnectionState(std::string, std::string) = 0;
79
80     virtual bool clearAllConnections() = 0;
81
82     virtual int getNbSources() = 0;
83     virtual int getNbDestinations() = 0;
84
85     // functions to access the entire routing map at once
86     // idea is that the row/col nodes that are 1 get a routing entry
87     virtual bool getConnectionMap(int *) = 0;
88     virtual bool setConnectionMap(int *) = 0;
89
90     // peak metering
91     virtual bool hasPeakMetering() = 0;
92     virtual double getPeakValue(const int source, const int dest) = 0;
93     virtual bool getPeakValues(double &) = 0;
94     virtual PeakValues getPeakValues() = 0;
95
96 protected:
97
98 };
99
100
101 }; // namespace Control
102
103 #endif // CONTROL_CROSSBAR_ROUTER_H
Note: See TracBrowser for help on using the browser.