Index: /branches/streaming-rework/tests/test-mixer.cpp =================================================================== --- /branches/streaming-rework/tests/test-mixer.cpp (revision 437) +++ /branches/streaming-rework/tests/test-mixer.cpp (revision 439) @@ -21,6 +21,10 @@ #include "libavc/avc_function_block.h" #include "libavc/avc_serialize.h" +#include "debugmodule/debugmodule.h" #include "libieee1394/ieee1394service.h" +#include + +DECLARE_GLOBAL_DEBUG_MODULE; const bool bVerbose = true; @@ -38,11 +42,11 @@ fbCmd.m_pFBProcessing->m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer; - fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x01; + debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer programmable state...\n"); + + fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; fbCmd.m_pFBProcessing->m_inputAudioChannelNumber = 0xff; fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff; fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector = FunctionBlockProcessingEnhancedMixer::eSS_ProgramableState; -// fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector -// = FunctionBlockProcessingEnhancedMixer::eSS_Level; fbCmd.setVerbose( bVerbose ); @@ -52,5 +56,84 @@ if ( !fbCmd.fire() ) { - printf( "cmd failed\n" ); + debugError( "cmd failed\n" ); + } + + if ( bVerbose ) { + CoutSerializer se; + fbCmd.serialize( se ); + } + + debugOutput(DEBUG_LEVEL_NORMAL, "Requesting mixer level state...\n"); + + fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00; + fbCmd.m_pFBProcessing->m_inputAudioChannelNumber = 0x00; + fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0x00; + fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector + = FunctionBlockProcessingEnhancedMixer::eSS_Level; + + if ( !fbCmd.fire() ) { + debugError( "cmd failed\n" ); + } + + if ( bVerbose ) { + CoutSerializer se; + fbCmd.serialize( se ); + } + + return true; +} + +bool +doApp2( Ieee1394Service& ieee1394service, int node_id, int fb_id ) +{ + FunctionBlockCmd fbCmd( ieee1394service, + FunctionBlockCmd::eFBT_Selector, + fb_id, + FunctionBlockCmd::eCA_Current ); + fbCmd.setNodeId( node_id ); + fbCmd.setSubunitId( 0x00 ); + fbCmd.setCommandType( AVCCommand::eCT_Status ); + fbCmd.m_pFBSelector->m_inputFbPlugNumber=0; + + debugOutput(DEBUG_LEVEL_NORMAL, "Requesting selector state...\n"); + + fbCmd.setVerbose( bVerbose ); + if (bVerbose) { + ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); + } + + if ( !fbCmd.fire() ) { + debugError( "cmd failed\n" ); + } + + if ( bVerbose ) { + CoutSerializer se; + fbCmd.serialize( se ); + } + + return true; +} + +bool +doApp3( Ieee1394Service& ieee1394service, int node_id, int fb_id , int val ) +{ + FunctionBlockCmd fbCmd( ieee1394service, + FunctionBlockCmd::eFBT_Selector, + fb_id, + FunctionBlockCmd::eCA_Current ); + fbCmd.setNodeId( node_id ); + fbCmd.setSubunitId( 0x00 ); + fbCmd.setCommandType( AVCCommand::eCT_Control ); + fbCmd.m_pFBSelector->m_inputFbPlugNumber=val; + + debugOutput(DEBUG_LEVEL_NORMAL, "Setting selector state to %d...\n", val); + + fbCmd.setVerbose( bVerbose ); + if (bVerbose) { + ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); + } + + if ( !fbCmd.fire() ) { + debugError( "cmd failed\n" ); } @@ -71,5 +154,5 @@ if (argc < 3) { - printf("usage: PORT NODE_ID FB_ID\n"); + debugError("usage: PORT NODE_ID FB_ID\n"); exit(0); } @@ -82,14 +165,20 @@ if (errno) { - perror("argument parsing failed:"); + debugError("argument parsing failed: %s", strerror(errno)); return -1; } Ieee1394Service ieee1394service; if ( !ieee1394service.initialize( port ) ) { - fprintf( stderr, "could not set port on ieee1394service\n" ); + debugError( "could not set port on ieee1394service\n" ); return -1; } doApp( ieee1394service, node_id, fb_id ); + doApp2( ieee1394service, node_id, fb_id ); +// doApp3( ieee1394service, node_id, fb_id , 0 ); +// sleep(1); +// doApp3( ieee1394service, node_id, fb_id , 1 ); +// sleep(1); +// doApp3( ieee1394service, node_id, fb_id , 0 ); return 0; Index: /branches/streaming-rework/src/libieee1394/ieee1394service.cpp =================================================================== --- /branches/streaming-rework/src/libieee1394/ieee1394service.cpp (revision 436) +++ /branches/streaming-rework/src/libieee1394/ieee1394service.cpp (revision 439) @@ -287,9 +287,4 @@ } - #ifdef DEBUG - debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, " pre avc1394_transaction_block2\n" ); - printBuffer( DEBUG_LEVEL_VERY_VERBOSE, len, buf ); - #endif - fb_quadlet_t* result = avc1394_transaction_block2( m_handle, @@ -299,9 +294,4 @@ resp_len, 10 ); - - #ifdef DEBUG - debugOutputShort(DEBUG_LEVEL_VERY_VERBOSE, " post avc1394_transaction_block2\n" ); - printBuffer( DEBUG_LEVEL_VERY_VERBOSE, *resp_len, result ); - #endif for ( unsigned int i = 0; i < *resp_len; ++i ) { Index: /branches/streaming-rework/src/debugmodule/debugmodule.cpp =================================================================== --- /branches/streaming-rework/src/debugmodule/debugmodule.cpp (revision 406) +++ /branches/streaming-rework/src/debugmodule/debugmodule.cpp (revision 439) @@ -54,10 +54,10 @@ DebugModule::~DebugModule() { - if ( m_level >= eDL_VeryVerbose ) { - cout << "Unregistering " - << this->getName() - << " at DebugModuleManager" - << endl; - } +// if ( m_level >= eDL_VeryVerbose ) { +// cout << "Unregistering " +// << this->getName() +// << " at DebugModuleManager" +// << endl; +// } if ( !DebugModuleManager::instance()->unregisterModule( *this ) ) { cerr << "Could not unregister DebugModule at DebugModuleManager" Index: /branches/streaming-rework/src/libavc/avc_generic.cpp =================================================================== --- /branches/streaming-rework/src/libavc/avc_generic.cpp (revision 413) +++ /branches/streaming-rework/src/libavc/avc_generic.cpp (revision 439) @@ -30,4 +30,5 @@ IMPL_DEBUG_MODULE( AVCCommand, AVCCommand, DEBUG_LEVEL_NORMAL ); +IMPL_DEBUG_MODULE( IBusData, IBusData, DEBUG_LEVEL_VERBOSE ); int AVCCommand::m_time = 0; Index: /branches/streaming-rework/src/libavc/avc_definitions.h =================================================================== --- /branches/streaming-rework/src/libavc/avc_definitions.h (revision 438) +++ /branches/streaming-rework/src/libavc/avc_definitions.h (revision 439) @@ -71,4 +71,7 @@ typedef byte_t control_selector_t; typedef byte_t control_data_length_t; +typedef uint16_t control_data_ext_length_t; +typedef uint16_t mixer_level_t; +typedef byte_t mixer_programmable_state_t; typedef byte_t input_fb_plug_number_t; typedef byte_t input_audio_channel_number_t; Index: /branches/streaming-rework/src/libavc/avc_generic.h =================================================================== --- /branches/streaming-rework/src/libavc/avc_generic.h (revision 375) +++ /branches/streaming-rework/src/libavc/avc_generic.h (revision 439) @@ -45,4 +45,7 @@ virtual IBusData* clone() const = 0; + +protected: + DECLARE_DEBUG_MODULE; }; Index: /branches/streaming-rework/src/libavc/avc_serialize.cpp =================================================================== --- /branches/streaming-rework/src/libavc/avc_serialize.cpp (revision 365) +++ /branches/streaming-rework/src/libavc/avc_serialize.cpp (revision 439) @@ -26,8 +26,10 @@ #include +IMPL_DEBUG_MODULE( CoutSerializer, CoutSerializer, DEBUG_LEVEL_NORMAL ); + bool CoutSerializer::write( byte_t d, const char* name ) { - printf( " %3d:\t0x%02x\t%s\n", m_cnt, d, name ); + debugOutput( DEBUG_LEVEL_NORMAL, " %3d:\t0x%02x\t%s\n", m_cnt, d, name ); m_cnt += sizeof( byte_t ); @@ -38,5 +40,5 @@ CoutSerializer::write( quadlet_t d, const char* name ) { - printf( " %3d:\t0x%08x\t%s\n", m_cnt, d, name ); + debugOutput( DEBUG_LEVEL_NORMAL, " %3d:\t0x%08x\t%s\n", m_cnt, d, name ); m_cnt += sizeof( quadlet_t ); return true; Index: /branches/streaming-rework/src/libavc/avc_serialize.h =================================================================== --- /branches/streaming-rework/src/libavc/avc_serialize.h (revision 365) +++ /branches/streaming-rework/src/libavc/avc_serialize.h (revision 439) @@ -21,4 +21,6 @@ #ifndef Serialize_h #define Serialize_h + +#include "debugmodule/debugmodule.h" #include // byte_t and quadlet_t declaration @@ -62,4 +64,5 @@ private: unsigned int m_cnt; + DECLARE_DEBUG_MODULE; }; Index: /branches/streaming-rework/src/libavc/avc_function_block.cpp =================================================================== --- /branches/streaming-rework/src/libavc/avc_function_block.cpp (revision 413) +++ /branches/streaming-rework/src/libavc/avc_function_block.cpp (revision 439) @@ -144,8 +144,58 @@ FunctionBlockProcessingEnhancedMixer::serialize( IOSSerialize& se ) { - bool bStatus; + int todo,done; + bool bStatus; + byte_t data_length_hi, data_length_lo; + bStatus = se.write( m_controlSelector, "FunctionBlockProcessingEnhancedMixer controlSelector" ); bStatus &= se.write( m_statusSelector, "FunctionBlockProcessingEnhancedMixer statusSelector" ); - + + switch (m_statusSelector) { + case eSS_ProgramableState: + m_controlDataLength=m_LevelData.size(); + data_length_hi=(m_controlDataLength >> 8); + data_length_lo=(m_controlDataLength & 0xFF); + bStatus &= se.write( data_length_hi, "FunctionBlockProcessingEnhancedMixer controlDataLengthHi" ); + bStatus &= se.write( data_length_lo, "FunctionBlockProcessingEnhancedMixer controlDataLengthLo" ); + + for (int i=0;i> 8); + data_length_lo=(m_controlDataLength & 0xFF); + bStatus &= se.write( data_length_hi, "FunctionBlockProcessingEnhancedMixer controlDataLengthHi" ); + bStatus &= se.write( data_length_lo, "FunctionBlockProcessingEnhancedMixer controlDataLengthLo" ); + + for (int i=0;i> 8; + byte_t value_lo=value & 0xFF; + + bStatus &= se.write( value_hi, "FunctionBlockProcessingEnhancedMixer data" ); + bStatus &= se.write( value_lo, "FunctionBlockProcessingEnhancedMixer data" ); + } + break; + } return bStatus; } @@ -154,7 +204,56 @@ FunctionBlockProcessingEnhancedMixer::deserialize( IISDeserialize& de ) { - bool bStatus; + int todo; + bool bStatus=true; bStatus = de.read( &m_controlSelector ); + + // NOTE: the returned value is currently bogus, so overwrite it + m_controlSelector=FunctionBlockProcessing::eCSE_Processing_EnhancedMixer; + bStatus &= de.read( &m_statusSelector ); + + byte_t data_length_hi; + byte_t data_length_lo; + bStatus &= de.read( &data_length_hi ); + bStatus &= de.read( &data_length_lo ); + + m_controlDataLength = (data_length_hi << 8) + data_length_lo; + switch (m_statusSelector) { + case eSS_ProgramableState: + m_ProgramableStateData.clear(); + for (int i=0;i=0;j--) { + byte_t bit_value; + bit_value=(((1<7-todo;j--) { + byte_t bit_value; + bit_value=(((1< +#include +using namespace std; class FunctionBlockFeatureVolume: public IBusData @@ -78,6 +80,9 @@ virtual FunctionBlockProcessingEnhancedMixer* clone() const; - control_selector_t m_controlSelector; - status_selector_t m_statusSelector; + control_selector_t m_controlSelector; + status_selector_t m_statusSelector; + control_data_ext_length_t m_controlDataLength; + vector m_ProgramableStateData; + vector m_LevelData; }; Index: /branches/streaming-rework/src/bebob/bebob_avplug.cpp =================================================================== --- /branches/streaming-rework/src/bebob/bebob_avplug.cpp (revision 438) +++ /branches/streaming-rework/src/bebob/bebob_avplug.cpp (revision 439) @@ -1961,13 +1961,31 @@ AvPlug* plug = *it; if ( plug->getFunctionBlockType() != 0xff ) { + std::ostringstream strstrm; + switch(plug->getFunctionBlockType()) { + case 0x80: + strstrm << "Selector FB"; + break; + case 0x81: + strstrm << "Feature FB"; + break; + case 0x82: + strstrm << "Processing FB"; + break; + case 0x83: + strstrm << "CODEC FB"; + break; + default: + strstrm << plug->getFunctionBlockType(); + } + if ( plug->getPlugDirection() == AvPlug::eAPD_Input ) { - debugOutputShort( DEBUG_LEVEL_NORMAL, "\t\"(%d) %s\" -> \"(0x%02x,%d)\"\n", + debugOutputShort( DEBUG_LEVEL_NORMAL, "\t\"(%d) %s\" -> \"(%s, ID %d)\"\n", plug->getGlobalId(), plug->getName(), - plug->getFunctionBlockType(), + strstrm.str().c_str(), plug->getFunctionBlockId() ); } else { - debugOutputShort( DEBUG_LEVEL_NORMAL, "\t\"(0x%02x,%d)\" -> \t\"(%d) %s\"\n", - plug->getFunctionBlockType(), + debugOutputShort( DEBUG_LEVEL_NORMAL, "\t\"(%s, ID %d)\" -> \t\"(%d) %s\"\n", + strstrm.str().c_str(), plug->getFunctionBlockId(), plug->getGlobalId(), Index: /branches/streaming-rework/src/bebob/bebob_avplug.h =================================================================== --- /branches/streaming-rework/src/bebob/bebob_avplug.h (revision 438) +++ /branches/streaming-rework/src/bebob/bebob_avplug.h (revision 439) @@ -96,17 +96,17 @@ int getGlobalId() const - { return m_globalId; } + { return m_globalId; } plug_id_t getPlugId() const - { return m_id; } + { return m_id; } AVCCommand::ESubunitType getSubunitType() const - { return m_subunitType; } + { return m_subunitType; } subunit_id_t getSubunitId() const - { return m_subunitId; } + { return m_subunitId; } const char* getName() const - { return m_name.c_str(); } + { return m_name.c_str(); } EAvPlugDirection getPlugDirection() const - { return m_direction; } + { return m_direction; } sampling_frequency_t getSamplingFrequency() const - { return m_samplingFrequency; } + { return m_samplingFrequency; } int getSampleRate() const; // 22050, 24000, 32000, ... int getNrOfChannels() const; @@ -118,8 +118,8 @@ { return m_addressType; } EAvPlugType getPlugType() const - { return m_infoPlugType; } + { return m_infoPlugType; } function_block_type_t getFunctionBlockType() const - { return m_functionBlockType; } + { return m_functionBlockType; } function_block_id_t getFunctionBlockId() const { return m_functionBlockId; }