LIBFFADO
2.999.0
Main Page
Classes
Files
File List
File Members
libffado
ffado.h
Go to the documentation of this file.
1
/* ffado.h
2
*
3
* Copyright (C) 2005-2008 by Pieter Palmers
4
* Copyright (C) 2005-2008 by Daniel Wagner
5
*
6
* This file is part of FFADO
7
* FFADO = Free Firewire (pro-)audio drivers for linux
8
*
9
* FFADO is based upon FreeBoB
10
*
11
* This program is free software: you can redistribute it and/or modify
12
* it under the terms of the GNU General Public License as published by
13
* the Free Software Foundation, either version 2 of the License, or
14
* (at your option) version 3 of the License.
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU General Public License for more details.
20
*
21
* You should have received a copy of the GNU General Public License
22
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
*
24
*/
25
26
#ifndef FFADO_H
27
#define FFADO_H
28
29
#define FFADO_API_VERSION 9
30
31
#define FFADO_MAX_NAME_LEN 256
32
33
#include <stdlib.h>
34
35
#define FFADO_STREAMING_MAX_URL_LENGTH 2048
36
37
#define FFADO_IGNORE_CAPTURE (1<<0)
38
#define FFADO_IGNORE_PLAYBACK (1<<1)
39
40
enum
ffado_direction
{
41
FFADO_CAPTURE
= 0,
42
FFADO_PLAYBACK
= 1,
43
};
44
45
typedef
struct
ffado_handle*
ffado_handle_t
;
46
47
#ifdef __cplusplus
48
extern
"C"
{
49
#endif
50
51
#ifdef __APPLE__
52
#define WEAK_ATTRIBUTE weak_import
53
#else
54
#define WEAK_ATTRIBUTE __weak__
55
#endif
56
57
#ifdef __GNUC__
58
#define FFADO_WEAK_EXPORT __attribute__((WEAK_ATTRIBUTE))
59
#else
60
/* Add support for non-gcc platforms here */
61
#endif
62
63
/* ABI stuff */
64
const
char
*
65
ffado_get_version
();
66
67
int
68
ffado_get_api_version
();
69
70
/* various function */
71
72
/* The basic operation of the API is as follows:
73
*
74
* ffado_streaming_init()
75
* ffado_streaming_start()
76
* while(running) {
77
* retval = ffado_streaming_wait();
78
* if (retval == -1) {
79
* ffado_streaming_reset();
80
* continue;
81
* }
82
*
83
* ffado_streaming_transfer_capture_buffers(dev);
84
*
85
* for(all channels) {
86
* // For both audio and MIDI channels, captured data is available
87
* // in the buffer previously set with a call to
88
* // ffado_streaming_set_capture_stream_buffer(dev, channel, buffer)
89
* switch (channel_type) {
90
* case audio:
91
* // Process incoming audio as needed
92
* case midi:
93
* // Process incoming MIDI data as needed
94
* }
95
* }
96
*
97
* for(all channels) {
98
* // For both audio and MIDI channels, data is written to buffers
99
* // previously associated with the playback channel streams using
100
* // ffado_streaming_set_playback_stream_buffer(dev, channel, buffer)
101
* switch (channel_type) {
102
* case audio:
103
* // Set audio playback buffer contents
104
* case midi:
105
* // Set MIDI playback buffer contents
106
* }
107
* }
108
* ffado_streaming_transfer_playback_buffers(dev);
109
*
110
* }
111
* ffado_streaming_stop();
112
* ffado_streaming_finish();
113
*
114
*/
115
116
typedef
struct
_ffado_device
ffado_device_t
;
117
122
typedef
unsigned
int
ffado_sample_t
;
// FIXME
123
typedef
unsigned
int
ffado_nframes_t
;
124
125
#define FFADO_MAX_SPECSTRING_LENGTH 256
126
#define FFADO_MAX_SPECSTRINGS 64
127
164
typedef
struct
ffado_device_info
{
165
unsigned
int
nb_device_spec_strings
;
166
char
**
device_spec_strings
;
167
168
/* add some extra space to allow for future API extention
169
w/o breaking binary compatibility */
170
int32_t
reserved
[32];
171
}
ffado_device_info_t
;
172
176
typedef
struct
ffado_options
{
177
/* driver related setup */
178
int32_t
sample_rate
;
/*
179
* you can specify a value here or -1 to autodetect
180
*/
181
182
/* buffer setup */
183
int32_t
period_size
;
/* one period is the amount of frames that
184
* has to be sent or received in order for
185
* a period boundary to be signalled.
186
* (unit: frames)
187
*/
188
int32_t
nb_buffers
;
/* the size of the frame buffer (in periods) */
189
190
/* packetizer thread options */
191
int32_t
realtime
;
192
int32_t
packetizer_priority
;
193
194
/* verbosity */
195
int32_t
verbose
;
196
197
/* slave mode */
198
int32_t
slave_mode
;
199
/* snoop mode */
200
int32_t
snoop_mode
;
201
202
/* add some extra space to allow for future API extention
203
w/o breaking binary compatibility */
204
int32_t
reserved
[24];
205
206
}
ffado_options_t
;
207
223
typedef
enum
{
224
ffado_stream_type_invalid
= -1,
225
ffado_stream_type_unknown
= 0,
226
ffado_stream_type_audio
= 1,
227
ffado_stream_type_midi
= 2,
228
ffado_stream_type_control
= 3,
229
}
ffado_streaming_stream_type
;
230
236
typedef
enum
{
237
ffado_audio_datatype_error
= -1,
238
ffado_audio_datatype_int24
= 0,
239
ffado_audio_datatype_float
= 1,
240
}
ffado_streaming_audio_datatype
;
241
247
typedef
enum
{
248
ffado_wait_shutdown
= -3,
249
ffado_wait_error
= -2,
250
ffado_wait_xrun
= -1,
251
ffado_wait_ok
= 0,
252
}
ffado_wait_response
;
253
269
ffado_device_t
*
ffado_streaming_init
(
270
ffado_device_info_t
device_info,
271
ffado_options_t
options);
272
282
int
ffado_streaming_set_period_size
(
ffado_device_t
*dev,
283
unsigned
int
period) FFADO_WEAK_EXPORT;
284
292
int
ffado_streaming_prepare
(
ffado_device_t
*dev);
293
294
301
void
ffado_streaming_finish
(
ffado_device_t
*dev);
302
311
int
ffado_streaming_get_nb_capture_streams
(
ffado_device_t
*dev);
312
321
int
ffado_streaming_get_nb_playback_streams
(
ffado_device_t
*dev);
322
333
int
ffado_streaming_get_capture_stream_name
(
ffado_device_t
*dev,
int
number,
char
* buffer,
size_t
buffersize);
334
345
int
ffado_streaming_get_playback_stream_name
(
ffado_device_t
*dev,
int
number,
char
* buffer,
size_t
buffersize);
346
355
ffado_streaming_stream_type
ffado_streaming_get_capture_stream_type
(
ffado_device_t
*dev,
int
number);
356
365
ffado_streaming_stream_type
ffado_streaming_get_playback_stream_type
(
ffado_device_t
*dev,
int
number);
366
/*
367
*
368
* Note: buffer handling will change in order to allow setting the sample type for *_read and *_write
369
* and separately indicate if you want to use a user buffer or a managed buffer.
370
*
371
*/
372
387
int
ffado_streaming_set_capture_stream_buffer
(
ffado_device_t
*dev,
int
number,
char
*buff);
388
int
ffado_streaming_capture_stream_onoff
(
ffado_device_t
*dev,
int
number,
int
on);
389
402
int
ffado_streaming_set_playback_stream_buffer
(
ffado_device_t
*dev,
int
number,
char
*buff);
403
int
ffado_streaming_playback_stream_onoff
(
ffado_device_t
*dev,
int
number,
int
on);
404
405
ffado_streaming_audio_datatype
ffado_streaming_get_audio_datatype
(
ffado_device_t
*dev);
406
int
ffado_streaming_set_audio_datatype
(
ffado_device_t
*dev,
ffado_streaming_audio_datatype
t);
407
416
int
ffado_streaming_prepare
(
ffado_device_t
*dev);
417
426
int
ffado_streaming_start
(
ffado_device_t
*dev);
427
436
int
ffado_streaming_stop
(
ffado_device_t
*dev);
437
448
int
ffado_streaming_reset
(
ffado_device_t
*dev);
449
458
ffado_wait_response
ffado_streaming_wait
(
ffado_device_t
*dev);
459
486
int
ffado_streaming_transfer_buffers
(
ffado_device_t
*dev);
487
505
int
ffado_streaming_transfer_playback_buffers
(
ffado_device_t
*dev);
506
524
int
ffado_streaming_transfer_capture_buffers
(
ffado_device_t
*dev);
525
526
#ifdef __cplusplus
527
}
528
#endif
529
530
#endif
/* FFADO_STREAMING */
Generated for LIBFFADO by
1.8.1.1