LIBFFADO 2.4.7
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
43};
44
45typedef struct ffado_handle* ffado_handle_t;
46
47#ifdef __cplusplus
48extern "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 */
64const char*
66
67int
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
116typedef struct _ffado_device ffado_device_t;
117
122typedef unsigned int ffado_sample_t; // FIXME
123typedef unsigned int ffado_nframes_t;
124
125#define FFADO_MAX_SPECSTRING_LENGTH 256
126#define FFADO_MAX_SPECSTRINGS 64
164typedef struct ffado_device_info {
167
168 /* add some extra space to allow for future API extention
169 w/o breaking binary compatibility */
170 int32_t reserved[32];
172
176typedef 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;
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
207
223typedef enum {
230
236typedef enum {
241
247typedef enum {
253
270 ffado_device_info_t device_info,
271 ffado_options_t options);
272
283 unsigned int period) FFADO_WEAK_EXPORT;
284
293
294
302
312
322
333int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
334
345int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
346
356
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
389
404
407
417
427
437
449
459
487
506
525
526#ifdef __cplusplus
527}
528#endif
529
530#endif /* FFADO_STREAMING */
ffado_wait_response
Definition ffado.h:247
@ ffado_wait_error
Definition ffado.h:249
@ ffado_wait_ok
Definition ffado.h:251
@ ffado_wait_xrun
Definition ffado.h:250
@ ffado_wait_shutdown
Definition ffado.h:248
const char * ffado_get_version()
ffado_wait_response ffado_streaming_wait(ffado_device_t *dev)
int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int number, char *buffer, size_t buffersize)
int ffado_streaming_transfer_playback_buffers(ffado_device_t *dev)
ffado_streaming_audio_datatype
Definition ffado.h:236
@ ffado_audio_datatype_int24
Definition ffado.h:238
@ ffado_audio_datatype_float
Definition ffado.h:239
@ ffado_audio_datatype_error
Definition ffado.h:237
int ffado_streaming_get_nb_capture_streams(ffado_device_t *dev)
int ffado_streaming_stop(ffado_device_t *dev)
int ffado_streaming_set_period_size(ffado_device_t *dev, unsigned int period) FFADO_WEAK_EXPORT
struct ffado_device_info ffado_device_info_t
int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int number, char *buffer, size_t buffersize)
struct ffado_options ffado_options_t
int ffado_streaming_start(ffado_device_t *dev)
int ffado_streaming_prepare(ffado_device_t *dev)
int ffado_streaming_playback_stream_onoff(ffado_device_t *dev, int number, int on)
ffado_streaming_stream_type ffado_streaming_get_capture_stream_type(ffado_device_t *dev, int number)
int ffado_streaming_set_capture_stream_buffer(ffado_device_t *dev, int number, char *buff)
struct ffado_handle * ffado_handle_t
Definition ffado.h:45
int ffado_get_api_version()
int ffado_streaming_reset(ffado_device_t *dev)
int ffado_streaming_set_playback_stream_buffer(ffado_device_t *dev, int number, char *buff)
unsigned int ffado_sample_t
Definition ffado.h:122
int ffado_streaming_transfer_buffers(ffado_device_t *dev)
ffado_direction
Definition ffado.h:40
@ FFADO_PLAYBACK
Definition ffado.h:42
@ FFADO_CAPTURE
Definition ffado.h:41
void ffado_streaming_finish(ffado_device_t *dev)
int ffado_streaming_get_nb_playback_streams(ffado_device_t *dev)
ffado_streaming_stream_type ffado_streaming_get_playback_stream_type(ffado_device_t *dev, int number)
ffado_streaming_stream_type
Definition ffado.h:223
@ ffado_stream_type_unknown
Definition ffado.h:225
@ ffado_stream_type_midi
Definition ffado.h:227
@ ffado_stream_type_control
Definition ffado.h:228
@ ffado_stream_type_audio
Definition ffado.h:226
@ ffado_stream_type_invalid
Definition ffado.h:224
ffado_device_t * ffado_streaming_init(ffado_device_info_t device_info, ffado_options_t options)
int ffado_streaming_transfer_capture_buffers(ffado_device_t *dev)
unsigned int ffado_nframes_t
Definition ffado.h:123
ffado_streaming_audio_datatype ffado_streaming_get_audio_datatype(ffado_device_t *dev)
int ffado_streaming_capture_stream_onoff(ffado_device_t *dev, int number, int on)
struct _ffado_device ffado_device_t
Definition ffado.h:116
int ffado_streaming_set_audio_datatype(ffado_device_t *dev, ffado_streaming_audio_datatype t)
Definition ffado.h:164
int32_t reserved[32]
Definition ffado.h:170
char ** device_spec_strings
Definition ffado.h:166
unsigned int nb_device_spec_strings
Definition ffado.h:165
Definition ffado.h:176
int32_t realtime
Definition ffado.h:191
int32_t slave_mode
Definition ffado.h:198
int32_t verbose
Definition ffado.h:195
int32_t reserved[24]
Definition ffado.h:204
int32_t snoop_mode
Definition ffado.h:200
int32_t period_size
Definition ffado.h:183
int32_t sample_rate
Definition ffado.h:178
int32_t nb_buffers
Definition ffado.h:188
int32_t packetizer_priority
Definition ffado.h:192