171 | | void |
---|
172 | | freebob_free_connection_info( freebob_connection_info_t* connection_info ) |
---|
173 | | { |
---|
174 | | if ( !connection_info ) { |
---|
175 | | return; |
---|
176 | | } |
---|
177 | | |
---|
178 | | for ( int i = 0; i < connection_info->nb_connections; ++i ) { |
---|
179 | | freebob_free_connection_spec( connection_info->connections[i] ); |
---|
180 | | } |
---|
181 | | |
---|
182 | | free( connection_info->connections ); |
---|
183 | | free( connection_info ); |
---|
184 | | } |
---|
185 | | |
---|
186 | | void |
---|
187 | | freebob_free_connection_spec( freebob_connection_spec_t* connection_spec ) |
---|
188 | | { |
---|
189 | | if ( !connection_spec ) { |
---|
190 | | return; |
---|
191 | | } |
---|
192 | | |
---|
193 | | freebob_free_stream_info( connection_spec->stream_info ); |
---|
194 | | free( connection_spec ); |
---|
195 | | } |
---|
196 | | |
---|
197 | | void freebob_free_stream_info( freebob_stream_info_t* stream_info ) |
---|
198 | | { |
---|
199 | | if ( !stream_info ) { |
---|
200 | | return; |
---|
201 | | } |
---|
202 | | |
---|
203 | | for ( int i = 0; i < stream_info->nb_streams; ++i ) { |
---|
204 | | freebob_free_stream_spec( stream_info->streams[i] ); |
---|
205 | | } |
---|
206 | | |
---|
207 | | free(stream_info->streams); |
---|
208 | | free(stream_info); |
---|
209 | | } |
---|
210 | | |
---|
211 | | void freebob_free_stream_spec( freebob_stream_spec_t* stream_spec ) |
---|
212 | | { |
---|
213 | | if ( !stream_spec ) { |
---|
214 | | return; |
---|
215 | | } |
---|
216 | | |
---|
217 | | free( stream_spec ); |
---|
218 | | } |
---|
219 | | |
---|
220 | | void |
---|
221 | | freebob_free_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info ) |
---|
222 | | { |
---|
223 | | if ( !stream_info ) { |
---|
224 | | return; |
---|
225 | | } |
---|
226 | | |
---|
227 | | for ( int i = 0; i < stream_info->nb_formats; ++i ) { |
---|
228 | | freebob_free_supported_stream_format_spec( stream_info->formats[i] ); |
---|
229 | | } |
---|
230 | | |
---|
231 | | free(stream_info->formats); |
---|
232 | | free(stream_info); |
---|
233 | | } |
---|
234 | | |
---|
235 | | void |
---|
236 | | freebob_free_supported_stream_format_spec( freebob_supported_stream_format_spec_t* stream_spec ) |
---|
237 | | { |
---|
238 | | if ( !stream_spec ) { |
---|
239 | | return; |
---|
240 | | } |
---|
241 | | |
---|
242 | | free( stream_spec ); |
---|
243 | | } |
---|
244 | | |
---|
245 | | void |
---|
246 | | freebob_print_connection_info( freebob_connection_info_t* connection_info ) |
---|
247 | | { |
---|
248 | | if ( !connection_info ) { |
---|
249 | | fprintf( stderr, "connection_info==NULL\n" ); |
---|
250 | | return; |
---|
251 | | } |
---|
252 | | |
---|
253 | | printf( "Direction: %d (%s)\n\n", connection_info->direction, |
---|
254 | | connection_info->direction? "playback" : "capture" ); |
---|
255 | | |
---|
256 | | puts( "Connection Info" ); |
---|
257 | | puts( "===============\n" ); |
---|
258 | | |
---|
259 | | printf("Number of connections: %d\n\n", |
---|
260 | | connection_info->nb_connections ); |
---|
261 | | |
---|
262 | | for ( int i = 0; i < connection_info->nb_connections; ++i) { |
---|
263 | | freebob_connection_spec_t* connection_spec |
---|
264 | | = connection_info->connections[i]; |
---|
265 | | |
---|
266 | | |
---|
267 | | if ( connection_spec ) { |
---|
268 | | printf( " Connection %2d\n", i ); |
---|
269 | | printf( " -------------\n" ); |
---|
270 | | printf( " [%2d] Id: %d\n", i, connection_spec->id ); |
---|
271 | | printf( " [%2d] Port: %d\n", i, connection_spec->port ); |
---|
272 | | printf( " [%2d] Node: %d\n", i, connection_spec->node ); |
---|
273 | | printf( " [%2d] Plug: %d\n", i, connection_spec->plug ); |
---|
274 | | printf( " [%2d] Dimension: %d\n", i, connection_spec->dimension ); |
---|
275 | | printf( " [%2d] Samplerate: %d\n", i, connection_spec->samplerate ); |
---|
276 | | printf( " [%2d] IsoChannel: %d\n", i, connection_spec->iso_channel ); |
---|
277 | | printf( " [%2d] IsMaster: %d\n", i, connection_spec->is_master ); |
---|
278 | | |
---|
279 | | if ( connection_info->connections[i]->stream_info ) { |
---|
280 | | printf(" [%2d] Number of stream infos: %d\n\n", |
---|
281 | | i, connection_spec->stream_info->nb_streams ); |
---|
282 | | |
---|
283 | | printf(" StreamId Position Location Format Type DPort Name\n"); |
---|
284 | | printf(" --------------------------------------------------\n"); |
---|
285 | | |
---|
286 | | for ( int j = 0; |
---|
287 | | j < connection_spec->stream_info->nb_streams; |
---|
288 | | ++j ) |
---|
289 | | { |
---|
290 | | freebob_stream_spec_t* stream_spec |
---|
291 | | = connection_spec->stream_info->streams[j]; |
---|
292 | | |
---|
293 | | printf(" [%2d]:[%2d] " |
---|
294 | | "0x%02x 0x%02x 0x%02x 0x%02x 0x%02x %s\n", |
---|
295 | | i, j, |
---|
296 | | stream_spec->position, |
---|
297 | | stream_spec->location, |
---|
298 | | stream_spec->format, |
---|
299 | | stream_spec->type, |
---|
300 | | stream_spec->destination_port, |
---|
301 | | stream_spec->name ); |
---|
302 | | } |
---|
303 | | } |
---|
304 | | } |
---|
305 | | printf( "\n" ); |
---|
306 | | } |
---|
307 | | |
---|
308 | | return; |
---|
309 | | } |
---|
310 | | |
---|
311 | | void |
---|
312 | | freebob_print_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info ) |
---|
313 | | { |
---|
314 | | if ( !stream_info ) { |
---|
315 | | fprintf( stderr, "stream_info==NULL\n" ); |
---|
316 | | return; |
---|
317 | | } |
---|
318 | | |
---|
319 | | printf( "Direction: %d (%s)\n\n", stream_info->direction, |
---|
320 | | stream_info->direction? "playback" : "capture" ); |
---|
321 | | |
---|
322 | | printf( "Samplerate AudioChannels MidiChannels\n" ); |
---|
323 | | printf( "-------------------------------------\n" ); |
---|
324 | | for ( int i = 0; i < stream_info->nb_formats; ++i) { |
---|
325 | | freebob_supported_stream_format_spec_t* format_spec |
---|
326 | | = stream_info->formats[i]; |
---|
327 | | |
---|
328 | | if ( format_spec ) { |
---|
329 | | printf( "%05d %02d %02d\n", |
---|
330 | | format_spec->samplerate, |
---|
331 | | format_spec->nb_audio_channels, |
---|
332 | | format_spec->nb_midi_channels ); |
---|
333 | | } |
---|
334 | | } |
---|
335 | | |
---|
336 | | return; |
---|
337 | | } |
---|
338 | | |
---|
339 | | /* debug function */ |
---|
340 | | void |
---|
341 | | freebob_print_xml_description( freebob_handle_t freebob_handle, |
---|
342 | | int node_id, |
---|
343 | | enum freebob_direction direction ) |
---|
344 | | { |
---|
345 | | xmlDocPtr doc; |
---|
346 | | doc = freebob_handle->m_deviceManager->getXmlDescription(); |
---|
347 | | if ( !doc ) { |
---|
348 | | debugFatal( "Could not get XML description\n" ); |
---|
349 | | return; |
---|
350 | | } |
---|
351 | | |
---|
352 | | xmlChar* xmlbuff; |
---|
353 | | int buffersize; |
---|
354 | | xmlDocDumpFormatMemory( doc, &xmlbuff, &buffersize, 1 ); |
---|
355 | | |
---|
356 | | printf("%s\n",(char *)xmlbuff); |
---|
357 | | |
---|
358 | | xmlFree(xmlbuff); |
---|
359 | | xmlFree(doc); |
---|
360 | | return; |
---|
361 | | } |
---|
362 | | |
---|