LIBFFADO 2.4.9
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 <stdint.h>
34#include <stdlib.h>
35
36#define FFADO_STREAMING_MAX_URL_LENGTH 2048
37
38#define FFADO_IGNORE_CAPTURE (1<<0)
39#define FFADO_IGNORE_PLAYBACK (1<<1)
40
45
46typedef struct ffado_handle* ffado_handle_t;
47
48#ifdef __cplusplus
49extern "C" {
50#endif
51
52#ifdef __APPLE__
53#define WEAK_ATTRIBUTE weak_import
54#else
55#define WEAK_ATTRIBUTE __weak__
56#endif
57
58#ifdef __GNUC__
59#define FFADO_WEAK_EXPORT __attribute__((WEAK_ATTRIBUTE))
60#else
61/* Add support for non-gcc platforms here */
62#endif
63
64/* ABI stuff */
65const char*
67
68int
70
71/* various function */
72
73/* The basic operation of the API is as follows:
74 *
75 * ffado_streaming_init()
76 * ffado_streaming_start()
77 * while(running) {
78 * retval = ffado_streaming_wait();
79 * if (retval == -1) {
80 * ffado_streaming_reset();
81 * continue;
82 * }
83 *
84 * ffado_streaming_transfer_capture_buffers(dev);
85 *
86 * for(all channels) {
87 * // For both audio and MIDI channels, captured data is available
88 * // in the buffer previously set with a call to
89 * // ffado_streaming_set_capture_stream_buffer(dev, channel, buffer)
90 * switch (channel_type) {
91 * case audio:
92 * // Process incoming audio as needed
93 * case midi:
94 * // Process incoming MIDI data as needed
95 * }
96 * }
97 *
98 * for(all channels) {
99 * // For both audio and MIDI channels, data is written to buffers
100 * // previously associated with the playback channel streams using
101 * // ffado_streaming_set_playback_stream_buffer(dev, channel, buffer)
102 * switch (channel_type) {
103 * case audio:
104 * // Set audio playback buffer contents
105 * case midi:
106 * // Set MIDI playback buffer contents
107 * }
108 * }
109 * ffado_streaming_transfer_playback_buffers(dev);
110 *
111 * }
112 * ffado_streaming_stop();
113 * ffado_streaming_finish();
114 *
115 */
116
117typedef struct _ffado_device ffado_device_t;
118
122
123typedef unsigned int ffado_sample_t; // FIXME
124typedef unsigned int ffado_nframes_t;
125
126#define FFADO_MAX_SPECSTRING_LENGTH 256
127#define FFADO_MAX_SPECSTRINGS 64
165typedef struct ffado_device_info {
168
169 /* add some extra space to allow for future API extention
170 w/o breaking binary compatibility */
171 int32_t reserved[32];
173
177typedef struct ffado_options {
178 /* driver related setup */
179 int32_t sample_rate; /*
180 * you can specify a value here or -1 to autodetect
181 */
182
183 /* buffer setup */
184 int32_t period_size; /* one period is the amount of frames that
185 * has to be sent or received in order for
186 * a period boundary to be signalled.
187 * (unit: frames)
188 */
189 int32_t nb_buffers; /* the size of the frame buffer (in periods) */
190
191 /* packetizer thread options */
192 int32_t realtime;
194
195 /* verbosity */
196 int32_t verbose;
197
198 /* slave mode */
199 int32_t slave_mode;
200 /* snoop mode */
201 int32_t snoop_mode;
202
203 /* add some extra space to allow for future API extention
204 w/o breaking binary compatibility */
205 int32_t reserved[24];
206
208
231
242
254
271 ffado_device_info_t device_info,
272 ffado_options_t options);
273
284 unsigned int period) FFADO_WEAK_EXPORT;
285
294
295
303
313
323
334int ffado_streaming_get_capture_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
335
346int ffado_streaming_get_playback_stream_name(ffado_device_t *dev, int number, char* buffer, size_t buffersize);
347
357
367/*
368 *
369 * Note: buffer handling will change in order to allow setting the sample type for *_read and *_write
370 * and separately indicate if you want to use a user buffer or a managed buffer.
371 *
372 */
373
387
390
405
408
416
418
428
438
450
460
486
488
505
507
524
526
527#ifdef __cplusplus
528}
529#endif
530
531#endif /* FFADO_STREAMING */
ffado_wait_response
Definition ffado.h:248
@ ffado_wait_error
Definition ffado.h:250
@ ffado_wait_ok
Definition ffado.h:252
@ ffado_wait_xrun
Definition ffado.h:251
@ ffado_wait_shutdown
Definition ffado.h:249
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:237
@ ffado_audio_datatype_int24
Definition ffado.h:239
@ ffado_audio_datatype_float
Definition ffado.h:240
@ ffado_audio_datatype_error
Definition ffado.h:238
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:46
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:123
int ffado_streaming_transfer_buffers(ffado_device_t *dev)
ffado_direction
Definition ffado.h:41
@ FFADO_PLAYBACK
Definition ffado.h:43
@ FFADO_CAPTURE
Definition ffado.h:42
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:224
@ ffado_stream_type_unknown
Definition ffado.h:226
@ ffado_stream_type_midi
Definition ffado.h:228
@ ffado_stream_type_control
Definition ffado.h:229
@ ffado_stream_type_audio
Definition ffado.h:227
@ ffado_stream_type_invalid
Definition ffado.h:225
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:124
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:117
int ffado_streaming_set_audio_datatype(ffado_device_t *dev, ffado_streaming_audio_datatype t)
Definition ffado.h:165
int32_t reserved[32]
Definition ffado.h:171
char ** device_spec_strings
Definition ffado.h:167
unsigned int nb_device_spec_strings
Definition ffado.h:166
Definition ffado.h:177
int32_t realtime
Definition ffado.h:192
int32_t slave_mode
Definition ffado.h:199
int32_t verbose
Definition ffado.h:196
int32_t reserved[24]
Definition ffado.h:205
int32_t snoop_mode
Definition ffado.h:201
int32_t period_size
Definition ffado.h:184
int32_t sample_rate
Definition ffado.h:179
int32_t nb_buffers
Definition ffado.h:189
int32_t packetizer_priority
Definition ffado.h:193