Changeset 1776
- Timestamp:
- 01/02/10 15:07:26 (14 years ago)
- Files:
-
- trunk/libffado/src/dice/dice_eap.cpp (modified) (23 diffs)
- trunk/libffado/src/dice/dice_eap.h (modified) (5 diffs)
- trunk/libffado/src/dice/focusrite/saffire_pro24.cpp (modified) (1 diff)
- trunk/libffado/src/libcontrol/CrossbarRouter.h (modified) (3 diffs)
- trunk/libffado/support/dbus/control-interface.xml (modified) (2 diffs)
- trunk/libffado/support/dbus/controlserver.cpp (modified) (10 diffs)
- trunk/libffado/support/dbus/controlserver.h (modified) (1 diff)
- trunk/libffado/support/mixer-qt4/ffado/widgets/crossbarrouter.py (modified) (5 diffs)
- trunk/libffado/tests/test-dice-eap.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/libffado/src/dice/dice_eap.cpp
r1772 r1776 219 219 case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 220 220 // second audio port (unique to the junior) 221 addSource("InS1", eRS_InS1, 0, 8);221 addSource("InS1", 0, 8, eRS_InS1); 222 222 case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 223 223 /// these are common to the mini and junior 224 224 // the AES receiver 225 addSource("AES", eRS_AES, 0, 8);225 addSource("AES", 0, 8, eRS_AES); 226 226 // the ADAT receiver 227 addSource("ADAT", eRS_ADAT, 0, 8);227 addSource("ADAT", 0, 8, eRS_ADAT); 228 228 // the Mixer outputs 229 addSource("MixerOut", eRS_Mixer, 0, 16);229 addSource("MixerOut", 0, 16, eRS_Mixer); 230 230 // the first audio port 231 addSource("InS0", eRS_InS0, 0, 8);231 addSource("InS0", 0, 8, eRS_InS0); 232 232 // the ARM audio port 233 addSource("ARM", eRS_ARM, 0, 8);233 addSource("ARM", 0, 8, eRS_ARM); 234 234 // the 1394 stream receivers 235 addSource("1394_0", eRS_ARX0, 0, 16);236 addSource("1394_1", eRS_ARX1, 0, 16);235 addSource("1394_0", 0, 16, eRS_ARX0); 236 addSource("1394_1", 0, 16, eRS_ARX1); 237 237 // mute 238 addSource("Mute", eRS_Muted, 0, 1);238 addSource("Mute", 0, 1, eRS_Muted); 239 239 break; 240 240 default: … … 253 253 case DICE_EAP_CAP_GENERAL_CHIP_DICEJR: 254 254 // second audio port (unique to the junior) 255 addDestination("InS1", eRD_InS1, 0, 8);255 addDestination("InS1", 0, 8, eRD_InS1); 256 256 case DICE_EAP_CAP_GENERAL_CHIP_DICEMINI: 257 257 /// these are common to the mini and junior 258 258 // the AES receiver 259 addDestination("AES", eRD_AES, 0, 8);259 addDestination("AES", 0, 8, eRD_AES); 260 260 // the ADAT receiver 261 addDestination("ADAT", eRD_ADAT, 0, 8);261 addDestination("ADAT", 0, 8, eRD_ADAT); 262 262 // the Mixer outputs 263 addDestination("MixerIn", eRD_Mixer0, 0, 16);264 addDestination("MixerIn", eRD_Mixer1, 16, 2);263 addDestination("MixerIn", 0, 16, eRD_Mixer0); 264 addDestination("MixerIn", 0, 2, eRD_Mixer1, 16); 265 265 // the first audio port 266 addDestination("InS0", eRD_InS0, 0, 8);266 addDestination("InS0", 0, 8, eRD_InS0); 267 267 // the ARM audio port 268 addDestination("ARM", eRD_ARM, 0, 8);268 addDestination("ARM", 0, 8, eRD_ARM); 269 269 // the 1394 stream receivers 270 addDestination("1394_0", eRD_ATX0, 0, 16);271 addDestination("1394_1", eRD_ATX1, 0, 16);270 addDestination("1394_0", 0, 16, eRD_ATX0); 271 addDestination("1394_1", 0, 16, eRD_ATX1); 272 272 // mute 273 addDestination("Mute", eRD_Muted, 0, 1);273 addDestination("Mute", 0, 1, eRD_Muted); 274 274 break; 275 275 default: … … 280 280 281 281 void 282 EAP::addSource( const std::string name, enum eRouteSource srcid, unsigned int base, unsigned int count ) { 283 m_router->setupSourcesAddSource(name.c_str(), srcid, base, count); 282 EAP::addSource(const std::string name, unsigned int base, unsigned int count, 283 enum eRouteSource srcid, unsigned int offset) 284 { 285 m_router->addSource(name, srcid, base, count, offset); 284 286 } 285 287 void 286 EAP::addDestination( const std::string name, enum eRouteDestination destid, unsigned int base, unsigned int count ) { 287 m_router->setupDestinationsAddDestination(name.c_str(), destid, base, count); 288 EAP::addDestination(const std::string name, unsigned int base, unsigned int count, 289 enum eRouteDestination destid, unsigned int offset) 290 { 291 m_router->addDestination(name, destid, base, count, offset); 288 292 } 289 293 … … 496 500 (m_mixer_readonly?"not ":""), 497 501 (m_mixer_flashstored?"":"not ")); 498 printMessage(" tx id: %s [%d], rx id: %s [%d]\n",499 dstBlockToString(m_mixer_tx_id), m_mixer_tx_id,500 srcBlockToString(m_mixer_rx_id), m_mixer_rx_id);502 printMessage(" tx id: (%d==eRD_Mixer0) ? %s, rx id: (%d==eRS_Mixer) ? %s\n", 503 m_mixer_tx_id, (m_mixer_tx_id == eRD_Mixer0)?"true":"false", 504 m_mixer_rx_id, (m_mixer_rx_id == eRS_Mixer) ?"true":"false"); 501 505 printMessage(" nb tx channels: %d, nb rx channels: %d\n", m_mixer_nb_tx, m_mixer_nb_rx); 502 506 printMessage(" General: dynamic stream config %ssupported\n", … … 1092 1096 } 1093 1097 1098 // 1094 1099 // ----------- Router ------------- 1095 // FIXME: some more efficient datastructure for the 1096 // sources and destinations might be good 1097 1100 // 1098 1101 1099 1102 EAP::Router::Router(EAP &p) … … 1111 1114 1112 1115 void 1113 EAP::Router::setupSourcesAddSource(const char *basename, enum eRouteSource srcid, 1114 unsigned int base, unsigned int cnt) 1115 { 1116 unsigned int i=0; 1117 char name[16]; 1118 for (i=0; i<cnt; i++) { 1119 snprintf(name, 16, "%s:%02d", basename, base+i); 1120 struct Source s = {name, srcid, i}; 1121 m_sources.push_back(s); 1116 EAP::Router::addSource(const std::string& basename, enum eRouteSource srcid, 1117 unsigned int base, unsigned int cnt, unsigned int offset) 1118 { 1119 std::string name = basename + ":"; 1120 char tmp[4]; 1121 for (unsigned int i=0; i<cnt; i++) { 1122 snprintf(tmp, 4, "%02d", offset+i); 1123 m_sources[name+tmp] = (srcid<<4) + base+i; 1122 1124 } 1123 1125 } 1124 1126 1125 1127 void 1126 EAP::Router::setupDestinationsAddDestination(const char *basename, enum eRouteDestination dstid, 1127 unsigned int base, unsigned int cnt) 1128 { 1129 unsigned int i=0; 1130 char name[16]; 1131 for (i=0; i<cnt; i++) { 1132 snprintf(name, 16, "%s:%02d", basename, base+i); 1133 struct Destination d = {name, dstid, i}; 1134 m_destinations.push_back(d); 1128 EAP::Router::addDestination(const std::string& basename, enum eRouteDestination dstid, 1129 unsigned int base, unsigned int cnt, unsigned int offset) 1130 { 1131 std::string name = basename + ":"; 1132 char tmp[4]; 1133 for (unsigned int i=0; i<cnt; i++) { 1134 snprintf(tmp, 4, "%02d", offset+i); 1135 m_destinations[name+tmp] = (dstid<<4) + base+i; 1135 1136 } 1136 1137 } … … 1139 1140 EAP::Router::getSourceName(const int srcid) 1140 1141 { 1141 if((unsigned)srcid < m_sources.size()) {1142 return m_sources.at(srcid).name;1143 } else {1144 debugWarning("source id out of range (%d)\n", srcid);1145 return "";1146 }1142 for (std::map<std::string, int>::iterator it=m_sources.begin(); it!=m_sources.end(); ++it) { 1143 if (it->second == srcid) { 1144 return it->first; 1145 } 1146 } 1147 return ""; 1147 1148 } 1148 1149 … … 1150 1151 EAP::Router::getDestinationName(const int dstid) 1151 1152 { 1152 if((unsigned)dstid < m_destinations.size()) { 1153 return m_destinations.at(dstid).name; 1154 } else { 1155 debugWarning("destination id out of range (%d)\n", dstid); 1156 return ""; 1157 } 1153 debugWarning("TODO: Implement getDestinationName(0x%02x)\n", dstid); 1154 for (std::map<std::string, int>::iterator it=m_destinations.begin(); it!=m_destinations.end(); ++it) { 1155 if (it->second == dstid) { 1156 return it->first; 1157 } 1158 } 1159 return ""; 1158 1160 } 1159 1161 … … 1161 1163 EAP::Router::getSourceIndex(std::string name) 1162 1164 { 1163 int i = 0; 1164 for ( SourceVectorIterator it = m_sources.begin(); 1165 it != m_sources.end(); 1166 ++it ) 1167 { 1168 if(it->name == name) return i; 1169 i++; 1170 } 1171 return -1; 1165 if (m_sources.count(name) < 1) 1166 return -1; 1167 return m_sources[name]; 1172 1168 } 1173 1169 … … 1175 1171 EAP::Router::getDestinationIndex(std::string name) 1176 1172 { 1177 int i = 0; 1178 for ( DestinationVectorIterator it = m_destinations.begin(); 1179 it != m_destinations.end(); 1180 ++it ) 1181 { 1182 if(it->name == name) return i; 1183 i++; 1184 } 1185 return -1; 1186 } 1187 1188 int 1189 EAP::Router::getSourceIndex(enum eRouteSource srcid, int channel) 1190 { 1191 int i = 0; 1192 for ( SourceVectorIterator it = m_sources.begin(); 1193 it != m_sources.end(); 1194 ++it ) 1195 { 1196 if((it->src == srcid) && (it->srcChannel == channel)) return i; 1197 i++; 1198 } 1199 return -1; 1200 } 1201 1202 int 1203 EAP::Router::getDestinationIndex(enum eRouteDestination dstid, int channel) 1204 { 1205 int i = 0; 1206 for ( DestinationVectorIterator it = m_destinations.begin(); 1207 it != m_destinations.end(); 1208 ++it ) 1209 { 1210 if((it->dst == dstid) && (it->dstChannel == channel)) return i; 1211 i++; 1212 } 1213 return -1; 1214 } 1215 1216 Control::CrossbarRouter::NameVector 1173 if (m_destinations.count(name) < 1) 1174 return -1; 1175 return m_destinations[name]; 1176 } 1177 1178 stringlist 1217 1179 EAP::Router::getSourceNames() 1218 1180 { 1219 Control::CrossbarRouter::NameVector n; 1220 for ( SourceVectorIterator it = m_sources.begin(); 1221 it != m_sources.end(); 1222 ++it ) 1223 { 1224 n.push_back(it->name); 1225 } 1181 stringlist n; 1182 for (std::map<std::string, int>::iterator it=m_sources.begin(); it!=m_sources.end(); ++it) 1183 n.push_back(it->first); 1226 1184 return n; 1227 1185 } 1228 1186 1229 Control::CrossbarRouter::NameVector 1187 stringlist 1230 1188 EAP::Router::getDestinationNames() 1231 1189 { 1232 Control::CrossbarRouter::NameVector n; 1233 for ( DestinationVectorIterator it = m_destinations.begin(); 1234 it != m_destinations.end(); 1235 ++it ) 1236 { 1237 n.push_back(it->name); 1238 } 1190 stringlist n; 1191 for (std::map<std::string, int>::iterator it=m_destinations.begin(); it!=m_destinations.end(); ++it) 1192 n.push_back(it->first); 1239 1193 return n; 1240 1194 } 1241 1195 1242 Control::CrossbarRouter::Groups 1243 EAP::Router::getSources() 1244 { 1245 debugError("EAP::Router::getSources() is not yet implemented!"); 1246 return Control::CrossbarRouter::Groups(); 1247 } 1248 1249 Control::CrossbarRouter::Groups 1250 EAP::Router::getDestinations() 1251 { 1252 debugError("EAP::Router::getDestinations() is not yet implemented!"); 1253 return Control::CrossbarRouter::Groups(); 1254 } 1255 1256 Control::CrossbarRouter::IntVector 1257 EAP::Router::getDestinationsForSource(const int srcid) 1258 { 1259 IntVector retval; 1260 if((unsigned)srcid < m_sources.size()) { 1261 Source s = m_sources.at(srcid); 1262 1263 // get the routing configuration 1264 RouterConfig *rcfg = m_eap.getActiveRouterConfig(); 1265 if(rcfg == NULL) { 1266 debugError("Could not request active router configuration\n"); 1267 return retval; 1268 } 1269 // get the source routes 1270 RouterConfig::RouteVector v = rcfg->getRoutesForSource(s.src, s.srcChannel); 1271 1272 for ( RouterConfig::RouteVectorIterator it = v.begin(); 1273 it != v.end(); 1274 ++it ) 1275 { 1276 // FIXME: some more efficient datastructure might be good to 1277 // avoid this loop 1278 RouterConfig::Route &r = *it; 1279 int i = 0; 1280 for ( DestinationVectorIterator it = m_destinations.begin(); 1281 it != m_destinations.end(); 1282 ++it ) 1283 { 1284 if((it->dst == r.dst) && (it->dstChannel == r.dstChannel)) { 1285 retval.push_back(i); 1286 break; // can only match once 1287 } 1288 i++; 1289 } 1290 } 1291 return retval; 1292 } else { 1293 debugWarning("source id out of range (%d)\n", srcid); 1294 return retval; 1295 } 1296 } 1297 1298 int 1299 EAP::Router::getSourceForDestination(const int dstid) 1300 { 1301 if((unsigned)dstid < m_destinations.size()) { 1302 Destination d = m_destinations.at(dstid); 1303 1304 // get the routing configuration 1305 RouterConfig *rcfg = m_eap.getActiveRouterConfig(); 1306 if(rcfg == NULL) { 1307 debugError("Could not request active router configuration\n"); 1308 return false; 1309 } 1310 1311 RouterConfig::Route r = rcfg->getRouteForDestination(d.dst, d.dstChannel); 1312 if(r.src == eRS_Invalid) { 1313 return -1; 1314 } else { 1315 // FIXME: some more efficient datastructure might be good to 1316 // avoid this loop 1317 int i = 0; 1318 for ( SourceVectorIterator it = m_sources.begin(); 1319 it != m_sources.end(); 1320 ++it ) 1321 { 1322 if((it->src == r.src) && (it->srcChannel == r.srcChannel)) return i; 1323 i++; 1324 } 1325 return -1; 1326 } 1327 } else { 1328 debugWarning("destination id out of range (%d)\n", dstid); 1329 return -1; 1330 } 1331 } 1332 1333 int 1334 EAP::Router::getNbSources() 1335 { 1336 return m_sources.size(); 1337 } 1338 1339 int 1340 EAP::Router::getNbDestinations() 1341 { 1342 return m_destinations.size(); 1343 } 1196 stringlist 1197 EAP::Router::getDestinationsForSource(const std::string& srcname) { 1198 debugWarning("TODO: Implement getDestinationsForSource(%s)\n", srcname.c_str()); 1199 return stringlist(); 1200 } 1201 std::string 1202 EAP::Router::getSourceForDestination(const std::string& dstname) { 1203 RouterConfig* rcfg = m_eap.getActiveRouterConfig(); 1204 if(rcfg == NULL) { 1205 debugError("Could not request active router configuration\n"); 1206 return ""; 1207 } 1208 eRouteDestination dst = eRouteDestination(m_destinations[dstname]>>4); 1209 int dstChannel = m_destinations[dstname]&0xf; 1210 RouterConfig::Route r = rcfg->getRouteForDestination(dst, dstChannel); 1211 if (r.src == eRS_Invalid) { 1212 return ""; 1213 } 1214 return getSourceName((r.src<<4)+r.srcChannel); 1215 } 1216 1344 1217 1345 1218 bool 1346 1219 EAP::Router::canConnect(const int source, const int dest) 1347 1220 { 1348 if((unsigned)source >= m_sources.size()) { 1221 debugWarning("TODO: Implement canConnect(0x%02x, 0x%02x)\n", source, dest); 1222 /*if((unsigned)source >= m_sources.size()) { 1349 1223 debugWarning("source id out of range (%d)\n", source); 1350 1224 return false; … … 1356 1230 return false; 1357 1231 } 1358 Destination d = m_destinations.at(dest); 1232 Destination d = m_destinations.at(dest);*/ 1359 1233 1360 1234 // we can connect anything … … 1366 1240 EAP::Router::setConnectionState(const int source, const int dest, const bool enable) 1367 1241 { 1368 if((unsigned)source >= m_sources.size()) {1369 debugWarning("source id out of range (%d)\n", source);1370 return false;1371 }1372 Source s = m_sources.at(source);1373 1374 if((unsigned)dest >= m_destinations.size()) {1375 debugWarning("destination id out of range (%d)\n", dest);1376 return false;1377 }1378 Destination d = m_destinations.at(dest);1379 1380 1242 // get the routing configuration 1381 1243 RouterConfig *rcfg = m_eap.getActiveRouterConfig(); … … 1385 1247 } 1386 1248 1387 // build a new routing configuration 1388 RouterConfig newcfg = EAP::RouterConfig(*rcfg); 1389 1390 // construct the routing entry to find 1391 RouterConfig::Route r = {s.src, s.srcChannel, d.dst, d.dstChannel}; 1392 1393 // find the appropriate entry 1394 int idx = newcfg.getRouteIndex(r); 1395 1396 if (idx < 0) { 1397 // we have to add the route 1398 newcfg.insertRoute(r); 1399 } else { 1400 // the route is already present, so we can replace it 1401 if(enable) { 1402 debugOutput(DEBUG_LEVEL_VERBOSE, "connection %d => %d already present\n", source, dest); 1403 //return true; 1404 } else { 1405 // remove the route 1406 newcfg.removeRoute(idx); 1407 } 1408 } 1409 1410 // if we get here it means we have to upload a new router config 1411 if(!m_eap.updateCurrentRouterConfig(newcfg)) { 1412 debugError("Could not update router config\n"); 1413 return false; 1414 } 1415 1416 return true; 1249 RouterConfig::Route r = rcfg->getRouteForDestination(eRouteDestination(dest>>4), dest&0xf); 1250 if ( r.srcChannel == -1 && r.dstChannel == -1 && enable ) { 1251 r.src = eRouteSource(source>>4); 1252 r.srcChannel = source&0xf; 1253 r.dst = eRouteDestination(dest>>4); 1254 r.dstChannel = dest&0xf; 1255 int ret = rcfg->insertRoute(r); 1256 m_eap.updateCurrentRouterConfig(*rcfg); 1257 return ret; 1258 } 1259 if ( r.dst != (dest>>4) || r.dstChannel != (dest&0xf) ) { 1260 debugError("Route exists but isn't correct? strange...\n"); 1261 debugError(" wanted: 0x%02x got: 0x%02x\n", dest, (r.dst<<4)+r.dstChannel); 1262 return false; 1263 } 1264 if ( !enable ) { 1265 int ret = rcfg->removeRoute(r); 1266 m_eap.updateCurrentRouterConfig(*rcfg); 1267 return ret; 1268 } 1269 if ( enable ) { 1270 int index = rcfg->getRouteIndex(r); 1271 r.src = eRouteSource(source>>4); 1272 r.srcChannel = (source&0xf); 1273 int ret = rcfg->replaceRoute(index, r); 1274 m_eap.updateCurrentRouterConfig(*rcfg); 1275 return ret; 1276 } 1277 1278 // When we reach this point, something went wrong. Return false by default... 1279 return false; 1417 1280 } 1418 1281 … … 1420 1283 EAP::Router::getConnectionState(const int source, const int dest) 1421 1284 { 1422 if((unsigned)source >= m_sources.size()) {1423 debugWarning("source id out of range (%d)\n", source);1424 return false;1425 }1426 Source s = m_sources.at(source);1427 1428 if((unsigned)dest >= m_destinations.size()) {1429 debugWarning("destination id out of range (%d)\n", dest);1430 return false;1431 }1432 Destination d = m_destinations.at(dest);1433 1434 1285 // get the routing configuration 1435 1286 RouterConfig *rcfg = m_eap.getActiveRouterConfig(); … … 1438 1289 return false; 1439 1290 } 1440 1441 // build a new routing configuration 1442 RouterConfig newcfg = EAP::RouterConfig(*rcfg); 1443 1444 // construct the routing entry to find 1445 RouterConfig::Route r = {s.src, s.srcChannel, d.dst, d.dstChannel}; 1446 1447 // find the appropriate entry 1448 int idx = newcfg.getRouteIndex(r); 1449 1450 if (idx < 0) { 1451 // the route is not present 1452 return false; 1453 } else { 1454 // the route is already present 1455 return true; 1456 } 1457 } 1458 1459 bool 1460 EAP::Router::canConnect(std::string src, std::string dst) 1291 // Construct a route 1292 RouterConfig::Route r = { eRouteSource(source>>4), source&0xf, eRouteDestination(dest>>4), dest&0xf }; 1293 // get the routes index... 1294 int idx = rcfg->getRouteIndex(r); 1295 // ...and return true if it exists 1296 return (idx>=0); 1297 } 1298 1299 bool 1300 EAP::Router::canConnect(const std::string& src, const std::string& dst) 1461 1301 { 1462 1302 int srcidx = getSourceIndex(src); … … 1466 1306 1467 1307 bool 1468 EAP::Router::setConnectionState( std::string src, std::stringdst, const bool enable)1308 EAP::Router::setConnectionState(const std::string& src, const std::string& dst, const bool enable) 1469 1309 { 1470 1310 int srcidx = getSourceIndex(src); … … 1474 1314 1475 1315 bool 1476 EAP::Router::getConnectionState( std::string src, std::stringdst)1316 EAP::Router::getConnectionState(const std::string& src, const std::string& dst) 1477 1317 { 1478 1318 int srcidx = getSourceIndex(src); … … 1481 1321 } 1482 1322 1483 // the map is organized as a matrix where the1484 // rows are the destinations and the columns are1485 // the sources1486 1487 // note that map as assumed to be big enough and1488 // allocated by the user1489 bool1490 EAP::Router::getConnectionMap(int *map)1491 {1492 unsigned int nb_sources = getNbSources();1493 unsigned int nb_destinations = getNbDestinations();1494 1495 // clear the map1496 memset(map, 0, nb_sources * nb_destinations * sizeof(int));1497 1498 // get the routing configuration1499 RouterConfig *rcfg = m_eap.getActiveRouterConfig();1500 if(rcfg == NULL) {1501 debugError("Could not request active router configuration\n");1502 return false;1503 }1504 1505 unsigned int nb_routes = rcfg->getNbRoutes();1506 1507 for(unsigned int i=0; i<nb_routes; i++) {1508 struct RouterConfig::Route r = rcfg->getRoute(i);1509 int srcidx = getSourceIndex(r.src, r.srcChannel);1510 int dstidx = getDestinationIndex(r.dst, r.dstChannel);1511 if(srcidx < 0) {1512 debugWarning("bogus source (%d, %d) in route table\n", r.src, r.srcChannel);1513 } else if(dstidx < 0) {1514 debugWarning("bogus destination (%d, %d) in route table\n", r.dst, r.dstChannel);1515 } else {1516 int *ptr = map;1517 ptr += dstidx * nb_sources;1518 ptr += srcidx;1519 *ptr = 1; // route present1520 }1521 }1522 return true;1523 }1524 1525 bool1526 EAP::Router::setConnectionMap(int *map)1527 {1528 return false;1529 }1530 1323 1531 1324 bool … … 1550 1343 1551 1344 double 1552 EAP::Router::getPeakValue(const int source, const int dest) 1553 { 1554 if((unsigned)source >= m_sources.size()) { 1345 EAP::Router::getPeakValue(const std::string& dest) 1346 { 1347 debugError("TODO: Implement getPeakValue(%s)\n", dest.c_str()); 1348 /*if((unsigned)source >= m_sources.size()) { 1555 1349 debugWarning("source id out of range (%d)\n", source); 1556 1350 return false; … … 1584 1378 r = m_peak.getRoute(idx); 1585 1379 return r.peak; 1586 } 1587 1588 } 1589 1590 Control::CrossbarRouter::PeakValues 1380 }*/ 1381 return -1; 1382 1383 } 1384 1385 std::map<std::string, double> 1591 1386 EAP::Router::getPeakValues() 1592 1387 { 1593 m_peak.read(); 1388 debugError("TODO: implement getPeakValues()\n"); 1389 /*m_peak.read(); 1594 1390 Control::CrossbarRouter::PeakValues values; 1595 1391 for (unsigned int i=0; i<m_peak.getNbRoutes(); ++i) { … … 1600 1396 values.push_back(tmp); 1601 1397 } 1602 return values; 1398 return values;*/ 1399 return std::map<std::string, double>(); 1603 1400 } 1604 1401 … … 1607 1404 { 1608 1405 // print the peak space as it also contains the routing configuration 1609 printMessage("Active router config:\n"); 1610 m_peak.read(); 1611 m_peak.show(); 1406 printMessage("Router sources:\n"); 1407 for ( std::map<std::string, int>::iterator it=m_sources.begin(); it!=m_sources.end(); ++it ) { 1408 printMessage(" 0x%02x : %s\n", (*it).second, (*it).first.c_str()); 1409 } 1410 printMessage("Router destinations:\n"); 1411 for ( std::map<std::string, int>::iterator it=m_destinations.begin(); it!=m_destinations.end(); ++it ) { 1412 printMessage(" 0x%02x : %s\n", (*it).second, (*it).first.c_str()); 1413 } 1414 printMessage("Router connections:\n"); 1415 stringlist sources = getSourceNames(); 1416 stringlist destinations = getDestinationNames(); 1417 for (stringlist::iterator it1=sources.begin(); it1!=sources.end(); ++it1) { 1418 for (stringlist::iterator it2=destinations.begin(); it2!=destinations.end(); ++it2) { 1419 if (getConnectionState(*it1, *it2)) { 1420 printMessage(" %s -> %s\n", it1->c_str(), it2->c_str()); 1421 } 1422 } 1423 } 1424 //printMessage("Active router config:\n"); 1425 //m_peak.read(); 1426 //m_peak.show(); 1612 1427 } 1613 1428 … … 1863 1678 debugOutput(DEBUG_LEVEL_VERY_VERBOSE, "%s:%02d source can't be found\n", 1864 1679 dstBlockToString((int)dst), channel); 1865 struct Route r = {eRS_Invalid, -1, eRD_Invalid, 0, 0};1680 struct Route r = {eRS_Invalid, -1, eRD_Invalid, -1, 0}; 1866 1681 return r; 1867 1682 } trunk/libffado/src/dice/dice_eap.h
r1772 r1776 223 223 virtual void show(); 224 224 225 226 225 bool insertRoute(struct Route r) 227 226 {return insertRoute(r, m_routes.size());}; … … 367 366 */ 368 367 class Router : public Control::CrossbarRouter { 369 private:370 struct Source {371 std::string name;372 enum eRouteSource src;373 int srcChannel;374 };375 typedef std::vector<Source> SourceVector;376 typedef std::vector<Source>::iterator SourceVectorIterator;377 378 struct Destination {379 std::string name;380 enum eRouteDestination dst;381 int dstChannel;382 };383 typedef std::vector<Destination> DestinationVector;384 typedef std::vector<Destination>::iterator DestinationVectorIterator;385 386 368 public: 387 369 Router(EAP &); … … 390 372 void show(); 391 373 392 void setupDestinationsAddDestination(const char *name, enum eRouteDestination dstid, 393 unsigned int base, unsigned int cnt); 394 void setupSourcesAddSource(const char *name, enum eRouteSource srcid, 395 unsigned int base, unsigned int cnt); 396 397 int getDestinationIndex(enum eRouteDestination dstid, int channel); 398 int getSourceIndex(enum eRouteSource srcid, int channel); 374 void addDestination(const std::string& name, enum eRouteDestination dstid, 375 unsigned int base, unsigned int cnt, unsigned int offset=0); 376 void addSource(const std::string& name, enum eRouteSource srcid, 377 unsigned int base, unsigned int cnt, unsigned int offset=0); 399 378 400 379 // per-coefficient access … … 403 382 virtual int getSourceIndex(std::string); 404 383 virtual int getDestinationIndex(std::string); 405 virtual NameVector getSourceNames(); 406 virtual NameVector getDestinationNames(); 407 408 virtual Control::CrossbarRouter::Groups getSources(); 409 virtual Control::CrossbarRouter::Groups getDestinations(); 410 411 virtual IntVector getDestinationsForSource(const int); 412 virtual int getSourceForDestination(const int); 413 414 virtual bool canConnect( const int source, const int dest); 415 virtual bool setConnectionState( const int source, const int dest, const bool enable); 416 virtual bool getConnectionState( const int source, const int dest ); 417 418 virtual bool canConnect(std::string, std::string); 419 virtual bool setConnectionState(std::string, std::string, const bool enable); 420 virtual bool getConnectionState(std::string, std::string); 384 virtual stringlist getSourceNames(); 385 virtual stringlist getDestinationNames(); 386 387 std::string getSourceForDestination(const std::string& dstname); 388 stringlist getDestinationsForSource(const std::string& srcname); 389 390 virtual bool canConnect(const int srcidx, const int dstidx); 391 virtual bool setConnectionState(const int srcidx, const int dstidx, const bool enable); 392 virtual bool getConnectionState(const int srcidx, const int dstidx); 393 394 virtual bool canConnect(const std::string& srcname, const std::string& dstname); 395 virtual bool setConnectionState(const std::string& srcname, const std::string& dstname, const bool enable); 396 virtual bool getConnectionState(const std::string& srcname, const std::string& dstname); 421 397 422 398 virtual bool clearAllConnections(); 423 424 virtual int getNbSources();425 virtual int getNbDestinations();426 427 // functions to access the entire routing map at once428 // idea is that the row/col nodes that are 1 get a routing entry429 virtual bool getConnectionMap(int *);430 virtual bool setConnectionMap(int *);431 399 432 400 // peak metering support 433 401 virtual bool hasPeakMetering(); 434 virtual bool getPeakValues(double &) {return false;}; 435 virtual double getPeakValue(const int source, const int dest); 436 virtual Control::CrossbarRouter::PeakValues getPeakValues(); 402 virtual double getPeakValue(const std::string& dest); 403 virtual std::map<std::string, double> getPeakValues(); 437 404 438 405 private: 439 406 EAP &m_eap; 440 // these contain the sources and destinations available for this 441 // router 442 SourceVector m_sources; 443 DestinationVector m_destinations; 407 /** 408 @{ 409 @brief Name-Index pairs for the sources and destinations 410 411 The index is 'artificial' and is the block/channel combination used in the dice. 412 */ 413 std::map<std::string, int> m_sources; 414 std::map<std::string, int> m_destinations; 415 // @} 444 416 445 417 PeakSpace &m_peak; … … 528 500 @brief Actually add the source 529 501 */ 530 void addSource( const std::string name, enum eRouteSource srcid,531 unsigned int base, unsigned int count);502 void addSource(const std::string name, unsigned int base, unsigned int count, 503 enum eRouteSource srcid, unsigned int offset=0); 532 504 /** 533 505 @brief Actually add the destination 534 506 */ 535 void addDestination( const std::string name, enum eRouteDestination destid,536 unsigned int base, unsigned int count);507 void addDestination(const std::string name, unsigned int base, unsigned int count, 508 enum eRouteDestination destid, unsigned int offset=0); 537 509 538 510 private: trunk/libffado/src/dice/focusrite/saffire_pro24.cpp
r1775 r1776 45 45 46 46 void SaffirePro24::SaffirePro24EAP::setupSources() { 47 addSource("SPDIF", eRS_AES, 6, 2);48 addSource("ADAT", eRS_ADAT, 0, 8);49 addSource(" INS0", eRS_InS0, 0, 4);50 addSource("Mixer Out", eRS_Mixer, 0, 16);51 addSource("1394", eRS_ARX0, 0, 8);47 addSource("SPDIF", 6, 2, eRS_AES); 48 addSource("ADAT", 0, 8, eRS_ADAT); 49 addSource("Analog", 0, 4, eRS_InS0); 50 addSource("Mixer", 0, 16, eRS_Mixer); 51 addSource("1394", 0, 8, eRS_ARX0); 52 52 } 53 53 void SaffirePro24::SaffirePro24EAP::setupDestinations() { 54 addDestination("SPDIF", eRD_AES, 6, 2);55 addDestination(" INS0", eRD_InS0, 0, 6);56 addDestination("Mixer In", eRD_Mixer0, 0, 16);57 addDestination("Mixer In", eRD_Mixer1, 16, 2);58 addDestination("1394", eRD_ATX0, 0, 16);54 addDestination("SPDIF", 6, 2, eRD_AES); 55 addDestination("Analog", 0, 6, eRD_InS0); 56 addDestination("Mixer", 0, 16, eRD_Mixer0); 57 addDestination("Mixer", 0, 2, eRD_Mixer1, 16); 58 addDestination("1394", 0, 16, eRD_ATX0); 59 59 } 60 60 trunk/libffado/src/libcontrol/CrossbarRouter.h
r1655 r1776 26 26 27 27 #include "debugmodule/debugmodule.h" 28 #include "ffadotypes.h" 28 29 29 30 #include "Element.h" … … 31 32 #include <vector> 32 33 #include <string> 34 #include <map> 33 35 34 36 namespace Control { … … 47 49 virtual void show() = 0; 48 50 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; 51 virtual stringlist getSourceNames() = 0; 52 virtual stringlist getDestinationNames() = 0; 53 53 54 struct PeakValue 55 { 56 int destination; 57 double peakvalue; 58 }; 59 typedef std::vector<PeakValue> PeakValues; 54 virtual std::string getSourceForDestination(const std::string& dstname) = 0; 55 virtual stringlist getDestinationsForSource(const std::string& srcname) = 0; 60 56 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; 57 virtual bool canConnect(const std::string& srcname, const std::string& dstname) = 0; 58 virtual bool setConnectionState(const std::string& srcname, const std::string& dstname, const bool enable) = 0; 59 virtual bool getConnectionState(const std::string& srcname, const std::string& dstname) = 0; 89 60 90 61 virtual bool clearAllConnections() = 0; 91 62 92 virtual int getNbSources() = 0;93 virtual int getNbDestinations() = 0;94 95 // functions to access the entire routing map at once96 // idea is that the row/col nodes that are 1 get a routing entry97 virtual bool getConnectionMap(int *) = 0;98 virtual bool setConnectionMap(int *) = 0;99 100 63 // peak metering 101 64 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; 65 virtual double getPeakValue(const std::string& dest) = 0; 66 virtual std::map<std::string, double> getPeakValues() = 0; 105 67 106 68 protected: trunk/libffado/support/dbus/control-interface.xml
r1742 r1776 240 240 241 241 <interface name="org.ffado.Control.Element.CrossbarRouter"> 242 <method name="getSourceName">243 <arg type="i" name="srcid" direction="in"/>244 <arg type="s" name="sourcename" direction="out"/>245 </method>246 <method name="getDestinationName">247 <arg type="i" name="dstid" direction="in"/>248 <arg type="s" name="destinationname" direction="out"/>249 </method>250 <method name="getSourceIndex">251 <arg type="s" name="sourcename" direction="in"/>252 <arg type="i" name="srcid" direction="out"/>253 </method>254 <method name="getDestinationIndex">255 <arg type="s" name="destinationname" direction="in"/>256 <arg type="i" name="dstid" direction="out"/>257 </method>258 242 <method name="getSourceNames"> 259 243 <arg type="as" name="sourcenames" direction="out"/> 260 244 </method> 261 <method name="getSources">262 <arg type="a(si)" name="sources" direction="out"/>263 </method>264 <method name="getDestinations">265 <arg type="a(si)" name="sources" direction="out"/>266 </method>267 245 <method name="getDestinationNames"> 268 246 <arg type="as" name="destinationnames" direction="out"/> 269 247 </method> 248 <method name="getSourceForDestination"> 249 <arg type="s" name="dstid" direction="in"/> 250 <arg type="s" name="srcid" direction="out"/> 251 </method> 270 252 <method name="getDestinationsForSource"> 271 <arg type="i" name="srcid" direction="in"/> 272 <arg type="ai" name="dstids" direction="out"/> 273 </method> 274 <method name="getSourceForDestination"> 275 <arg type="i" name="dstid" direction="in"/> 276 <arg type="i" name="srcid" direction="out"/> 253 <arg type="s" name="srcid" direction="in"/> 254 <arg type="as" name="dstids" direction="out"/> 277 255 </method> 278 256 <method name="canConnect"> 279 <arg type=" i" name="srcid" direction="in"/>280 <arg type=" i" name="dstid" direction="in"/>257 <arg type="s" name="srcid" direction="in"/> 258 <arg type="s" name="dstid" direction="in"/> 281 259 <arg type="b" name="canconnect" direction="out"/> 282 260 </method> 283 261 <method name="setConnectionState"> 284 <arg type=" i" name="srcid" direction="in"/>285 <arg type=" i" name="dstid" direction="in"/>262 <arg type="s" name="srcid" direction="in"/> 263 <arg type="s" name="dstid" direction="in"/> 286 264 <arg type="b" name="state" direction="in"/> 287 265 <arg type="b" name="result" direction="out"/> 288 266 </method> 289 267 <method name="getConnectionState"> 290 <arg type="i" name="srcid" direction="in"/> 291 <arg type="i" name="dstid" direction="in"/> 292 <arg type="b" name="state" direction="out"/> 293 </method> 294 <method name="canConnectNamed"> 295 <arg type="s" name="srcname" direction="in"/> 296 <arg type="s" name="dstname" direction="in"/> 297 <arg type="b" name="canconnect" direction="out"/> 298 </method> 299 <method name="setConnectionStateNamed"> 300 <arg type="s" name="srcname" direction="in"/> 301 <arg type="s" name="dstname" direction="in"/> 302 <arg type="b" name="state" direction="in"/> 303 <arg type="b" name="result" direction="out"/> 304 </method> 305 <method name="getConnectionStateNamed"> 306 <arg type="s" name="srcname" direction="in"/> 307 <arg type="s" name="dstname" direction="in"/> 268 <arg type="s" name="srcid" direction="in"/> 269 <arg type="s" name="dstid" direction="in"/> 308 270 <arg type="b" name="state" direction="out"/> 309 271 </method> … … 311 273 <arg type="b" name="state" direction="out"/> 312 274 </method> 313 <method name="getNbSources">314 <arg type="i" name="state" direction="out"/>315 </method>316 <method name="getNbDestinations">317 <arg type="i" name="state" direction="out"/>318 </method>319 <method name="getConnectionMap">320 <arg type="ai" name="map" direction="out"/>321 </method>322 <method name="setConnectionMap">323 <arg type="ai" name="map" direction="in"/>324 <arg type="i" name="state" direction="out"/>325 </method>326 275 <method name="hasPeakMetering"> 327 276 <arg type="b" name="hasmetering" direction="out"/> 328 277 </method> 329 278 <method name="getPeakValue"> 330 <arg type="i" name="srcid" direction="in"/> 331 <arg type="i" name="dstid" direction="in"/> 279 <arg type="s" name="dstid" direction="in"/> 332 280 <arg type="d" name="value" direction="out"/> 333 281 </method> 334 282 <method name="getPeakValues"> 335 <arg type="a( id)" name="values" direction="out"/>283 <arg type="a(sd)" name="values" direction="out"/> 336 284 </method> 337 285 </interface> trunk/libffado/support/dbus/controlserver.cpp
r1742 r1776 868 868 } 869 869 870 DBus::String 871 CrossbarRouter::getSourceName(const DBus::Int32 &idx) 872 { 873 return m_Slave.getSourceName(idx); 874 } 875 876 DBus::String 877 CrossbarRouter::getDestinationName(const DBus::Int32 &idx) 878 { 879 return m_Slave.getDestinationName(idx); 880 } 881 882 DBus::Int32 870 /*DBus::Int32 883 871 CrossbarRouter::getSourceIndex(const DBus::String &name) 884 872 { … … 890 878 { 891 879 return m_Slave.getDestinationIndex(name); 892 } 880 }*/ 893 881 894 882 std::vector< DBus::String > … … 904 892 } 905 893 906 std::vector< DBus::Struct<DBus::String, int> > 907 CrossbarRouter::getSources() 908 { 909 return std::vector< DBus::Struct<DBus::String, int> >(); 910 } 911 912 std::vector< DBus::Struct<DBus::String, int> > 913 CrossbarRouter::getDestinations() 914 { 915 return std::vector< DBus::Struct<DBus::String, int> >(); 916 } 917 918 std::vector< DBus::Int32 > 919 CrossbarRouter::getDestinationsForSource(const DBus::Int32 &idx) 894 std::vector< DBus::String > 895 CrossbarRouter::getDestinationsForSource(const DBus::String &idx) 920 896 { 921 897 return m_Slave.getDestinationsForSource(idx); 922 898 } 923 899 924 DBus:: Int32925 CrossbarRouter::getSourceForDestination(const DBus:: Int32&idx)900 DBus::String 901 CrossbarRouter::getSourceForDestination(const DBus::String &idx) 926 902 { 927 903 return m_Slave.getSourceForDestination(idx); … … 929 905 930 906 DBus::Bool 931 CrossbarRouter::canConnect(const DBus:: Int32 &source, const DBus::Int32&dest)907 CrossbarRouter::canConnect(const DBus::String &source, const DBus::String &dest) 932 908 { 933 909 return m_Slave.canConnect(source, dest); … … 935 911 936 912 DBus::Bool 937 CrossbarRouter::setConnectionState(const DBus:: Int32 &source, const DBus::Int32&dest, const DBus::Bool &enable)913 CrossbarRouter::setConnectionState(const DBus::String &source, const DBus::String &dest, const DBus::Bool &enable) 938 914 { 939 915 return m_Slave.setConnectionState(source, dest, enable); … … 941 917 942 918 DBus::Bool 943 CrossbarRouter::getConnectionState(const DBus:: Int32 &source, const DBus::Int32&dest)919 CrossbarRouter::getConnectionState(const DBus::String &source, const DBus::String &dest) 944 920 { 945 921 return m_Slave.getConnectionState(source, dest); … … 947 923 948 924 DBus::Bool 949 CrossbarRouter::canConnectNamed(const DBus::String& source, const DBus::String& dest)950 {951 return m_Slave.canConnect(source, dest);952 }953 954 DBus::Bool955 CrossbarRouter::setConnectionStateNamed(const DBus::String &source, const DBus::String &dest, const DBus::Bool &enable)956 {957 return m_Slave.setConnectionState(source, dest, enable);958 }959 960 DBus::Bool961 CrossbarRouter::getConnectionStateNamed(const DBus::String &source, const DBus::String &dest)962 {963 return m_Slave.getConnectionState(source, dest);964 }965 966 DBus::Bool967 925 CrossbarRouter::clearAllConnections() 968 926 { … … 970 928 } 971 929 972 DBus::Int32973 CrossbarRouter::getNbSources()974 {975 return m_Slave.getNbSources();976 }977 978 DBus::Int32979 CrossbarRouter::getNbDestinations()980 {981 return m_Slave.getNbDestinations();982 }983 984 930 DBus::Bool 985 931 CrossbarRouter::hasPeakMetering() … … 989 935 990 936 DBus::Double 991 CrossbarRouter::getPeakValue(const DBus:: Int32 &source, const DBus::Int32&dest)992 { 993 return m_Slave.getPeakValue( source,dest);994 } 995 std::vector< DBus::Struct< int, double> >937 CrossbarRouter::getPeakValue(const DBus::String &dest) 938 { 939 return m_Slave.getPeakValue(dest); 940 } 941 std::vector< DBus::Struct<DBus::String, double> > 996 942 CrossbarRouter::getPeakValues() 997 943 { 998 //return std::vector< DBus::Struct<int, int, double> >();999 std::vector< DBus::Struct<int, double> > out;944 return std::vector< DBus::Struct<DBus::String, double> >(); 945 /*std::vector< DBus::Struct<int, double> > out; 1000 946 Control::CrossbarRouter::PeakValues values = m_Slave.getPeakValues(); 1001 947 for ( unsigned int i=0; i<values.size(); ++i ) { … … 1005 951 out.push_back(tmp); 1006 952 } 1007 return out; 1008 } 1009 1010 std::vector< DBus::Int32 > 1011 CrossbarRouter::getConnectionMap() 1012 { 1013 std::vector< DBus::Int32 >connmap; 1014 unsigned int nb_sources = m_Slave.getNbSources(); 1015 unsigned int nb_destinations = m_Slave.getNbDestinations(); 1016 unsigned int nb_entries = nb_sources * nb_destinations; 1017 1018 int map_data[nb_entries]; 1019 1020 if(!m_Slave.getConnectionMap(map_data)) { 1021 debugError("Could not fetch connection map\n"); 1022 return connmap; 1023 } 1024 1025 for(unsigned int i=0; i<nb_entries; i++) { 1026 connmap.push_back(map_data[i]); 1027 } 1028 return connmap; 1029 } 1030 1031 DBus::Int32 1032 CrossbarRouter::setConnectionMap(const std::vector< DBus::Int32 >&connmap) 1033 { 1034 unsigned int nb_sources = m_Slave.getNbSources(); 1035 unsigned int nb_destinations = m_Slave.getNbDestinations(); 1036 unsigned int nb_entries = nb_sources * nb_destinations; 1037 1038 if(connmap.size() != nb_entries) { 1039 debugError("bogus map size\n"); 1040 return false; 1041 } 1042 1043 int map_data[nb_entries]; 1044 for (unsigned int i=0; i<nb_entries; i++) { 1045 map_data[i] = connmap.at(i); 1046 } 1047 return m_Slave.setConnectionMap(map_data); 953 return out;*/ 1048 954 } 1049 955 trunk/libffado/support/dbus/controlserver.h
r1742 r1776 339 339 Control::CrossbarRouter &slave ); 340 340 341 DBus::String getSourceName(const DBus::Int32 &);342 DBus::String getDestinationName(const DBus::Int32 &);343 DBus::Int32 getSourceIndex(const DBus::String &);344 DBus::Int32 getDestinationIndex(const DBus::String &);345 346 341 std::vector< DBus::String > getSourceNames(); 347 342 std::vector< DBus::String > getDestinationNames(); 348 343 349 std::vector< DBus::Struct<DBus::String, int> > getSources(); 350 std::vector< DBus::Struct<DBus::String, int> > getDestinations(); 351 352 std::vector< DBus::Int32 > getDestinationsForSource(const DBus::Int32 &); 353 DBus::Int32 getSourceForDestination(const DBus::Int32 &); 354 355 DBus::Bool canConnect(const DBus::Int32 &source, const DBus::Int32 &dest); 356 DBus::Bool setConnectionState(const DBus::Int32 &source, const DBus::Int32 &dest, const DBus::Bool &enable); 357 DBus::Bool getConnectionState(const DBus::Int32 &source, const DBus::Int32 &dest); 358 359 DBus::Bool canConnectNamed(const DBus::String&, const DBus::String&); 360 DBus::Bool setConnectionStateNamed(const DBus::String&, const DBus::String&, const DBus::Bool &enable); 361 DBus::Bool getConnectionStateNamed(const DBus::String&, const DBus::String&); 344 std::vector< DBus::String > getDestinationsForSource(const DBus::String &); 345 DBus::String getSourceForDestination(const DBus::String &); 346 347 DBus::Bool canConnect(const DBus::String &source, const DBus::String &dest); 348 DBus::Bool setConnectionState(const DBus::String &source, const DBus::String &dest, const DBus::Bool &enable); 349 DBus::Bool getConnectionState(const DBus::String &source, const DBus::String &dest); 362 350 363 351 DBus::Bool clearAllConnections(); 364 352 365 DBus::Int32 getNbSources();366 DBus::Int32 getNbDestinations();367 368 353 DBus::Bool hasPeakMetering(); 369 DBus::Double getPeakValue(const DBus::Int32 &source, const DBus::Int32 &dest); 370 371 std::vector< DBus::Struct<int, double> > getPeakValues(); 372 373 std::vector< DBus::Int32 > getConnectionMap(); 374 DBus::Int32 setConnectionMap(const std::vector< DBus::Int32 >&); 354 DBus::Double getPeakValue(const DBus::String &dest); 355 std::vector< DBus::Struct<DBus::String, double> > getPeakValues(); 375 356 376 357 private: trunk/libffado/support/mixer-qt4/ffado/widgets/crossbarrouter.py
r1739 r1776 80 80 self.layout.addWidget(self.lbl, 0, 0) 81 81 82 self.vu = VuMeter(self.interface, self.interface.getDestinationIndex(outname), parent=self)83 self.layout.addWidget(self.vu, 0, 1)82 #self.vu = VuMeter(self.interface, self.interface.getDestinationIndex(outname), parent=self) 83 #self.layout.addWidget(self.vu, 0, 1) 84 84 85 85 sources = self.interface.getSourceNames() … … 89 89 self.combo.addItem("Disconnected") 90 90 self.combo.addItems(sources) 91 idx = self.interface.getDestinationIndex(self.outname)92 sourceidx = self.interface.getSourceForDestination(idx)93 if sourceidx > -1:94 source = self.interface.getSourceName(sourceidx)95 self.combo.setCurrentIndex( sources.index(source)+1)91 src = self.interface.getSourceForDestination(self.outname) 92 if src != "": 93 self.combo.setCurrentIndex(self.combo.findText(src)) 94 else: 95 self.combo.setCurrentIndex(0) 96 96 self.connect(self.combo, QtCore.SIGNAL("activated(QString)"), self.comboCurrentChanged) 97 97 98 98 99 99 def peakValue(self, value): 100 self.vu.updateLevel(value) 100 #self.vu.updateLevel(value) 101 pass 101 102 102 103 def comboCurrentChanged(self, inname): … … 105 106 return 106 107 if self.lastin != "": 107 self.interface.setConnectionState Named(self.lastin, self.outname, False)108 self.interface.setConnectionState(self.lastin, self.outname, False) 108 109 109 110 if inname != "Disconnected": 110 if self.interface.setConnectionState Named(str(inname), self.outname, True):111 if self.interface.setConnectionState(str(inname), self.outname, True): 111 112 self.lastin = str(inname) 112 113 else: … … 124 125 125 126 self.settings = QtCore.QSettings(self) 126 127 log.info(self.interface.getDestinations())128 127 129 128 destinations = self.interface.getDestinationNames() … … 152 151 btn = OutputSwitcher(self.interface, out, self) 153 152 self.layout.addWidget(btn, int(out.split(":")[-1]) + 1, self.outgroups.index(out.split(":")[0])) 154 self.switchers[ self.interface.getDestinationIndex(out)] = btn153 self.switchers[out] = btn 155 154 156 155 self.timer = QtCore.QTimer(self) trunk/libffado/tests/test-dice-eap.cpp
r1773 r1776 295 295 // } 296 296 // } 297 #define NELEMS 10298 double peaks[NELEMS];299 int srcids[NELEMS];300 int dstidx = c->getDestinationIndex("MixerIn:00");301 for(int i=0; i<NELEMS; i++) {302 srcids[i] = c->getSourceForDestination(dstidx + i);303 peaks[i] = c->getPeakValue(srcids[i], dstidx + i);304 }305 for(int i=0; i<NELEMS; i++) {306 std::string srcname = c->getSourceName(srcids[i]);307 std::string dstname = c->getDestinationName(dstidx + i);308 printMessage("Peak %3d (%10s => %10s): %f\n", i, srcname.c_str(), dstname.c_str(), peaks[i]);309 }297 // #define NELEMS 10 298 // double peaks[NELEMS]; 299 // int srcids[NELEMS]; 300 // int dstidx = c->getDestinationIndex("MixerIn:00"); 301 // for(int i=0; i<NELEMS; i++) { 302 // srcids[i] = c->getSourceForDestination(dstidx + i); 303 // peaks[i] = c->getPeakValue(srcids[i], dstidx + i); 304 // } 305 // for(int i=0; i<NELEMS; i++) { 306 // std::string srcname = c->getSourceName(srcids[i]); 307 // std::string dstname = c->getDestinationName(dstidx + i); 308 // printMessage("Peak %3d (%10s => %10s): %f\n", i, srcname.c_str(), dstname.c_str(), peaks[i]); 309 // } 310 310 } 311 311 }