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

Revision 864, 2.8 kB (checked in by ppalmers, 16 years ago)

update license to GPLv2 or GPLv3 instead of GPLv2 or any later version. Update copyrights to reflect the new year

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
29 using namespace AVC;
30
31 bool
32 doApp( Ieee1394Service& ieee1394service, int node_id, int fb_id )
33 {
34     AVC::FunctionBlockCmd fbCmd( ieee1394service,
35                                  FunctionBlockCmd::eFBT_Processing,
36                                  fb_id,
37                                  FunctionBlockCmd::eCA_Current);
38     fbCmd.setNodeId( node_id );
39     fbCmd.setSubunitId( 0x00 );
40     fbCmd.setCommandType( AVCCommand::eCT_Status );
41     fbCmd.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE );
42
43     // Ok, this enhanced  mixer setting here is just a hack, we need
44     // a sane way to set processing features (read pointer management)
45     delete fbCmd.m_pFBProcessing->m_pMixer;
46     fbCmd.m_pFBProcessing->m_pMixer = 0;
47     AVC::FunctionBlockProcessingEnhancedMixer em;
48     fbCmd.m_pFBProcessing->m_pEnhancedMixer = em.clone();
49
50     fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x00;
51     fbCmd.m_pFBProcessing->m_inputAudioChannelNumber = 0xff;
52     fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff;
53     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector = 1;
54    
55     if ( !fbCmd.fire() ) {
56         printf( "cmd failed\n" );
57         return false;
58     }
59    
60     // Util::Cmd::CoutSerializer se;
61     // fbCmd.serialize( se );
62    
63     return true;
64 }
65
66 ///////////////////////////
67 // main
68 //////////////////////////
69 int
70 main(int argc, char **argv)
71 {
72
73     if (argc < 2) {
74         printf("usage: NODE_ID FB_ID\n");
75         exit(0);
76     }
77
78     int errno = 0;
79     char* tail;
80     int node_id = strtol( argv[1], &tail, 0 );
81     int fb_id   = strtol( argv[2], &tail, 0 );
82
83     if (errno) {
84         perror("argument parsing failed:");
85         return -1;
86     }
87     Ieee1394Service ieee1394service;
88     if ( !ieee1394service.initialize( 0 ) ) {
89         fprintf( stderr, "could not set port on ieee1394service\n" );
90         return -1;
91     }
92
93     doApp( ieee1394service, node_id, fb_id );
94
95     return 0;
96 }
Note: See TracBrowser for help on using the browser.