root/branches/libfreebob-motu/libfreebob/freebob.h

Revision 197, 4.9 kB (checked in by pieterpalmers, 18 years ago)

- implemented first steps of MOTU device discovery

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* freebob.h
2  * Copyright (C) 2005 Pieter Palmers
3  * Copyright (C) 2006 Daniel Wagner
4  *
5  * This file is part of FreeBoB
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301 USA
21  */
22
23 #ifndef FREEBOB_H
24 #define FREEBOB_H
25
26 #define FREEBOB_MAX_NAME_LEN 256
27
28 #define FREEBOB_BOUNCE_SERVER_VENDORNAME  "FreeBoB Server"
29 #define FREEBOB_BOUNCE_SERVER_MODELNAME   "freebob-server"
30
31 #define FREEBOB_BOUNCE_SERVER_GETXMLDESCRIPTION_CMD
32 #define AVC1394_SUBUNIT_TYPE_FREEBOB_BOUNCE_SERVER      0x0D
33
34 enum freebob_direction {
35     FREEBOB_CAPTURE  = 0,
36     FREEBOB_PLAYBACK = 1,
37 };
38
39 typedef struct freebob_handle* freebob_handle_t;
40
41 /*
42  * Buffer specification
43  */
44 typedef struct _freebob_stream_spec freebob_stream_spec_t;
45 typedef struct _freebob_stream_info freebob_stream_info_t;
46 typedef struct _freebob_connection_spec freebob_connection_spec_t;
47 typedef struct _freebob_connection_info freebob_connection_info_t;
48 typedef struct _freebob_supported_stream_format_spec freebob_supported_stream_format_spec_t;
49 typedef struct _freebob_supported_stream_format_info freebob_supported_stream_format_info_t;
50
51 /*
52  * Stream specification
53  */
54 struct _freebob_stream_spec {
55     int location;
56     int position;
57     int format;
58     int type;
59     int destination_port;
60     char name[FREEBOB_MAX_NAME_LEN];
61 };
62
63 struct _freebob_stream_info {
64     int nb_streams;
65     freebob_stream_spec_t** streams;
66 };
67
68 /*
69  * Connection specification
70  */
71 struct _freebob_connection_spec {
72     int id;
73     int port;
74     int node;
75     int plug;
76     int dimension;  /* due to the midi stuff, the dimension isn't equal */
77                     /* to the number of streams */
78     int samplerate; /* this should be equal for all connections when */
79                     /* using jack. maybe not when using other api's */
80     int iso_channel;
81     enum freebob_direction direction;
82     int is_master;
83     freebob_stream_info_t* stream_info;
84 };
85
86 /*
87  * topology info
88  */
89 struct _freebob_connection_info {
90     int direction;
91     int nb_connections;
92     freebob_connection_spec_t** connections;
93 };
94
95 /*
96  * Supported stream formats
97  */
98 struct _freebob_supported_stream_format_spec {
99     int samplerate;
100     int nb_audio_channels;
101     int nb_midi_channels;
102 };
103
104 struct _freebob_supported_stream_format_info {
105     int direction;
106     int nb_formats;
107     freebob_supported_stream_format_spec_t** formats;
108 };
109
110
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114
115 freebob_handle_t
116 freebob_new_handle( int port );
117
118 int
119 freebob_destroy_handle( freebob_handle_t freebob_handle );
120
121 int
122 freebob_discover_devices( freebob_handle_t freebob_handle, int verbose_level );
123
124
125 freebob_connection_info_t*
126 freebob_get_connection_info( freebob_handle_t freebob_handle,
127                              int node_id,
128                              enum freebob_direction direction );
129
130 freebob_supported_stream_format_info_t*
131 freebob_get_supported_stream_format_info( freebob_handle_t freebob_handle,
132                                           int node_id,
133                                           enum freebob_direction direction );
134
135 void
136 freebob_free_connection_info( freebob_connection_info_t* connection_info );
137 void
138 freebob_free_connection_spec( freebob_connection_spec_t* connection_spec );
139 void
140 freebob_free_stream_info( freebob_stream_info_t* stream_info );
141 void
142 freebob_free_stream_spec( freebob_stream_spec_t* stream_spec );
143 void
144 freebob_free_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
145 void
146 freebob_free_supported_stream_format_spec( freebob_supported_stream_format_spec_t* stream_spec );
147
148
149
150 void
151 freebob_print_connection_info( freebob_connection_info_t* connection_info );
152 void
153 freebob_print_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
154
155 int freebob_node_is_valid_freebob_device(freebob_handle_t fb_handle, int node_id);
156 int freebob_get_nb_devices_on_bus(freebob_handle_t fb_handle);
157
158 int freebob_get_device_node_id(freebob_handle_t fb_handle, int device_nr);
159 int freebob_set_samplerate(freebob_handle_t freebob_handle, int node_id, int samplerate);
160
161 /* debug function */
162 void
163 freebob_print_xml_description( freebob_handle_t freebob_handle,
164                                int node_id,
165                                enum freebob_direction direction );
166
167 const char*
168 freebob_get_version();
169
170 /* various function */
171
172 /* workaround: wait usec after each AVC command.
173    will disapear as soon bug is fixed */   
174 void freebob_sleep_after_avc_command( int time );
175
176 #ifdef __cplusplus
177 }
178 #endif
179
180 #endif /* FREEBOB_H */
Note: See TracBrowser for help on using the browser.