root/branches/libfreebob-1.4/tests/test-mixer.cpp

Revision 324, 2.7 kB (checked in by wagi, 17 years ago)

2006-11-12 Daniel Wagner <wagi@monom.org>

  • test mixer programm added.
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 "libfreebobavc/avc_function_block.h"
22 #include "libfreebobavc/serialize.h"
23 #include "libfreebobavc/ieee1394service.h"
24
25 const bool bVerbose = true;
26
27 bool
28 doApp( Ieee1394Service& ieee1394service, int node_id, int fb_id )
29 {
30     FunctionBlockCmd fbCmd( &ieee1394service,
31                              FunctionBlockCmd::eFBT_Processing,
32                              fb_id,
33                              FunctionBlockCmd::eCA_Current );
34     fbCmd.setNodeId( node_id );
35     fbCmd.setSubunitId( 0x00 );
36     fbCmd.setCommandType( AVCCommand::eCT_Status );
37     fbCmd.m_pFBProcessing->m_pEnhancedMixer = new FunctionBlockProcessingEnhancedMixer;
38
39     fbCmd.m_pFBProcessing->m_fbInputPlugNumber = 0x01;
40     fbCmd.m_pFBProcessing->m_inputAudioChannelNumber  = 0xff;
41     fbCmd.m_pFBProcessing->m_outputAudioChannelNumber = 0xff;
42     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector
43         = FunctionBlockProcessingEnhancedMixer::eSS_ProgramableState;
44 //     fbCmd.m_pFBProcessing->m_pEnhancedMixer->m_statusSelector
45 //         = FunctionBlockProcessingEnhancedMixer::eSS_Level;
46
47     fbCmd.setVerbose( bVerbose );
48     ieee1394service.setVerbose( bVerbose );
49
50     if ( !fbCmd.fire() ) {
51         printf( "cmd failed\n" );
52     }
53
54     if ( bVerbose ) {
55         CoutSerializer se;
56         fbCmd.serialize( se );
57     }
58
59     return true;
60 }
61
62 ///////////////////////////
63 // main
64 //////////////////////////
65 int
66 main( int argc, char **argv )
67 {
68
69     if (argc < 2) {
70         printf("usage: NODE_ID FB_ID\n");
71         exit(0);
72     }
73
74     int errno = 0;
75     char* tail;
76     int node_id = strtol( argv[1], &tail, 0 );
77     int fb_id   = strtol( argv[2], &tail, 0 );
78
79     if (errno) {
80         perror("argument parsing failed:");
81         return -1;
82     }
83     Ieee1394Service ieee1394service;
84     if ( !ieee1394service.initialize( 0 ) ) {
85         fprintf( stderr, "could not set port on ieee1394service\n" );
86         return -1;
87     }
88
89     doApp( ieee1394service, node_id, fb_id );
90
91     return 0;
92 }
Note: See TracBrowser for help on using the browser.