1 |
#!/usr/bin/python |
---|
2 |
# |
---|
3 |
# Copyright (C) 2005-2009 by Pieter Palmers |
---|
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 program is free software: you can redistribute it and/or modify |
---|
11 |
# it under the terms of the GNU General Public License as published by |
---|
12 |
# the Free Software Foundation, either version 3 of the License, or |
---|
13 |
# (at your option) any later version. |
---|
14 |
# |
---|
15 |
# This program is distributed in the hope that it will be useful, |
---|
16 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 |
# GNU General Public License for more details. |
---|
19 |
# |
---|
20 |
# You should have received a copy of the GNU General Public License |
---|
21 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
22 |
# |
---|
23 |
|
---|
24 |
import dbus |
---|
25 |
|
---|
26 |
GUID = "00130e0401400045" |
---|
27 |
|
---|
28 |
servername = "org.ffado.Control" |
---|
29 |
path = "/org/ffado/Control/DeviceManager/%s/EAP/" % GUID |
---|
30 |
bus = dbus.SessionBus() |
---|
31 |
|
---|
32 |
router = dbus.Interface(bus.get_object(servername, path+"Router"), |
---|
33 |
dbus_interface='org.ffado.Control.Element.CrossbarRouter') |
---|
34 |
mixer = dbus.Interface(bus.get_object(servername, path+"MatrixMixer"), |
---|
35 |
dbus_interface='org.ffado.Control.Element.MatrixMixer') |
---|
36 |
|
---|
37 |
# mute the mixer |
---|
38 |
#nbinputs = mixer.getRowCount() |
---|
39 |
#nboutputs = mixer.getColCount() |
---|
40 |
|
---|
41 |
#print( nbinputs ) |
---|
42 |
#print( nboutputs ) |
---|
43 |
|
---|
44 |
#for i in range(nbinputs): |
---|
45 |
#for o in range(nboutputs): |
---|
46 |
#mixer.setValue(i, o, 0) |
---|
47 |
|
---|
48 |
## reconfigure the router |
---|
49 |
#def reroute(src, dsts): |
---|
50 |
#srcidx = router.getSourceIndex(src) |
---|
51 |
#for dst in dsts: |
---|
52 |
#print( dst ) |
---|
53 |
#dstidx = router.getDestinationIndex(dst) |
---|
54 |
|
---|
55 |
#sourceidx = 0 |
---|
56 |
## disconnect |
---|
57 |
#while sourceidx >= 0: |
---|
58 |
#sourceidx = router.getSourceForDestination(dstidx) |
---|
59 |
#router.setConnectionState(sourceidx, dstidx, 0) |
---|
60 |
|
---|
61 |
## connect |
---|
62 |
#if router.canConnect(srcidx, dstidx): |
---|
63 |
#print( router.getConnectionState(srcidx, dstidx) ) |
---|
64 |
#print( router.setConnectionState(srcidx, dstidx, 1) ) |
---|
65 |
|
---|
66 |
#reroute("InS1:02", ["InS0:00", "InS1:00", "InS1:02", "InS1:04", "InS1:06"]) |
---|
67 |
#reroute("InS1:03", ["InS0:01", "InS1:01", "InS1:03", "InS1:05", "InS1:07"]) |
---|
68 |
|
---|
69 |
tst = router.getConnectionMap() |
---|
70 |
|
---|
71 |
nb_sources = router.getNbSources() |
---|
72 |
nb_destinations = router.getNbDestinations() |
---|
73 |
|
---|
74 |
source_names = router.getSourceNames() |
---|
75 |
destination_names = router.getDestinationNames() |
---|
76 |
|
---|
77 |
|
---|
78 |
srcnames_formatted = ["%10s" % s for s in source_names] |
---|
79 |
s = "" |
---|
80 |
for i in range(10): |
---|
81 |
s += " |" |
---|
82 |
for src in range(nb_sources): |
---|
83 |
name = srcnames_formatted[src] |
---|
84 |
char = name[i] |
---|
85 |
s += " %s" % char |
---|
86 |
s += "\n" |
---|
87 |
|
---|
88 |
s += "-----------+" |
---|
89 |
for src in range(nb_sources): |
---|
90 |
s += "--" |
---|
91 |
s += "\n" |
---|
92 |
|
---|
93 |
for dst in range(nb_destinations): |
---|
94 |
s += "%10s |" % destination_names[dst] |
---|
95 |
for src in range(nb_sources): |
---|
96 |
idx = dst * nb_sources + src |
---|
97 |
s += " %d" % tst[idx] |
---|
98 |
s += "\n" |
---|
99 |
|
---|
100 |
print( s ) |
---|