root/trunk/libfreebob/libfreebob/freebob.h

Revision 251, 4.9 kB (checked in by pieterpalmers, 16 years ago)

- add the freebob_get_api_version call

  • 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_API_VERSION 1
32
33 enum freebob_direction {
34     FREEBOB_CAPTURE  = 0,
35     FREEBOB_PLAYBACK = 1,
36 };
37
38 typedef struct freebob_handle* freebob_handle_t;
39
40 /*
41  * Buffer specification
42  */
43 typedef struct _freebob_stream_spec freebob_stream_spec_t;
44 typedef struct _freebob_stream_info freebob_stream_info_t;
45 typedef struct _freebob_connection_spec freebob_connection_spec_t;
46 typedef struct _freebob_connection_info freebob_connection_info_t;
47 typedef struct _freebob_supported_stream_format_spec freebob_supported_stream_format_spec_t;
48 typedef struct _freebob_supported_stream_format_info freebob_supported_stream_format_info_t;
49
50 /*
51  * Stream specification
52  */
53 struct _freebob_stream_spec {
54     int location;
55     int position;
56     int format;
57     int type;
58     int destination_port;
59     char name[FREEBOB_MAX_NAME_LEN];
60 };
61
62 struct _freebob_stream_info {
63     int nb_streams;
64     freebob_stream_spec_t** streams;
65 };
66
67 /*
68  * Connection specification
69  */
70 struct _freebob_connection_spec {
71     int id;
72     int port;
73     int node;
74     int plug;
75     int dimension;  /* due to the midi stuff, the dimension isn't equal */
76                     /* to the number of streams */
77     int samplerate; /* this should be equal for all connections when */
78                     /* using jack. maybe not when using other api's */
79     int iso_channel;
80     enum freebob_direction direction;
81     int is_master;
82     freebob_stream_info_t* stream_info;
83 };
84
85 /*
86  * topology info
87  */
88 struct _freebob_connection_info {
89     int direction;
90     int nb_connections;
91     freebob_connection_spec_t** connections;
92 };
93
94 /*
95  * Supported stream formats
96  */
97 struct _freebob_supported_stream_format_spec {
98     int samplerate;
99     int nb_audio_channels;
100     int nb_midi_channels;
101 };
102
103 struct _freebob_supported_stream_format_info {
104     int direction;
105     int nb_formats;
106     freebob_supported_stream_format_spec_t** formats;
107 };
108
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114 freebob_handle_t
115 freebob_new_handle( int port );
116
117 int
118 freebob_destroy_handle( freebob_handle_t freebob_handle );
119
120 int
121 freebob_discover_devices( freebob_handle_t freebob_handle, int verbose_level );
122
123
124 freebob_connection_info_t*
125 freebob_get_connection_info( freebob_handle_t freebob_handle,
126                              int node_id,
127                              enum freebob_direction direction );
128
129 freebob_supported_stream_format_info_t*
130 freebob_get_supported_stream_format_info( freebob_handle_t freebob_handle,
131                                           int node_id,
132                                           enum freebob_direction direction );
133
134 void
135 freebob_free_connection_info( freebob_connection_info_t* connection_info );
136 void
137 freebob_free_connection_spec( freebob_connection_spec_t* connection_spec );
138 void
139 freebob_free_stream_info( freebob_stream_info_t* stream_info );
140 void
141 freebob_free_stream_spec( freebob_stream_spec_t* stream_spec );
142 void
143 freebob_free_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
144 void
145 freebob_free_supported_stream_format_spec( freebob_supported_stream_format_spec_t* stream_spec );
146
147
148
149 void
150 freebob_print_connection_info( freebob_connection_info_t* connection_info );
151 void
152 freebob_print_supported_stream_format_info( freebob_supported_stream_format_info_t* stream_info );
153
154 int freebob_node_is_valid_freebob_device(freebob_handle_t fb_handle, int node_id);
155 int freebob_get_nb_devices_on_bus(freebob_handle_t fb_handle);
156
157 int freebob_get_device_node_id(freebob_handle_t fb_handle, int device_nr);
158 int freebob_set_samplerate(freebob_handle_t freebob_handle, int node_id, int samplerate);
159
160 /* debug function */
161 void
162 freebob_print_xml_description( freebob_handle_t freebob_handle,
163                                int node_id,
164                                enum freebob_direction direction );
165
166 const char*
167 freebob_get_version();
168
169 const int
170 freebob_get_api_version();
171
172 /* various function */
173
174 /* workaround: wait usec after each AVC command.
175    will disapear as soon bug is fixed */   
176 void freebob_sleep_after_avc_command( int time );
177
178 #ifdef __cplusplus
179 }
180 #endif
181
182 #endif /* FREEBOB_H */
Note: See TracBrowser for help on using the browser.