78 | | // bool |
---|
79 | | // SubunitAudio::discoverConnections() |
---|
80 | | // { |
---|
81 | | // debugOutput(DEBUG_LEVEL_NORMAL, "Discovering connections...\n"); |
---|
82 | | // if ( !Subunit::discoverConnections() ) { |
---|
83 | | // return false; |
---|
84 | | // } |
---|
85 | | // |
---|
86 | | // for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); |
---|
87 | | // it != m_functions.end(); |
---|
88 | | // ++it ) |
---|
89 | | // { |
---|
90 | | // BeBoB::FunctionBlock* function = *it; |
---|
91 | | // if ( !function->discoverConnections() ) { |
---|
92 | | // debugError( "functionblock connection discovering failed ('%s')\n", |
---|
93 | | // function->getName() ); |
---|
94 | | // return false; |
---|
95 | | // } |
---|
96 | | // } |
---|
97 | | // |
---|
98 | | // return true; |
---|
99 | | // } |
---|
100 | | // bool |
---|
101 | | // SubunitAudio::discoverBeBoB::FunctionBlocks() |
---|
102 | | // { |
---|
103 | | // debugOutput( DEBUG_LEVEL_NORMAL, |
---|
104 | | // "Discovering function blocks...\n"); |
---|
105 | | // |
---|
106 | | // if ( !discoverBeBoB::FunctionBlocksDo( |
---|
107 | | // ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector) ) |
---|
108 | | // { |
---|
109 | | // debugError( "Could not discover function block selector\n" ); |
---|
110 | | // return false; |
---|
111 | | // } |
---|
112 | | // if ( !discoverBeBoB::FunctionBlocksDo( |
---|
113 | | // ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature) ) |
---|
114 | | // { |
---|
115 | | // debugError( "Could not discover function block feature\n" ); |
---|
116 | | // return false; |
---|
117 | | // } |
---|
118 | | // if ( !discoverBeBoB::FunctionBlocksDo( |
---|
119 | | // ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing) ) |
---|
120 | | // { |
---|
121 | | // debugError( "Could not discover function block processing\n" ); |
---|
122 | | // return false; |
---|
123 | | // } |
---|
124 | | // if ( !discoverBeBoB::FunctionBlocksDo( |
---|
125 | | // ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec) ) |
---|
126 | | // { |
---|
127 | | // debugError( "Could not discover function block codec\n" ); |
---|
128 | | // return false; |
---|
129 | | // } |
---|
130 | | // |
---|
131 | | // // print a function block list |
---|
132 | | // #ifdef DEBUG |
---|
133 | | // if (getDebugLevel() >= DEBUG_LEVEL_NORMAL) { |
---|
134 | | // |
---|
135 | | // for ( BeBoB::FunctionBlockVector::iterator it = m_functions.begin(); |
---|
136 | | // it != m_functions.end(); |
---|
137 | | // ++it ) |
---|
138 | | // { |
---|
139 | | // debugOutput(DEBUG_LEVEL_NORMAL, "%20s FB, type 0x%X, id=%d\n", |
---|
140 | | // (*it)->getName(), |
---|
141 | | // (*it)->getType(), |
---|
142 | | // (*it)->getId()); |
---|
143 | | // } |
---|
144 | | // } |
---|
145 | | // #endif |
---|
146 | | // |
---|
147 | | // return true; |
---|
148 | | // } |
---|
149 | | // |
---|
150 | | // bool |
---|
151 | | // SubunitAudio::discoverBeBoB::FunctionBlocksDo( |
---|
152 | | // ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType ) |
---|
153 | | // { |
---|
154 | | // int page = 0; |
---|
155 | | // bool cmdSuccess = false; |
---|
156 | | // bool finished = false; |
---|
157 | | // |
---|
158 | | // do { |
---|
159 | | // ExtendedSubunitInfoCmd |
---|
160 | | // extSubunitInfoCmd( m_unit->get1394Service() ); |
---|
161 | | // extSubunitInfoCmd.setNodeId( m_unit->getConfigRom().getNodeId() ); |
---|
162 | | // extSubunitInfoCmd.setCommandType( AVCCommand::eCT_Status ); |
---|
163 | | // extSubunitInfoCmd.setSubunitId( getSubunitId() ); |
---|
164 | | // extSubunitInfoCmd.setSubunitType( getSubunitType() ); |
---|
165 | | // extSubunitInfoCmd.setVerbose( m_verboseLevel ); |
---|
166 | | // |
---|
167 | | // extSubunitInfoCmd.m_fbType = fbType; |
---|
168 | | // extSubunitInfoCmd.m_page = page; |
---|
169 | | // |
---|
170 | | // cmdSuccess = extSubunitInfoCmd.fire(); |
---|
171 | | // if ( cmdSuccess |
---|
172 | | // && ( extSubunitInfoCmd.getResponse() |
---|
173 | | // == AVCCommand::eR_Implemented ) ) |
---|
174 | | // { |
---|
175 | | // for ( ExtendedSubunitInfoPageDataVector::iterator it = |
---|
176 | | // extSubunitInfoCmd.m_infoPageDatas.begin(); |
---|
177 | | // cmdSuccess |
---|
178 | | // && ( it != extSubunitInfoCmd.m_infoPageDatas.end() ); |
---|
179 | | // ++it ) |
---|
180 | | // { |
---|
181 | | // cmdSuccess = createBeBoB::FunctionBlock( fbType, **it ); |
---|
182 | | // } |
---|
183 | | // if ( ( extSubunitInfoCmd.m_infoPageDatas.size() != 0 ) |
---|
184 | | // && ( extSubunitInfoCmd.m_infoPageDatas.size() == 5 ) ) |
---|
185 | | // { |
---|
186 | | // page++; |
---|
187 | | // } else { |
---|
188 | | // finished = true; |
---|
189 | | // } |
---|
190 | | // } else { |
---|
191 | | // finished = true; |
---|
192 | | // } |
---|
193 | | // } while ( cmdSuccess && !finished ); |
---|
194 | | // |
---|
195 | | // return cmdSuccess; |
---|
196 | | // } |
---|
197 | | // |
---|
198 | | // bool |
---|
199 | | // SubunitAudio::createBeBoB::FunctionBlock( |
---|
200 | | // ExtendedSubunitInfoCmd::EBeBoB::FunctionBlockType fbType, |
---|
201 | | // ExtendedSubunitInfoPageData& data ) |
---|
202 | | // { |
---|
203 | | // BeBoB::FunctionBlock::ESpecialPurpose purpose |
---|
204 | | // = convertSpecialPurpose( data.m_functionBlockSpecialPupose ); |
---|
205 | | // |
---|
206 | | // BeBoB::FunctionBlock* fb = 0; |
---|
207 | | // |
---|
208 | | // switch ( fbType ) { |
---|
209 | | // case ExtendedSubunitInfoCmd::eFBT_AudioSubunitSelector: |
---|
210 | | // { |
---|
211 | | // fb = new BeBoB::FunctionBlockSelector( *this, |
---|
212 | | // data.m_functionBlockId, |
---|
213 | | // purpose, |
---|
214 | | // data.m_noOfInputPlugs, |
---|
215 | | // data.m_noOfOutputPlugs, |
---|
216 | | // m_verboseLevel ); |
---|
217 | | // } |
---|
218 | | // break; |
---|
219 | | // case ExtendedSubunitInfoCmd::eFBT_AudioSubunitFeature: |
---|
220 | | // { |
---|
221 | | // fb = new BeBoB::FunctionBlockFeature( *this, |
---|
222 | | // data.m_functionBlockId, |
---|
223 | | // purpose, |
---|
224 | | // data.m_noOfInputPlugs, |
---|
225 | | // data.m_noOfOutputPlugs, |
---|
226 | | // m_verboseLevel ); |
---|
227 | | // } |
---|
228 | | // break; |
---|
229 | | // case ExtendedSubunitInfoCmd::eFBT_AudioSubunitProcessing: |
---|
230 | | // { |
---|
231 | | // switch ( data.m_functionBlockType ) { |
---|
232 | | // case ExtendedSubunitInfoCmd::ePT_EnhancedMixer: |
---|
233 | | // { |
---|
234 | | // fb = new BeBoB::FunctionBlockEnhancedMixer( *this, |
---|
235 | | // data.m_functionBlockId, |
---|
236 | | // purpose, |
---|
237 | | // data.m_noOfInputPlugs, |
---|
238 | | // data.m_noOfOutputPlugs, |
---|
239 | | // m_verboseLevel ); |
---|
240 | | // } |
---|
241 | | // break; |
---|
242 | | // case ExtendedSubunitInfoCmd::ePT_Mixer: |
---|
243 | | // case ExtendedSubunitInfoCmd::ePT_Generic: |
---|
244 | | // case ExtendedSubunitInfoCmd::ePT_UpDown: |
---|
245 | | // case ExtendedSubunitInfoCmd::ePT_DolbyProLogic: |
---|
246 | | // case ExtendedSubunitInfoCmd::ePT_3DStereoExtender: |
---|
247 | | // case ExtendedSubunitInfoCmd::ePT_Reverberation: |
---|
248 | | // case ExtendedSubunitInfoCmd::ePT_Chorus: |
---|
249 | | // case ExtendedSubunitInfoCmd::ePT_DynamicRangeCompression: |
---|
250 | | // default: |
---|
251 | | // fb = new BeBoB::FunctionBlockProcessing( *this, |
---|
252 | | // data.m_functionBlockId, |
---|
253 | | // purpose, |
---|
254 | | // data.m_noOfInputPlugs, |
---|
255 | | // data.m_noOfOutputPlugs, |
---|
256 | | // m_verboseLevel ); |
---|
257 | | // debugWarning( "Dummy function block processing created. " |
---|
258 | | // "Implementation is missing\n" ); |
---|
259 | | // } |
---|
260 | | // } |
---|
261 | | // break; |
---|
262 | | // case ExtendedSubunitInfoCmd::eFBT_AudioSubunitCodec: |
---|
263 | | // { |
---|
264 | | // fb = new BeBoB::FunctionBlockCodec( *this, |
---|
265 | | // data.m_functionBlockId, |
---|
266 | | // purpose, |
---|
267 | | // data.m_noOfInputPlugs, |
---|
268 | | // data.m_noOfOutputPlugs, |
---|
269 | | // m_verboseLevel ); |
---|
270 | | // debugWarning( "Dummy function block codec created. " |
---|
271 | | // "Implementation is missing\n" ); |
---|
272 | | // } |
---|
273 | | // break; |
---|
274 | | // default: |
---|
275 | | // debugError( "Unhandled function block type found\n" ); |
---|
276 | | // return false; |
---|
277 | | // } |
---|
278 | | // |
---|
279 | | // if ( !fb ) { |
---|
280 | | // debugError( "Could create function block\n" ); |
---|
281 | | // return false; |
---|
282 | | // } |
---|
283 | | // if ( !fb->discover() ) { |
---|
284 | | // debugError( "Could not discover function block %s\n", |
---|
285 | | // fb->getName() ); |
---|
286 | | // delete fb; |
---|
287 | | // return false; |
---|
288 | | // } |
---|
289 | | // m_functions.push_back( fb ); |
---|
290 | | // |
---|
291 | | // return true; |
---|
292 | | // } |
---|
293 | | // |
---|
294 | | // BeBoB::FunctionBlock::ESpecialPurpose |
---|
295 | | // SubunitAudio::convertSpecialPurpose( |
---|
296 | | // function_block_special_purpose_t specialPurpose ) |
---|
297 | | // { |
---|
298 | | // BeBoB::FunctionBlock::ESpecialPurpose p; |
---|
299 | | // switch ( specialPurpose ) { |
---|
300 | | // case ExtendedSubunitInfoPageData::eSP_InputGain: |
---|
301 | | // p = BeBoB::FunctionBlock::eSP_InputGain; |
---|
302 | | // break; |
---|
303 | | // case ExtendedSubunitInfoPageData::eSP_OutputVolume: |
---|
304 | | // p = BeBoB::FunctionBlock::eSP_OutputVolume; |
---|
305 | | // break; |
---|
306 | | // default: |
---|
307 | | // p = BeBoB::FunctionBlock::eSP_NoSpecialPurpose; |
---|
308 | | // } |
---|
309 | | // return p; |
---|
310 | | // } |
---|
311 | | // |
---|
312 | | bool |
---|
313 | | SubunitAudio::serializeChild( Glib::ustring basePath, |
---|
314 | | Util::IOSerialize& ser ) const |
---|
315 | | { |
---|
316 | | bool result = true; |
---|
317 | | int i = 0; |
---|
318 | | |
---|
319 | | for ( BeBoB::FunctionBlockVector::const_iterator it = m_functions.begin(); |
---|
320 | | it != m_functions.end(); |
---|
321 | | ++it ) |
---|
322 | | { |
---|
323 | | BeBoB::FunctionBlock* pFB = *it; |
---|
324 | | std::ostringstream strstrm; |
---|
325 | | strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; |
---|
326 | | |
---|
327 | | result &= pFB->serialize( strstrm.str() , ser ); |
---|
328 | | |
---|
329 | | i++; |
---|
330 | | } |
---|
331 | | |
---|
332 | | return result; |
---|
333 | | } |
---|
334 | | |
---|
335 | | bool |
---|
336 | | SubunitAudio::deserializeChild( Glib::ustring basePath, |
---|
337 | | Util::IODeserialize& deser, |
---|
338 | | Unit& unit ) |
---|
339 | | { |
---|
340 | | int i = 0; |
---|
341 | | bool bFinished = false; |
---|
342 | | do { |
---|
343 | | std::ostringstream strstrm; |
---|
344 | | strstrm << basePath << "BeBoB::FunctionBlock" << i << "/"; |
---|
345 | | BeBoB::FunctionBlock* pFB = BeBoB::FunctionBlock::deserialize( strstrm.str(), |
---|
346 | | deser, |
---|
347 | | unit, |
---|
348 | | *this ); |
---|
349 | | if ( pFB ) { |
---|
350 | | m_functions.push_back( pFB ); |
---|
351 | | i++; |
---|
352 | | } else { |
---|
353 | | bFinished = true; |
---|
354 | | } |
---|
355 | | } while ( !bFinished ); |
---|
356 | | |
---|
357 | | return true; |
---|
358 | | } |
---|