Index: /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.cpp =================================================================== --- /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.cpp (revision 508) +++ /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.cpp (revision 508) @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2007 by Pieter Palmers + * Copyright (C) 2005-2007 by Daniel Wagner + * + * This file is part of FFADO + * FFADO = Free Firewire (pro-)audio drivers for linux + * + * FFADO is based upon FreeBoB + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation; + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#warning this header should go +#include "bebob/bebob_avplug.h" +#include "libieee1394/configrom.h" + +#include "../general/avc_subunit.h" +#include "../general/avc_unit.h" + +#include "../general/avc_plug_info.h" +#include "../streamformat/avc_extended_stream_format.h" +#include "../util/avc_serialize.h" + +#include + +namespace AVC { + +//////////////////////////////////////////// + +SubunitMusic::SubunitMusic( Unit& unit, subunit_t id ) + : Subunit( unit, eST_Music, id ) +{ +} + +SubunitMusic::SubunitMusic() + : Subunit() +{ +} + +SubunitMusic::~SubunitMusic() +{ +} + +const char* +SubunitMusic::getName() +{ + return "MusicSubunit"; +} + +bool +SubunitMusic::serializeChild( Glib::ustring basePath, + Util::IOSerialize& ser ) const +{ + return true; +} + +bool +SubunitMusic::deserializeChild( Glib::ustring basePath, + Util::IODeserialize& deser, + Unit& unit ) +{ + return true; +} + +} Index: /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.h =================================================================== --- /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.h (revision 508) +++ /branches/echoaudio/src/libavc/musicsubunit/avc_musicsubunit.h (revision 508) @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2007 by Pieter Palmers + * Copyright (C) 2005-2007 by Daniel Wagner + * + * This file is part of FFADO + * FFADO = Free Firewire (pro-)audio drivers for linux + * + * FFADO is based upon FreeBoB + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation; + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef AVC_MUSICSUBUNIT_H +#define AVC_MUSICSUBUNIT_H + +#include +#include "libutil/serialize.h" + +namespace AVC { + +class Unit; + +// ///////////////////////////// + +class SubunitMusic: public Subunit { + public: + SubunitMusic( Unit& avDevice, + subunit_t id ); + SubunitMusic(); + virtual ~SubunitMusic(); + + virtual const char* getName(); + +protected: + virtual bool serializeChild( Glib::ustring basePath, + Util::IOSerialize& ser ) const; + virtual bool deserializeChild( Glib::ustring basePath, + Util::IODeserialize& deser, + Unit& avDevice ); +}; + +} + +#endif Index: /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp =================================================================== --- /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp (revision 508) +++ /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.cpp (revision 508) @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2007 by Pieter Palmers + * Copyright (C) 2005-2007 by Daniel Wagner + * + * This file is part of FFADO + * FFADO = Free Firewire (pro-)audio drivers for linux + * + * FFADO is based upon FreeBoB + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation; + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include "avc_audiosubunit.h" +#include "../general/avc_subunit.h" + +#warning merge with bebob functionblock +#include "bebob/bebob_functionblock.h" +#include "../audiosubunit/avc_function_block.h" + + +#include + +namespace AVC { + +//////////////////////////////////////////// + +SubunitAudio::SubunitAudio( Unit& unit, subunit_t id ) + : Subunit( unit, eST_Audio, id ) +{ +} + +SubunitAudio::SubunitAudio() + : Subunit() +{ +} + +SubunitAudio::~SubunitAudio() +{ + for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); + it != m_functions.end(); + ++it ) + { + delete *it; + } +} + +bool +SubunitAudio::discover() +{ + debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n"); + + if ( !Subunit::discover() ) { + return false; + } + +// if ( !discoverBeBoB::FunctionBlocks() ) { +// debugError( "function block discovering failed\n" ); +// return false; +// } + + return true; +} + + +const char* +SubunitAudio::getName() +{ + return "AudioSubunit"; +} + +// bool +// SubunitAudio::discoverConnections() +// { +// debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); +// if ( !Subunit::discoverConnections() ) { +// return false; +// } +// +// for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); +// it != m_functions.end(); +// ++it ) +// { +// BeBoB::FunctionBlock* function = *it; +// if ( !function->discoverConnections() ) { +// debugError( "functionblock connection discovering failed ('%s')\n", +// function->getName() ); +// return false; +// } +// } +// +// return true; +// } +// bool +// SubunitAudio::discoverBeBoB::FunctionBlocks() +// { +// debugOutput( DEBUG_LEVEL_NORMAL, +// "Discovering function blocks...\n"); +// +// if ( !discoverBeBoB::FunctionBlocksDo( +// ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector) ) +// { +// debugError( "Could not discover function block selector\n" ); +// return false; +// } +// if ( !discoverBeBoB::FunctionBlocksDo( +// ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature) ) +// { +// debugError( "Could not discover function block feature\n" ); +// return false; +// } +// if ( !discoverBeBoB::FunctionBlocksDo( +// ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing) ) +// { +// debugError( "Could not discover function block processing\n" ); +// return false; +// } +// if ( !discoverBeBoB::FunctionBlocksDo( +// ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec) ) +// { +// debugError( "Could not discover function block codec\n" ); +// return false; +// } +// +// // print a function block list +// #ifdef DEBUG +// if (getDebugLevel() >= DEBUG_LEVEL_NORMAL) { +// +// for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); +// it != m_functions.end(); +// ++it ) +// { +// debugOutput(DEBUG_LEVEL_NORMAL, "%20s FB, type 0x%X, id=%d\n", +// (*it)->getName(), +// (*it)->getType(), +// (*it)->getId()); +// } +// } +// #endif +// +// return true; +// } +// +// bool +// SubunitAudio::discoverBeBoB::FunctionBlocksDo( +// ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType ) +// { +// int page = 0; +// bool cmdSuccess = false; +// bool finished = false; +// +// do { +// ExtendedSubunitInfoCmd +// extSubunitInfoCmd( m_unit->get1394Service() ); +// extSubunitInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); +// extSubunitInfoCmd.setCommandType( AVCCommand::eCT_Status ); +// extSubunitInfoCmd.setSubunitId( getSubunitId() ); +// extSubunitInfoCmd.setSubunitType( getSubunitType() ); +// extSubunitInfoCmd.setVerbose( m_verboseLevel ); +// +// extSubunitInfoCmd.m_fbType = fbType; +// extSubunitInfoCmd.m_page = page; +// +// cmdSuccess = extSubunitInfoCmd.fire(); +// if ( cmdSuccess +// && ( extSubunitInfoCmd.getResponse() +// == AVCCommand::eR_Implemented ) ) +// { +// for ( ExtendedSubunitInfoPageDataVector::iterator it = +// extSubunitInfoCmd.m_infoPageDatas.begin(); +// cmdSuccess +// && ( it != extSubunitInfoCmd.m_infoPageDatas.end() ); +// ++it ) +// { +// cmdSuccess = createBeBoB::FunctionBlock( fbType, **it ); +// } +// if ( ( extSubunitInfoCmd.m_infoPageDatas.size() != 0 ) +// && ( extSubunitInfoCmd.m_infoPageDatas.size() == 5 ) ) +// { +// page++; +// } else { +// finished = true; +// } +// } else { +// finished = true; +// } +// } while ( cmdSuccess && !finished ); +// +// return cmdSuccess; +// } +// +// bool +// SubunitAudio::createBeBoB::FunctionBlock( +// ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType, +// ExtendedSubunitInfoPageData& data ) +// { +// BeBoB::FunctionBlock::ESpecialPurpose purpose +// = convertSpecialPurpose( data.m_functionBlockSpecialPupose ); +// +// BeBoB::FunctionBlock* fb = 0; +// +// switch ( fbType ) { +// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector: +// { +// fb = new BeBoB::FunctionBlockSelector( *this, +// data.m_functionBlockId, +// purpose, +// data.m_noOfInputPlugs, +// data.m_noOfOutputPlugs, +// m_verboseLevel ); +// } +// break; +// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature: +// { +// fb = new BeBoB::FunctionBlockFeature( *this, +// data.m_functionBlockId, +// purpose, +// data.m_noOfInputPlugs, +// data.m_noOfOutputPlugs, +// m_verboseLevel ); +// } +// break; +// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing: +// { +// switch ( data.m_functionBlockType ) { +// case ExtendedSubunitInfoCmd::ePT_EnhancedMixer: +// { +// fb = new BeBoB::FunctionBlockEnhancedMixer( *this, +// data.m_functionBlockId, +// purpose, +// data.m_noOfInputPlugs, +// data.m_noOfOutputPlugs, +// m_verboseLevel ); +// } +// break; +// case ExtendedSubunitInfoCmd::ePT_Mixer: +// case ExtendedSubunitInfoCmd::ePT_Generic: +// case ExtendedSubunitInfoCmd::ePT_UpDown: +// case ExtendedSubunitInfoCmd::ePT_DolbyProLogic: +// case ExtendedSubunitInfoCmd::ePT_3DStereoExtender: +// case ExtendedSubunitInfoCmd::ePT_Reverberation: +// case ExtendedSubunitInfoCmd::ePT_Chorus: +// case ExtendedSubunitInfoCmd::ePT_DynamicRangeCompression: +// default: +// fb = new BeBoB::FunctionBlockProcessing( *this, +// data.m_functionBlockId, +// purpose, +// data.m_noOfInputPlugs, +// data.m_noOfOutputPlugs, +// m_verboseLevel ); +// debugWarning( "Dummy function block processing created. " +// "Implementation is missing\n" ); +// } +// } +// break; +// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec: +// { +// fb = new BeBoB::FunctionBlockCodec( *this, +// data.m_functionBlockId, +// purpose, +// data.m_noOfInputPlugs, +// data.m_noOfOutputPlugs, +// m_verboseLevel ); +// debugWarning( "Dummy function block codec created. " +// "Implementation is missing\n" ); +// } +// break; +// default: +// debugError( "Unhandled function block type found\n" ); +// return false; +// } +// +// if ( !fb ) { +// debugError( "Could create function block\n" ); +// return false; +// } +// if ( !fb->discover() ) { +// debugError( "Could not discover function block %s\n", +// fb->getName() ); +// delete fb; +// return false; +// } +// m_functions.push_back( fb ); +// +// return true; +// } +// +// BeBoB::FunctionBlock::ESpecialPurpose +// SubunitAudio::convertSpecialPurpose( +// function_block_special_purpose_t specialPurpose ) +// { +// BeBoB::FunctionBlock::ESpecialPurpose p; +// switch ( specialPurpose ) { +// case ExtendedSubunitInfoPageData::eSP_InputGain: +// p = BeBoB::FunctionBlock::eSP_InputGain; +// break; +// case ExtendedSubunitInfoPageData::eSP_OutputVolume: +// p = BeBoB::FunctionBlock::eSP_OutputVolume; +// break; +// default: +// p = BeBoB::FunctionBlock::eSP_NoSpecialPurpose; +// } +// return p; +// } +// +bool +SubunitAudio::serializeChild( Glib::ustring basePath, + Util::IOSerialize& ser ) const +{ + bool result = true; + int i = 0; + + for ( BeBoB::FunctionBlockVector::const_iterator it = m_functions.begin(); + it != m_functions.end(); + ++it ) + { + BeBoB::FunctionBlock* pFB = *it; + std::ostringstream strstrm; + strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; + + result &= pFB->serialize( strstrm.str() , ser ); + + i++; + } + + return result; +} + +bool +SubunitAudio::deserializeChild( Glib::ustring basePath, + Util::IODeserialize& deser, + Unit& unit ) +{ + int i = 0; + bool bFinished = false; + do { + std::ostringstream strstrm; + strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; + BeBoB::FunctionBlock* pFB = BeBoB::FunctionBlock::deserialize( strstrm.str(), + deser, + unit, + *this ); + if ( pFB ) { + m_functions.push_back( pFB ); + i++; + } else { + bFinished = true; + } + } while ( !bFinished ); + + return true; +} + +} Index: /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.h =================================================================== --- /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.h (revision 508) +++ /branches/echoaudio/src/libavc/audiosubunit/avc_audiosubunit.h (revision 508) @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007 by Pieter Palmers + * Copyright (C) 2005-2007 by Daniel Wagner + * + * This file is part of FFADO + * FFADO = Free Firewire (pro-)audio drivers for linux + * + * FFADO is based upon FreeBoB + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation; + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#ifndef AVC_AUDIOSUBUNIT_H +#define AVC_AUDIOSUBUNIT_H + +#include "debugmodule/debugmodule.h" + +#include "../general/avc_subunit.h" + +#include + +#warning merge with bebob functionblock +#include "bebob/bebob_functionblock.h" +#include "../audiosubunit/avc_function_block.h" + +namespace AVC { + +class Unit; +// ///////////////////////////// + +class SubunitAudio: public Subunit { + public: + SubunitAudio( Unit& avDevice, + subunit_t id ); + SubunitAudio(); + virtual ~SubunitAudio(); + + virtual bool discover(); +// virtual bool discoverConnections(); +// + virtual const char* getName(); +// + BeBoB::FunctionBlockVector getFunctionBlocks() { return m_functions; }; +// +// protected: +// bool discoverFunctionBlocks(); +// bool discoverFunctionBlocksDo( +// ExtendedSubunitInfoCmd::EFunctionBlockType fbType ); +// bool createFunctionBlock( +// ExtendedSubunitInfoCmd::EFunctionBlockType fbType, +// ExtendedSubunitInfoPageData& data ); +// +// FunctionBlock::ESpecialPurpose convertSpecialPurpose( +// function_block_special_purpose_t specialPurpose ); + + virtual bool serializeChild( Glib::ustring basePath, + Util::IOSerialize& ser ) const; + virtual bool deserializeChild( Glib::ustring basePath, + Util::IODeserialize& deser, + Unit& avDevice ); + +protected: + BeBoB::FunctionBlockVector m_functions; +}; + +} + +#endif Index: /branches/echoaudio/src/libavc/general/avc_unit.h =================================================================== --- /branches/echoaudio/src/libavc/general/avc_unit.h (revision 507) +++ /branches/echoaudio/src/libavc/general/avc_unit.h (revision 508) @@ -32,6 +32,8 @@ #include "../avc_definitions.h" #include "../general/avc_extended_cmd_generic.h" -#include "avc_subunit.h" -#include "avc_plug.h" +#include "../general/avc_subunit.h" +#include "../general/avc_plug.h" +#include "../musicsubunit/avc_musicsubunit.h" +#include "../audiosubunit/avc_audiosubunit.h" #include "libutil/serialize.h" Index: /branches/echoaudio/src/libavc/general/avc_subunit.cpp =================================================================== --- /branches/echoaudio/src/libavc/general/avc_subunit.cpp (revision 507) +++ /branches/echoaudio/src/libavc/general/avc_subunit.cpp (revision 508) @@ -1,3 +1,4 @@ /* + * Copyright (C) 2007 by Pieter Palmers * Copyright (C) 2005-2007 by Daniel Wagner * @@ -24,6 +25,7 @@ #include "avc_subunit.h" -#include "avc_unit.h" -#include "bebob/bebob_avplug.h" +#include "../general/avc_unit.h" +#include "../general/avc_plug.h" + #include "libieee1394/configrom.h" @@ -33,4 +35,7 @@ #include + +#warning do we need this? +#include "bebob/bebob_avplug.h" namespace AVC { @@ -152,368 +157,3 @@ } -//////////////////////////////////////////// - -SubunitAudio::SubunitAudio( Unit& unit, subunit_t id ) - : Subunit( unit, eST_Audio, id ) -{ } - -SubunitAudio::SubunitAudio() - : Subunit() -{ -} - -SubunitAudio::~SubunitAudio() -{ - for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); - it != m_functions.end(); - ++it ) - { - delete *it; - } -} - -bool -SubunitAudio::discover() -{ - debugOutput(DEBUG_LEVEL_NORMAL, "Discovering Audio Subunit...\n"); - - if ( !Subunit::discover() ) { - return false; - } - -// if ( !discoverBeBoB::FunctionBlocks() ) { -// debugError( "function block discovering failed\n" ); -// return false; -// } - - return true; -} - - -const char* -SubunitAudio::getName() -{ - return "AudioSubunit"; -} - -// bool -// SubunitAudio::discoverConnections() -// { -// debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); -// if ( !Subunit::discoverConnections() ) { -// return false; -// } -// -// for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); -// it != m_functions.end(); -// ++it ) -// { -// BeBoB::FunctionBlock* function = *it; -// if ( !function->discoverConnections() ) { -// debugError( "functionblock connection discovering failed ('%s')\n", -// function->getName() ); -// return false; -// } -// } -// -// return true; -// } -// bool -// SubunitAudio::discoverBeBoB::FunctionBlocks() -// { -// debugOutput( DEBUG_LEVEL_NORMAL, -// "Discovering function blocks...\n"); -// -// if ( !discoverBeBoB::FunctionBlocksDo( -// ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector) ) -// { -// debugError( "Could not discover function block selector\n" ); -// return false; -// } -// if ( !discoverBeBoB::FunctionBlocksDo( -// ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature) ) -// { -// debugError( "Could not discover function block feature\n" ); -// return false; -// } -// if ( !discoverBeBoB::FunctionBlocksDo( -// ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing) ) -// { -// debugError( "Could not discover function block processing\n" ); -// return false; -// } -// if ( !discoverBeBoB::FunctionBlocksDo( -// ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec) ) -// { -// debugError( "Could not discover function block codec\n" ); -// return false; -// } -// -// // print a function block list -// #ifdef DEBUG -// if (getDebugLevel() >= DEBUG_LEVEL_NORMAL) { -// -// for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); -// it != m_functions.end(); -// ++it ) -// { -// debugOutput(DEBUG_LEVEL_NORMAL, "%20s FB, type 0x%X, id=%d\n", -// (*it)->getName(), -// (*it)->getType(), -// (*it)->getId()); -// } -// } -// #endif -// -// return true; -// } -// -// bool -// SubunitAudio::discoverBeBoB::FunctionBlocksDo( -// ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType ) -// { -// int page = 0; -// bool cmdSuccess = false; -// bool finished = false; -// -// do { -// ExtendedSubunitInfoCmd -// extSubunitInfoCmd( m_unit->get1394Service() ); -// extSubunitInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); -// extSubunitInfoCmd.setCommandType( AVCCommand::eCT_Status ); -// extSubunitInfoCmd.setSubunitId( getSubunitId() ); -// extSubunitInfoCmd.setSubunitType( getSubunitType() ); -// extSubunitInfoCmd.setVerbose( m_verboseLevel ); -// -// extSubunitInfoCmd.m_fbType = fbType; -// extSubunitInfoCmd.m_page = page; -// -// cmdSuccess = extSubunitInfoCmd.fire(); -// if ( cmdSuccess -// && ( extSubunitInfoCmd.getResponse() -// == AVCCommand::eR_Implemented ) ) -// { -// for ( ExtendedSubunitInfoPageDataVector::iterator it = -// extSubunitInfoCmd.m_infoPageDatas.begin(); -// cmdSuccess -// && ( it != extSubunitInfoCmd.m_infoPageDatas.end() ); -// ++it ) -// { -// cmdSuccess = createBeBoB::FunctionBlock( fbType, **it ); -// } -// if ( ( extSubunitInfoCmd.m_infoPageDatas.size() != 0 ) -// && ( extSubunitInfoCmd.m_infoPageDatas.size() == 5 ) ) -// { -// page++; -// } else { -// finished = true; -// } -// } else { -// finished = true; -// } -// } while ( cmdSuccess && !finished ); -// -// return cmdSuccess; -// } -// -// bool -// SubunitAudio::createBeBoB::FunctionBlock( -// ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType, -// ExtendedSubunitInfoPageData& data ) -// { -// BeBoB::FunctionBlock::ESpecialPurpose purpose -// = convertSpecialPurpose( data.m_functionBlockSpecialPupose ); -// -// BeBoB::FunctionBlock* fb = 0; -// -// switch ( fbType ) { -// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector: -// { -// fb = new BeBoB::FunctionBlockSelector( *this, -// data.m_functionBlockId, -// purpose, -// data.m_noOfInputPlugs, -// data.m_noOfOutputPlugs, -// m_verboseLevel ); -// } -// break; -// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature: -// { -// fb = new BeBoB::FunctionBlockFeature( *this, -// data.m_functionBlockId, -// purpose, -// data.m_noOfInputPlugs, -// data.m_noOfOutputPlugs, -// m_verboseLevel ); -// } -// break; -// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing: -// { -// switch ( data.m_functionBlockType ) { -// case ExtendedSubunitInfoCmd::ePT_EnhancedMixer: -// { -// fb = new BeBoB::FunctionBlockEnhancedMixer( *this, -// data.m_functionBlockId, -// purpose, -// data.m_noOfInputPlugs, -// data.m_noOfOutputPlugs, -// m_verboseLevel ); -// } -// break; -// case ExtendedSubunitInfoCmd::ePT_Mixer: -// case ExtendedSubunitInfoCmd::ePT_Generic: -// case ExtendedSubunitInfoCmd::ePT_UpDown: -// case ExtendedSubunitInfoCmd::ePT_DolbyProLogic: -// case ExtendedSubunitInfoCmd::ePT_3DStereoExtender: -// case ExtendedSubunitInfoCmd::ePT_Reverberation: -// case ExtendedSubunitInfoCmd::ePT_Chorus: -// case ExtendedSubunitInfoCmd::ePT_DynamicRangeCompression: -// default: -// fb = new BeBoB::FunctionBlockProcessing( *this, -// data.m_functionBlockId, -// purpose, -// data.m_noOfInputPlugs, -// data.m_noOfOutputPlugs, -// m_verboseLevel ); -// debugWarning( "Dummy function block processing created. " -// "Implementation is missing\n" ); -// } -// } -// break; -// case ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec: -// { -// fb = new BeBoB::FunctionBlockCodec( *this, -// data.m_functionBlockId, -// purpose, -// data.m_noOfInputPlugs, -// data.m_noOfOutputPlugs, -// m_verboseLevel ); -// debugWarning( "Dummy function block codec created. " -// "Implementation is missing\n" ); -// } -// break; -// default: -// debugError( "Unhandled function block type found\n" ); -// return false; -// } -// -// if ( !fb ) { -// debugError( "Could create function block\n" ); -// return false; -// } -// if ( !fb->discover() ) { -// debugError( "Could not discover function block %s\n", -// fb->getName() ); -// delete fb; -// return false; -// } -// m_functions.push_back( fb ); -// -// return true; -// } -// -// BeBoB::FunctionBlock::ESpecialPurpose -// SubunitAudio::convertSpecialPurpose( -// function_block_special_purpose_t specialPurpose ) -// { -// BeBoB::FunctionBlock::ESpecialPurpose p; -// switch ( specialPurpose ) { -// case ExtendedSubunitInfoPageData::eSP_InputGain: -// p = BeBoB::FunctionBlock::eSP_InputGain; -// break; -// case ExtendedSubunitInfoPageData::eSP_OutputVolume: -// p = BeBoB::FunctionBlock::eSP_OutputVolume; -// break; -// default: -// p = BeBoB::FunctionBlock::eSP_NoSpecialPurpose; -// } -// return p; -// } -// -bool -SubunitAudio::serializeChild( Glib::ustring basePath, - Util::IOSerialize& ser ) const -{ - bool result = true; - int i = 0; - - for ( BeBoB::FunctionBlockVector::const_iterator it = m_functions.begin(); - it != m_functions.end(); - ++it ) - { - BeBoB::FunctionBlock* pFB = *it; - std::ostringstream strstrm; - strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; - - result &= pFB->serialize( strstrm.str() , ser ); - - i++; - } - - return result; -} - -bool -SubunitAudio::deserializeChild( Glib::ustring basePath, - Util::IODeserialize& deser, - Unit& unit ) -{ - int i = 0; - bool bFinished = false; - do { - std::ostringstream strstrm; - strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; - BeBoB::FunctionBlock* pFB = BeBoB::FunctionBlock::deserialize( strstrm.str(), - deser, - unit, - *this ); - if ( pFB ) { - m_functions.push_back( pFB ); - i++; - } else { - bFinished = true; - } - } while ( !bFinished ); - - return true; -} - -//////////////////////////////////////////// - -SubunitMusic::SubunitMusic( Unit& unit, subunit_t id ) - : Subunit( unit, eST_Music, id ) -{ -} - -SubunitMusic::SubunitMusic() - : Subunit() -{ -} - -SubunitMusic::~SubunitMusic() -{ -} - -const char* -SubunitMusic::getName() -{ - return "MusicSubunit"; -} - -bool -SubunitMusic::serializeChild( Glib::ustring basePath, - Util::IOSerialize& ser ) const -{ - return true; -} - -bool -SubunitMusic::deserializeChild( Glib::ustring basePath, - Util::IODeserialize& deser, - Unit& unit ) -{ - return true; -} - -} Index: /branches/echoaudio/src/libavc/general/avc_subunit.h =================================================================== --- /branches/echoaudio/src/libavc/general/avc_subunit.h (revision 507) +++ /branches/echoaudio/src/libavc/general/avc_subunit.h (revision 508) @@ -1,3 +1,4 @@ /* + * Copyright (C) 2007 by Pieter Palmers * Copyright (C) 2005-2007 by Daniel Wagner * @@ -25,9 +26,9 @@ #define AVC_SUBUNIT_H -#include "avc_plug.h" +#include "debugmodule/debugmodule.h" -#include "debugmodule/debugmodule.h" +#include "../avc_definitions.h" +#include "../general/avc_plug.h" #include "../general/avc_extended_subunit_info.h" -#include "../avc_definitions.h" #include "../general/avc_generic.h" #include "../audiosubunit/avc_function_block.h" @@ -41,6 +42,4 @@ class Unit; - - class Subunit { @@ -56,5 +55,5 @@ #warning FIXME }; - + virtual const char* getName() = 0; @@ -63,5 +62,5 @@ ESubunitType getSubunitType() { return m_sbType; } - + bool addPlug( Plug& plug ); @@ -104,60 +103,4 @@ typedef std::vector SubunitVector; -// ///////////////////////////// - -class SubunitAudio: public Subunit { - public: - SubunitAudio( Unit& avDevice, - subunit_t id ); - SubunitAudio(); - virtual ~SubunitAudio(); - - virtual bool discover(); -// virtual bool discoverConnections(); -// - virtual const char* getName(); -// - BeBoB::FunctionBlockVector getFunctionBlocks() { return m_functions; }; -// -// protected: -// bool discoverFunctionBlocks(); -// bool discoverFunctionBlocksDo( -// ExtendedSubunitInfoCmd::EFunctionBlockType fbType ); -// bool createFunctionBlock( -// ExtendedSubunitInfoCmd::EFunctionBlockType fbType, -// ExtendedSubunitInfoPageData& data ); -// -// FunctionBlock::ESpecialPurpose convertSpecialPurpose( -// function_block_special_purpose_t specialPurpose ); - - virtual bool serializeChild( Glib::ustring basePath, - Util::IOSerialize& ser ) const; - virtual bool deserializeChild( Glib::ustring basePath, - Util::IODeserialize& deser, - Unit& avDevice ); - -protected: - BeBoB::FunctionBlockVector m_functions; -}; - -// ///////////////////////////// - -class SubunitMusic: public Subunit { - public: - SubunitMusic( Unit& avDevice, - subunit_t id ); - SubunitMusic(); - virtual ~SubunitMusic(); - - virtual const char* getName(); - -protected: - virtual bool serializeChild( Glib::ustring basePath, - Util::IOSerialize& ser ) const; - virtual bool deserializeChild( Glib::ustring basePath, - Util::IODeserialize& deser, - Unit& avDevice ); -}; - } Index: /branches/echoaudio/src/bebob/bebob_avdevice_subunit.h =================================================================== --- /branches/echoaudio/src/bebob/bebob_avdevice_subunit.h (revision 507) +++ /branches/echoaudio/src/bebob/bebob_avdevice_subunit.h (revision 508) @@ -36,4 +36,6 @@ #include "libavc/general/avc_subunit.h" +#include "libavc/musicsubunit/avc_musicsubunit.h" +#include "libavc/audiosubunit/avc_audiosubunit.h" #include "libavc/general/avc_plug.h" Index: /branches/echoaudio/src/Makefile.am =================================================================== --- /branches/echoaudio/src/Makefile.am (revision 507) +++ /branches/echoaudio/src/Makefile.am (revision 508) @@ -59,4 +59,7 @@ libavc/util/avc_serialize.h \ libavc/musicsubunit/avc_descriptor_music.h \ + libavc/musicsubunit/avc_musicsubunit.h \ + libavc/audiosubunit/avc_audiosubunit.h \ + libavc/audiosubunit/avc_function_block.h \ libavc/descriptors/avc_descriptor_cmd.h \ libavc/descriptors/avc_descriptor.h \ @@ -96,8 +99,10 @@ ffadodevice.cpp \ debugmodule/debugmodule.cpp \ - libavc/audiosubunit/avc_function_block.cpp \ libavc/streamformat/avc_extended_stream_format.cpp \ libavc/util/avc_serialize.cpp \ libavc/musicsubunit/avc_descriptor_music.cpp \ + libavc/musicsubunit/avc_musicsubunit.cpp \ + libavc/audiosubunit/avc_audiosubunit.cpp \ + libavc/audiosubunit/avc_function_block.cpp \ libavc/descriptors/avc_descriptor_cmd.cpp \ libavc/descriptors/avc_descriptor.cpp \