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 |
if (bVerbose) { |
---|
50 |
ieee1394service.setVerboseLevel( DEBUG_LEVEL_VERY_VERBOSE ); |
---|
51 |
} |
---|
52 |
|
---|
53 |
if ( !fbCmd.fire() ) { |
---|
54 |
printf( "cmd failed\n" ); |
---|
55 |
} |
---|
56 |
|
---|
57 |
if ( bVerbose ) { |
---|
58 |
CoutSerializer se; |
---|
59 |
fbCmd.serialize( se ); |
---|
60 |
} |
---|
61 |
|
---|
62 |
return true; |
---|
63 |
} |
---|
64 |
|
---|
65 |
/////////////////////////// |
---|
66 |
// main |
---|
67 |
////////////////////////// |
---|
68 |
int |
---|
69 |
main( int argc, char **argv ) |
---|
70 |
{ |
---|
71 |
|
---|
72 |
if (argc < 2) { |
---|
73 |
printf("usage: NODE_ID FB_ID\n"); |
---|
74 |
exit(0); |
---|
75 |
} |
---|
76 |
|
---|
77 |
int errno = 0; |
---|
78 |
char* tail; |
---|
79 |
int node_id = strtol( argv[1], &tail, 0 ); |
---|
80 |
int fb_id = strtol( argv[2], &tail, 0 ); |
---|
81 |
|
---|
82 |
if (errno) { |
---|
83 |
perror("argument parsing failed:"); |
---|
84 |
return -1; |
---|
85 |
} |
---|
86 |
Ieee1394Service ieee1394service; |
---|
87 |
if ( !ieee1394service.initialize( 0 ) ) { |
---|
88 |
fprintf( stderr, "could not set port on ieee1394service\n" ); |
---|
89 |
return -1; |
---|
90 |
} |
---|
91 |
|
---|
92 |
doApp( ieee1394service, node_id, fb_id ); |
---|
93 |
|
---|
94 |
return 0; |
---|
95 |
} |
---|