root/trunk/libffado/tests/test-enhanced-mixer.cpp

Revision 1234, 2.8 kB (checked in by holin, 16 years ago)

fix gcc 4.3 compile errors and some warnings (largely from Adrian Knoth)

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