1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*
* Copyright (C) 2005-2008 by Daniel Wagner
*
* This file is part of FFADO
* FFADO = Free FireWire (pro-)audio drivers for Linux
*
* FFADO is based upon FreeBoB.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) version 3 of the License.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "libavc/audiosubunit/avc_function_block.h"
#include "libutil/cmd_serialize.h"
#include "libieee1394/ieee1394service.h"
#include <cstdlib>
#include <cstring>
#include <cerrno>
using namespace AVC;
bool
doApp( Ieee1394Service& ieee1394service, int node_id, int fb_id )
{
AVC::FunctionBlockCmd fbCmd( ieee1394service,
FunctionBlockCmd::eFBT_Processing,
fb_id,
FunctionBlockCmd::eCA_Current);
fbCmd.setNodeId( node_id );
fbCmd.setSubunitId( 0x00 );
fbCmd.setCommandType( AVCCommand::eCT_Status );
fbCmd.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE );
// Ok, this enhanced mixer setting here is just a hack, we need
// a sane way to set processing features (read pointer management)
delete fbCmd.m_pFBProcessing->m_pMixer;
fbCmd.m_pFBProcessing->m_pMixer = 0;
AVC::FunctionBlockProcessingEnhancedMixer em;
fbCmd.m_pFBProcessing->m_pEnhancedMixer = em.clone();
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 = 1;
if ( !fbCmd.fire() ) {
printf( "cmd failed\n" );
return false;
}
// Util::Cmd::CoutSerializer se;
// fbCmd.serialize( se );
return true;
}
///////////////////////////
// main
//////////////////////////
int
main(int argc, char **argv)
{
if (argc < 2) {
printf("usage: NODE_ID FB_ID\n");
exit(0);
}
errno = 0;
char* tail;
int node_id = strtol( argv[1], &tail, 0 );
int fb_id = strtol( argv[2], &tail, 0 );
if (errno) {
perror("argument parsing failed:");
return -1;
}
Ieee1394Service ieee1394service;
if ( !ieee1394service.initialize( 0 ) ) {
fprintf( stderr, "could not set port on ieee1394service\n" );
return -1;
}
doApp( ieee1394service, node_id, fb_id );
return 0;
}
|