Fix T49657: Audio backend "Jack" should be named "JACK".
[blender.git] / intern / audaspace / jack / AUD_JackLibrary.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * Copyright 2013 Blender Foundation
5  *
6  * This file is part of AudaSpace.
7  *
8  * Audaspace is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * AudaSpace is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Audaspace; if not, write to the Free Software Foundation,
20  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * ***** END GPL LICENSE BLOCK *****
23  */
24
25 /** \file audaspace/jack/AUD_JackLibrary.cpp
26  *  \ingroup audjack
27  */
28
29 #ifndef __AUD_JACKLIBRARY__
30 #define __AUD_JACKLIBRARY__
31
32 #if defined(__APPLE__) // always first include for jack weaklinking !
33 #include <weakjack.h>
34 #endif
35
36 #include <jack.h>
37 #include <ringbuffer.h>
38
39 #ifdef AUD_JACK_LIBRARY_IMPL
40 # define JACK_SYM
41 #else
42 # define JACK_SYM extern
43 #endif
44
45 /* All loadable JACK sumbols, prototypes from original jack.h */
46
47 JACK_SYM jack_transport_state_t (*AUD_jack_transport_query) (
48         const jack_client_t *client,
49         jack_position_t *pos);
50
51 JACK_SYM int (*AUD_jack_transport_locate) (jack_client_t *client,
52                                            jack_nframes_t frame);
53
54 JACK_SYM void (*AUD_jack_transport_start) (jack_client_t *client);
55 JACK_SYM void (*AUD_jack_transport_stop) (jack_client_t *client);
56
57 JACK_SYM void (*AUD_jack_ringbuffer_reset) (jack_ringbuffer_t *rb);
58 JACK_SYM size_t (*AUD_jack_ringbuffer_write) (jack_ringbuffer_t *rb,
59                                               const char *src, size_t cnt);
60 JACK_SYM size_t (*AUD_jack_ringbuffer_write_space) (const jack_ringbuffer_t *rb);
61 JACK_SYM void (*AUD_jack_ringbuffer_write_advance) (jack_ringbuffer_t *rb,
62                                                     size_t cnt);
63 JACK_SYM size_t (*AUD_jack_ringbuffer_read) (jack_ringbuffer_t *rb, char *dest,
64                                              size_t cnt);
65 JACK_SYM jack_ringbuffer_t *(*AUD_jack_ringbuffer_create) (size_t sz);
66 JACK_SYM void (*AUD_jack_ringbuffer_free) (jack_ringbuffer_t *rb);
67 JACK_SYM size_t (*AUD_jack_ringbuffer_read_space) (const jack_ringbuffer_t *rb);
68 JACK_SYM int  (*AUD_jack_set_sync_callback) (jack_client_t *client,
69      JackSyncCallback sync_callback,
70      void *arg);
71
72 JACK_SYM void *(*AUD_jack_port_get_buffer) (jack_port_t *, jack_nframes_t);
73
74 JACK_SYM jack_client_t *(*AUD_jack_client_open) (const char *client_name,
75                                                  jack_options_t options,
76                                                  jack_status_t *status, ...);
77 JACK_SYM int (*AUD_jack_set_process_callback) (jack_client_t *client,
78        JackProcessCallback process_callback, void *arg);
79 JACK_SYM void (*AUD_jack_on_shutdown) (jack_client_t *client,
80        JackShutdownCallback function, void *arg);
81 JACK_SYM jack_port_t *(*AUD_jack_port_register) (jack_client_t *client,
82                                                  const char *port_name,
83                                                  const char *port_type,
84                                                  unsigned long flags,
85                                                  unsigned long buffer_size);
86 JACK_SYM int (*AUD_jack_client_close) (jack_client_t *client);
87 JACK_SYM jack_nframes_t (*AUD_jack_get_sample_rate) (jack_client_t *);
88 JACK_SYM int (*AUD_jack_activate) (jack_client_t *client);
89 JACK_SYM const char **(*AUD_jack_get_ports) (jack_client_t *, 
90                                              const char *port_name_pattern,
91                                              const char *type_name_pattern, 
92                                              unsigned long flags);
93 JACK_SYM const char *(*AUD_jack_port_name) (const jack_port_t *port);
94 JACK_SYM int (*AUD_jack_connect) (jack_client_t *,
95                                   const char *source_port,
96                                   const char *destination_port);
97
98 /* Public API */
99
100 void AUD_jack_init(void);
101 void AUD_jack_exit(void);
102 bool AUD_jack_supported(void);
103
104 #endif  // __AUD_JACKLIBRARY__