Index: /trunk/libffado/src/libieee1394/configrom.cpp =================================================================== --- /trunk/libffado/src/libieee1394/configrom.cpp (revision 445) +++ /trunk/libffado/src/libieee1394/configrom.cpp (revision 462) @@ -592,5 +592,5 @@ debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) CMD? %s\n", this, cmd.c_str()); if(cmd == "params") { - debugOutput( DEBUG_LEVEL_VERBOSE, "Listing node children...\n"); + debugOutput( DEBUG_LEVEL_VERBOSE, "Listing node params...\n"); OSC::OscMessage& rm=r.getMessage(); rm.addArgument("GUID"); Index: /trunk/libffado/src/bebob/GenericMixer.cpp =================================================================== --- /trunk/libffado/src/bebob/GenericMixer.cpp (revision 458) +++ /trunk/libffado/src/bebob/GenericMixer.cpp (revision 462) @@ -36,5 +36,8 @@ #include "libieee1394/ieee1394service.h" +#include #include +#include + #include @@ -42,4 +45,13 @@ namespace BeBoB { + +template +bool from_string(T& t, + const std::string& s, + std::ios_base& (*f)(std::ios_base&)) +{ + std::istringstream iss(s); + return !(iss >> f >> t).fail(); +} IMPL_DEBUG_MODULE( GenericMixer, GenericMixer, DEBUG_LEVEL_NORMAL ); @@ -61,6 +73,42 @@ OscResponse GenericMixer::processOscMessage(OscMessage *m) { - debugOutput(DEBUG_LEVEL_NORMAL, "Message\n"); - + debugOutput( DEBUG_LEVEL_NORMAL, "PROCESS: %s\n", m->getPath().c_str()); + + std::string path=m->getPath(); + + // delete leading slashes + if(path.find_first_of('/')==0) path=path.substr(1,path.size()); + + // delete trailing slashes + if(path.find_last_of('/')==path.size()-1) path=path.substr(0,path.size()-1); + + std::string target=""; + std::string newpath=""; + + if (path == "") return processOscMessageRoot(m); + + // not targetted at the root node, continue processing + int firstsep=path.find_first_of('/'); + if (firstsep == -1) { // this will most likely be a list request + target=path; + newpath=""; + } else { + target=path.substr(0,firstsep); + newpath=path.substr(firstsep+1); + } + + if(target == "Selector") return processOscMessageSelector(newpath, m); + if(target == "Feature") return processOscMessageFeature(newpath, m); + if(target == "Processing") return processOscMessageProcessing(newpath, m); + + // unhandled + return OscResponse(OscResponse::eUnhandled); +} + +//// MIXER ROOT MESSAGES + +OscResponse +GenericMixer::processOscMessageRoot(OscMessage *m) { + unsigned int nbArgs=m->nbArguments(); if (nbArgs>=1) { @@ -68,10 +116,128 @@ if(arg0.isString()) { // first argument should be a string command string cmd=arg0.getString(); - debugOutput( DEBUG_LEVEL_NORMAL, "(%p) CMD? %s\n", this, cmd.c_str()); + debugOutput( DEBUG_LEVEL_NORMAL, "(%p) CMD: %s\n", this, cmd.c_str()); + if(cmd == "list") { - debugOutput( DEBUG_LEVEL_NORMAL, "Listing mixer elements...\n"); - OscMessage rm=mixerListChildren(); - return OscResponse(rm); - } + debugOutput( DEBUG_LEVEL_NORMAL, "Listing root elements...\n"); + return OscResponse(rootListChildren()); + } +// if(cmd == "params") { +// debugOutput( DEBUG_LEVEL_NORMAL, "Listing root params...\n"); +// return OscResponse(rootListParams()); +// } +// if(cmd == "get") { +// +// } +// if(cmd == "set") { +// +// } + return OscResponse(OscResponse::eUnhandled); + } else { + debugWarning("Wrong command datatype\n"); + return OscResponse(OscResponse::eError); + } + } else { + debugWarning("Not enough arguments\n"); + return OscResponse(OscResponse::eError); + } +} + +OscResponse +GenericMixer::rootListChildren() { + OscMessage m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing root elements...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + bool hasSelector=false; + bool hasFeature=false; + bool hasProcessing=false; + bool hasCodec=false; + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + hasSelector |= (((*it)->getType())==FunctionBlockCmd::eFBT_Selector); + hasFeature |= (((*it)->getType())==FunctionBlockCmd::eFBT_Feature); + hasProcessing |= (((*it)->getType())==FunctionBlockCmd::eFBT_Processing); + hasCodec |= (((*it)->getType())==FunctionBlockCmd::eFBT_Codec); + } + + if (hasSelector) m.addArgument("Selector"); + if (hasFeature) m.addArgument("Feature"); + if (hasProcessing) m.addArgument("Processing"); + if (hasCodec) m.addArgument("Codec"); + + return OscResponse(m); +} + +//// SELECTOR MESSAGES + +OscResponse +GenericMixer::processOscMessageSelector(std::string path, OscMessage *m) { + debugOutput( DEBUG_LEVEL_NORMAL, "Selector: %s\n", path.c_str()); + + // delete leading slashes + if(path.find_first_of('/')==0) path=path.substr(1,path.size()); + + // delete trailing slashes + if(path.find_last_of('/')==path.size()-1) path=path.substr(0,path.size()-1); + + int id=-1; + if ((path != "") && (!from_string(id, path, std::dec))) { + debugWarning( "could not get id\n" ); + return OscResponse(OscResponse::eError); + } + + unsigned int nbArgs=m->nbArguments(); + if (nbArgs>=1) { + OscArgument arg0=m->getArgument(0); + if(arg0.isString()) { // first argument should be a string command + string cmd=arg0.getString(); + debugOutput( DEBUG_LEVEL_NORMAL, "(%p) CMD: %s\n", this, cmd.c_str()); + + if(cmd == "list") { + debugOutput( DEBUG_LEVEL_NORMAL, "Listing selector elements...\n"); + return selectorListChildren(id); + } + if(cmd == "params") { + debugOutput( DEBUG_LEVEL_NORMAL, "Listing selector %d params...\n", id); + return selectorListParams(id); + } + if(cmd == "get") { + if (nbArgs<2 || !m->getArgument(1).isString()) { + debugWarning("Argument error\n"); + m->print(); + return OscResponse(OscResponse::eError); + } + debugOutput( DEBUG_LEVEL_NORMAL, "Getting selector params %s...\n", + m->getArgument(1).getString().c_str()); + return selectorGetParam(id,m->getArgument(1).getString(), m); + } + if(cmd == "set") { + if (nbArgs<3 || !m->getArgument(1).isString() || !m->getArgument(2).isNumeric()) { + debugWarning("Argument error\n"); + m->print(); + return OscResponse(OscResponse::eError); + } + debugOutput( DEBUG_LEVEL_NORMAL, "Setting selector param %s...\n", + m->getArgument(1).getString().c_str()); + return selectorSetParam(id,m->getArgument(1).getString(), m); + } + return OscResponse(OscResponse::eUnhandled); + } else { + debugWarning("Wrong command datatype\n"); + return OscResponse(OscResponse::eError); + } + } else { + debugWarning("Not enough arguments\n"); + return OscResponse(OscResponse::eError); + } +} + +/* if(cmd == "set") { debugOutput( DEBUG_LEVEL_NORMAL, "setting mixer element...\n"); @@ -100,5 +266,5 @@ int value=m->getArgument(3).toInt(); - return mixerSetSelectorValue(id, value); + return setSelectorValue(id, value); } @@ -164,32 +330,123 @@ // default action: don't change response return OscResponse(OscResponse::eUnhandled); -} - -OscMessage -GenericMixer::mixerListChildren() { - OscMessage m; - - debugOutput(DEBUG_LEVEL_NORMAL,"Listing mixer elements...\n"); - - assert(m_device.getAudioSubunit(0)); // FIXME!! - FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); - - for ( FunctionBlockVector::iterator it = functions.begin(); - it != functions.end(); - ++it ) - { - std::ostringstream ostrm; - ostrm << (*it)->getName() << "/" << (int)((*it)->getId()); - m.addArgument(ostrm.str()); - } - - m.print(); - return m; -} - -OscResponse -GenericMixer::mixerGetSelectorValue(int fb_id) { - OscMessage m; - +}*/ + +OscResponse +GenericMixer::selectorListChildren(int id) { + OscMessage m; + + if (id != -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing selector elements...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if (((*it)->getType()) == FunctionBlockCmd::eFBT_Selector) { + ostrm << (int)((*it)->getId()); + m.addArgument(ostrm.str()); + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::selectorListParams(int id) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing selector params...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Selector) + && (((*it)->getId()) == id)) + { + m.addArgument("name"); + m.addArgument("value"); + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::selectorGetParam(int id, std::string p, OscMessage *src) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Getting selector parameter: '%s'\n", p.c_str()); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Selector) + && (((*it)->getId()) == id)) + { + if (p=="name") { + m.addArgument("testname"); + } else if (p=="value") { + int value; + if( getSelectorValue(id, value) ) { + m.addArgument(value); + } + } + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::selectorSetParam(int id, std::string p, OscMessage *src) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Setting selector parameter: '%s'\n", p.c_str()); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Selector) + && (((*it)->getId()) == id)) + { + if (p=="name") { + + } else if (p=="value") { + assert(src->nbArguments()>=3); + int value=src->getArgument(2).toInt(); + if( ! setSelectorValue(id, value) ) { + return OscResponse(OscResponse::eError); + } + } + } + } + return OscResponse(m); +} + +bool +GenericMixer::getSelectorValue(int fb_id, int &value) { debugOutput(DEBUG_LEVEL_NORMAL,"Get selector %d value...\n", fb_id); @@ -208,5 +465,5 @@ if ( !fbCmd.fire() ) { debugError( "FunctionBlockCmd failed\n" ); - return OscResponse(OscResponse::eError); + return false; } @@ -216,17 +473,10 @@ } - if (fbCmd.getResponse() != AVCCommand::eR_Accepted) { - return OscResponse(OscResponse::eError); - } - - m.addArgument((int32_t)(fbCmd.m_pFBSelector->m_inputFbPlugNumber)); - - return OscResponse(m); -} - -OscResponse -GenericMixer::mixerSetSelectorValue(int fb_id, int value) { - OscMessage m; - + value=(int)(fbCmd.m_pFBSelector->m_inputFbPlugNumber); + return (fbCmd.getResponse() == AVCCommand::eR_Implemented); +} + +bool +GenericMixer::setSelectorValue(int fb_id, int value) { debugOutput(DEBUG_LEVEL_NORMAL,"Set selector %d to %d...\n", fb_id, value); @@ -245,5 +495,5 @@ if ( !fbCmd.fire() ) { debugError( "FunctionBlockCmd failed\n" ); - return OscResponse(OscResponse::eError); + return false; } @@ -253,16 +503,228 @@ } - if (fbCmd.getResponse() != AVCCommand::eR_Accepted) { + return (fbCmd.getResponse() == AVCCommand::eR_Accepted); +} + + +//// FEATURE +OscResponse +GenericMixer::processOscMessageFeature(std::string path, OscMessage *m) { + debugOutput( DEBUG_LEVEL_NORMAL, "Feature: %s\n", path.c_str()); + // delete leading slashes + if(path.find_first_of('/')==0) path=path.substr(1,path.size()); + + // delete trailing slashes + if(path.find_last_of('/')==path.size()-1) path=path.substr(0,path.size()-1); + + int id=-1; + if ((path != "") && (!from_string(id, path, std::dec))) { + debugWarning( "could not get id\n" ); return OscResponse(OscResponse::eError); } - return OscResponse(m); -} - -OscResponse -GenericMixer::mixerSetFeatureVolumeValue(int fb_id, int channel, + unsigned int nbArgs=m->nbArguments(); + if (nbArgs>=1) { + OscArgument arg0=m->getArgument(0); + if(arg0.isString()) { // first argument should be a string command + string cmd=arg0.getString(); + debugOutput( DEBUG_LEVEL_NORMAL, "(%p) CMD: %s\n", this, cmd.c_str()); + + if(cmd == "list") { + debugOutput( DEBUG_LEVEL_NORMAL, "Listing feature elements...\n"); + return featureListChildren(id); + } + if(cmd == "params") { + debugOutput( DEBUG_LEVEL_NORMAL, "Listing feature %d params...\n", id); + return featureListParams(id); + } + if(cmd == "get") { + if (nbArgs<2 || !m->getArgument(1).isString()) { + debugWarning("Argument error\n"); + m->print(); + return OscResponse(OscResponse::eError); + } + debugOutput( DEBUG_LEVEL_NORMAL, "Getting feature param %s...\n", + m->getArgument(1).getString().c_str()); + return featureGetParam(id,m->getArgument(1).getString(), m); + } + if(cmd == "set") { + if (nbArgs<3 || !m->getArgument(1).isString()) { + debugWarning("Argument error\n"); + m->print(); + return OscResponse(OscResponse::eError); + } + debugOutput( DEBUG_LEVEL_NORMAL, "Setting feature param %s...\n", + m->getArgument(1).getString().c_str()); + return featureSetParam(id,m->getArgument(1).getString(), m); + } + return OscResponse(OscResponse::eUnhandled); + } else { + debugWarning("Wrong command datatype\n"); + return OscResponse(OscResponse::eError); + } + } else { + debugWarning("Not enough arguments\n"); + return OscResponse(OscResponse::eError); + } + +} + +OscResponse +GenericMixer::featureListChildren(int id) { + OscMessage m; + + if (id != -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing feature elements...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if (((*it)->getType()) == FunctionBlockCmd::eFBT_Feature) { + ostrm << (int)((*it)->getId()); + m.addArgument(ostrm.str()); + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::featureListParams(int id) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing feature params...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Feature) + && (((*it)->getId()) == id)) + { + m.addArgument("name"); + m.addArgument("volume"); + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::featureGetParam(int id, std::string p, OscMessage *src) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Getting feature parameter: '%s'\n", p.c_str()); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Feature) + && (((*it)->getId()) == id)) + { + if (p=="name") { + m.addArgument("testname"); + } else if (p=="volume") { + if (src->nbArguments()<3) return OscResponse(OscResponse::eError); + int value; + int channel=src->getArgument(2).toInt(); + + if( getFeatureVolumeValue(id, channel, value) ) { + m.addArgument(value); + } + } + } + } + return OscResponse(m); +} + +OscResponse +GenericMixer::featureSetParam(int id, std::string p, OscMessage *src) { + OscMessage m; + + if (id == -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Setting feature parameter: '%s'\n", p.c_str()); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if ((((*it)->getType()) == FunctionBlockCmd::eFBT_Feature) + && (((*it)->getId()) == id)) + { + if (p=="name") { + m.addArgument("testname"); + } else if (p=="volume") { + if (src->nbArguments()<4) return OscResponse(OscResponse::eError); + int channel=src->getArgument(2).toInt(); + int value=src->getArgument(3).toInt();; + + if( !setFeatureVolumeValue(id, channel, value) ) { + return OscResponse(OscResponse::eError); + } + } + } + } + return OscResponse(m); +} + + +bool +GenericMixer::getFeatureVolumeValue(int fb_id, int channel, int &volume) { + OscMessage m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Get feature volume %d channel %d...\n", + fb_id, channel); + + FunctionBlockCmd fbCmd( m_p1394Service, + FunctionBlockCmd::eFBT_Feature, + fb_id, + FunctionBlockCmd::eCA_Current ); + fbCmd.setNodeId( m_device.getNodeId() ); + fbCmd.setSubunitId( 0x00 ); + fbCmd.setCommandType( AVCCommand::eCT_Status ); + fbCmd.m_pFBFeature->m_audioChannelNumber=channel; + fbCmd.m_pFBFeature->m_controlSelector=FunctionBlockFeature::eCSE_Feature_Volume; + fbCmd.m_pFBFeature->m_pVolume->m_volume=0; + + if ( !fbCmd.fire() ) { + debugError( "cmd failed\n" ); + return false; + } + + if ( getDebugLevel() >= DEBUG_LEVEL_NORMAL ) { + CoutSerializer se; + fbCmd.serialize( se ); + } + + volume=(int)(fbCmd.m_pFBFeature->m_pVolume->m_volume); + + return (fbCmd.getResponse() == AVCCommand::eR_Implemented); +} + +bool +GenericMixer::setFeatureVolumeValue(int fb_id, int channel, int volume) { - OscMessage m; - debugOutput(DEBUG_LEVEL_NORMAL,"Set feature volume %d channel %d to %d...\n", fb_id, channel, volume); @@ -281,41 +743,70 @@ if ( !fbCmd.fire() ) { debugError( "cmd failed\n" ); - } - - if (fbCmd.getResponse() != AVCCommand::eR_Accepted) { - return OscResponse(OscResponse::eError); - } - - return OscResponse(m); -} + return false; + } + + if ( getDebugLevel() >= DEBUG_LEVEL_NORMAL ) { + CoutSerializer se; + fbCmd.serialize( se ); + } + + return (fbCmd.getResponse() == AVCCommand::eR_Accepted); +} + +//// PROCESSING OscResponse -GenericMixer::mixerGetFeatureVolumeValue(int fb_id, int channel) { - OscMessage m; - - debugOutput(DEBUG_LEVEL_NORMAL,"Get feature volume %d channel %d...\n", - fb_id, channel); - - FunctionBlockCmd fbCmd( m_p1394Service, - FunctionBlockCmd::eFBT_Feature, - fb_id, - FunctionBlockCmd::eCA_Current ); - fbCmd.setNodeId( m_device.getNodeId() ); - fbCmd.setSubunitId( 0x00 ); - fbCmd.setCommandType( AVCCommand::eCT_Status ); - fbCmd.m_pFBFeature->m_audioChannelNumber=channel; - fbCmd.m_pFBFeature->m_controlSelector=FunctionBlockFeature::eCSE_Feature_Volume; - fbCmd.m_pFBFeature->m_pVolume->m_volume=0; - - if ( !fbCmd.fire() ) { - debugError( "cmd failed\n" ); - } - - if (fbCmd.getResponse() != AVCCommand::eR_Accepted) { - return OscResponse(OscResponse::eError); - } - - m.addArgument((int32_t)(fbCmd.m_pFBFeature->m_pVolume->m_volume)); - +GenericMixer::processOscMessageProcessing(std::string path, OscMessage *m) { + debugOutput( DEBUG_LEVEL_NORMAL, "Processing: %s\n", path.c_str()); + return OscResponse(OscResponse::eUnhandled); +} + +OscResponse +GenericMixer::processingListChildren(int id) { + OscMessage m; + + if (id != -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing processing elements...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if (((*it)->getType()) == FunctionBlockCmd::eFBT_Processing) { + ostrm << (int)((*it)->getId()); + m.addArgument(ostrm.str()); + } + } + return OscResponse(m); +} + +//// CODEC + +OscResponse +GenericMixer::codecListChildren(int id) { + OscMessage m; + + if (id != -1) return m; + + debugOutput(DEBUG_LEVEL_NORMAL,"Listing codec elements...\n"); + + assert(m_device.getAudioSubunit(0)); // FIXME!! + FunctionBlockVector functions=m_device.getAudioSubunit(0)->getFunctionBlocks(); + + for ( FunctionBlockVector::iterator it = functions.begin(); + it != functions.end(); + ++it ) + { + std::ostringstream ostrm; + if (((*it)->getType()) == FunctionBlockCmd::eFBT_Codec) { + ostrm << (int)((*it)->getId()); + m.addArgument(ostrm.str()); + } + } return OscResponse(m); } Index: /trunk/libffado/src/bebob/GenericMixer.h =================================================================== --- /trunk/libffado/src/bebob/GenericMixer.h (revision 455) +++ /trunk/libffado/src/bebob/GenericMixer.h (revision 462) @@ -48,10 +48,29 @@ protected: - OSC::OscMessage mixerListChildren(); - OSC::OscResponse mixerGetSelectorValue(int id); - OSC::OscResponse mixerSetSelectorValue(int id, int value); + OSC::OscResponse processOscMessageRoot(OSC::OscMessage *m); + OSC::OscResponse processOscMessageSelector(std::string, OSC::OscMessage *m); + OSC::OscResponse processOscMessageFeature(std::string, OSC::OscMessage *m); + OSC::OscResponse processOscMessageProcessing(std::string, OSC::OscMessage *m); + +protected: + OSC::OscResponse rootListChildren(); + OSC::OscResponse selectorListChildren(int); + OSC::OscResponse selectorListParams(int id); + OSC::OscResponse selectorGetParam(int id, std::string p, OSC::OscMessage *src); + OSC::OscResponse selectorSetParam(int id, std::string p, OSC::OscMessage *src); + + OSC::OscResponse featureListChildren(int); + OSC::OscResponse featureListParams(int id); + OSC::OscResponse featureGetParam(int id, std::string p, OSC::OscMessage *src); + OSC::OscResponse featureSetParam(int id, std::string p, OSC::OscMessage *src); - OSC::OscResponse mixerSetFeatureVolumeValue(int id, int channel, int volume); - OSC::OscResponse mixerGetFeatureVolumeValue(int fb_id, int channel); + OSC::OscResponse processingListChildren(int); + OSC::OscResponse codecListChildren(int); + + bool getSelectorValue(int id, int &value); + bool setSelectorValue(int id, int value); + + bool getFeatureVolumeValue(int fb_id, int channel, int &volume); + bool setFeatureVolumeValue(int id, int channel, int volume); protected: Index: /trunk/libffado/src/libosc/OscServer.cpp =================================================================== --- /trunk/libffado/src/libosc/OscServer.cpp (revision 445) +++ /trunk/libffado/src/libosc/OscServer.cpp (revision 462) @@ -178,5 +178,9 @@ return 0; } else { - debugOutput(DEBUG_LEVEL_VERBOSE, " Not handled...\n"); + if (r.isError()) { + debugOutput(DEBUG_LEVEL_VERBOSE, " Error in message...\n"); + } else { + debugOutput(DEBUG_LEVEL_VERBOSE, " Not handled...\n"); + } m.print(); return 1; // not handled Index: /trunk/libffado/support/mixer/mixer_phase88.ui.h =================================================================== --- /trunk/libffado/support/mixer/mixer_phase88.ui.h (revision 459) +++ /trunk/libffado/support/mixer/mixer_phase88.ui.h (revision 462) @@ -22,5 +22,5 @@ print "switching front/back state to %d" % state - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "selector", 10, state]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Selector/10", ["set", "value", state]).sendlocal(17820) } @@ -28,5 +28,5 @@ { print "switching out assign to %d" % a0 - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "selector", 6, a0]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Selector/6", ["set", "value", a0]).sendlocal(17820) } @@ -34,5 +34,5 @@ { print "switching input assign to %d" % a0 - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "selector", 7, a0]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Selector/7", ["set", "value", a0]).sendlocal(17820) } @@ -40,5 +40,5 @@ { print "switching sync source to %d" % a0 - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "selector", 9, a0]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Selector/9", ["set", "value", a0]).sendlocal(17820) } @@ -46,7 +46,6 @@ { print "switching external sync source to %d" % a0 - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "selector", 8, a0]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Selector/8", ["set", "value", a0]).sendlocal(17820) } - void Phase88Control::setVolume12( int ) @@ -54,7 +53,6 @@ vol = -a0 print "setting volume for 1/2 to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 2 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/2", ["set", "volume", 0, vol]).sendlocal(17820) } - void Phase88Control::setVolume34( int ) @@ -62,7 +60,6 @@ vol = -a0 print "setting volume for 3/4 to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 3 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/3", ["set", "volume", 0, vol]).sendlocal(17820) } - void Phase88Control::setVolume56( int ) @@ -70,6 +67,5 @@ vol = -a0 print "setting volume for 5/6 to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 4 , 0, vol]).sendlocal(17820) - + osc.Message("/devicemanager/dev0/GenericMixer/Feature/4", ["set", "volume", 0, vol]).sendlocal(17820) } @@ -78,5 +74,5 @@ vol = -a0 print "setting volume for 7/8 to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 5 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/5", ["set", "volume", 0, vol]).sendlocal(17820) } @@ -85,5 +81,5 @@ vol = -a0 print "setting volume for S/PDIF to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 6 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/6", ["set", "volume", 0, vol]).sendlocal(17820) } @@ -92,5 +88,5 @@ vol = -a0 print "setting volume for WavePlay to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 1 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/7", ["set", "volume", 0, vol]).sendlocal(17820) } @@ -99,4 +95,4 @@ vol = -a0 print "setting master volume to %d" % vol - osc.Message("/devicemanager/dev0/GenericMixer", ["set", "volume", 7 , 0, vol]).sendlocal(17820) + osc.Message("/devicemanager/dev0/GenericMixer/Feature/1", ["set", "volume", 0, vol]).sendlocal(17820) }