root/branches/streaming-rework/tests/test-mixer.cpp

Revision 420, 2.7 kB (checked in by pieterpalmers, 16 years ago)

moved src/libfreebobavc to src/libavc

Line 
1 /* test-mixer.cpp
2 * Copyright (C) 2006 by Daniel Wagner
3 *
4 * This file is part of FreeBoB.
5 *
6 * FreeBoB is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * FreeBoB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with FreeBoB; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18 * MA 02111-1307 USA.
19 */
20
21 #include "libavc/avc_function_block.h"
22 #include "libavc/avc_serialize.h"
23
24 #include "libieee1394/ieee1394service.h"
25
26 const bool bVerbose = true;
27
28 bool
29 doApp( Ieee1394Service& ieee1394service, int node_id, int fb_id )
30 {
31     FunctionBlockCmd fbCmd( ieee1394service,
32                             FunctionBlockCmd::eFBT_Processing,
33                             fb_id,
34                             FunctionBlockCmd::eCA_Current );
35     fbCmd.setNodeId( node_id );
36     fbCmd.setSubunitId( 0x00 );
37     fbCmd.setCommandType( AVCCommand::eCT_Status );
38     fbCmd.m_pFBProcessing->m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer;
39
40     fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x01;
41     fbCmd.m_pFBProcessing->m_inputAudioChannelNumber  = 0xff;
42     fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff;
43     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector
44         = FunctionBlockProcessingEnhancedMixer::eSS_ProgramableState;
45 //     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector
46 //         = FunctionBlockProcessingEnhancedMixer::eSS_Level;
47
48     fbCmd.setVerbose( bVerbose );
49     ieee1394service.setVerbose( bVerbose );
50
51     if ( !fbCmd.fire() ) {
52         printf( "cmd failed\n" );
53     }
54
55     if ( bVerbose ) {
56         CoutSerializer se;
57         fbCmd.serialize( se );
58     }
59
60     return true;
61 }
62
63 ///////////////////////////
64 // main
65 //////////////////////////
66 int
67 main( int argc, char **argv )
68 {
69
70     if (argc < 2) {
71         printf("usage: NODE_ID FB_ID\n");
72         exit(0);
73     }
74
75     int errno = 0;
76     char* tail;
77     int node_id = strtol( argv[1], &tail, 0 );
78     int fb_id   = strtol( argv[2], &tail, 0 );
79
80     if (errno) {
81         perror("argument parsing failed:");
82         return -1;
83     }
84     Ieee1394Service ieee1394service;
85     if ( !ieee1394service.initialize( 0 ) ) {
86         fprintf( stderr, "could not set port on ieee1394service\n" );
87         return -1;
88     }
89
90     doApp( ieee1394service, node_id, fb_id );
91
92     return 0;
93 }
Note: See TracBrowser for help on using the browser.