LiVES  2.4.1-svn
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
jack.h
Go to the documentation of this file.
1 // jack.h
2 // LiVES (lives-exe)
3 // (c) G. Finch 2005 - 2013
4 // Released under the GPL 3 or later
5 // see file ../COPYING for licensing details
6 
7 #ifndef HAS_LIVES_JACK_H
8 #define HAS_LIVES_JACK_H
9 
10 #ifdef ENABLE_JACK
11 
12 
13 
14 
16 // Transport
17 
18 #include <jack/jack.h>
19 #include <jack/transport.h>
20 
21 boolean lives_jack_init(void);
22 boolean lives_jack_poll(void);
23 void lives_jack_end(void);
24 
25 int lives_start_ready_callback(jack_transport_state_t state, jack_position_t *pos, void *arg);
26 
27 void jack_pb_start(void);
28 void jack_pb_stop(void);
31 // Audio
33 
34 #include "audio.h"
35 
36 #define JACK_MAX_OUTPUT_PORTS 10
37 #define JACK_MAX_INPUT_PORTS 10
38 
39 #define ERR_PORT_NOT_FOUND 10
40 
41 
42 typedef jack_nframes_t nframes_t;
43 
44 
45 
46 // let's hope these are well above the standard jack transport states...
47 #define JackTClosed 1024
48 #define JackTReset 1025
49 #define JackTStopped 1026
50 
51 typedef struct {
52  int dev_idx;
53  int64_t sample_out_rate;
54  int64_t sample_in_rate;
55  uint64_t num_input_channels;
56  uint64_t num_output_channels;
57  uint64_t bytes_per_channel;
58 
59  uint64_t num_calls;
61  jack_port_t *output_port[JACK_MAX_OUTPUT_PORTS];
62  jack_port_t *input_port[JACK_MAX_INPUT_PORTS];
63  jack_client_t *client;
65  char **jack_port_name;
66  unsigned int jack_port_name_count;
67  uint64_t jack_port_flags;
69  lives_audio_loop_t loop;
70 
71  jack_transport_state_t state;
72 
73  float volume[JACK_MAX_OUTPUT_PORTS];
74 
75  boolean in_use;
76  boolean mute;
77 
78  volatile aserver_message_t *msgq;
80  off_t seek_pos;
81  off_t seek_end;
82  boolean usigned;
83  boolean reverse_endian;
84 
85  lives_whentostop_t *whentostop;
86  volatile lives_cancel_t *cancelled;
87 
88  /* variables used for trying to restart the connection to jack */
89  boolean jackd_died;
90  struct timeval last_reconnect_attempt;
91 
92  boolean play_when_stopped;
93  uint64_t audio_ticks;
94  uint64_t frames_written;
95 
96  int out_chans_available;
97  int in_chans_available;
98 
99  boolean is_paused;
100 
101  boolean is_output;
102 
103  boolean is_silent;
104 
105  boolean is_active;
106 
107  int playing_file;
108 
109  volatile float jack_pulse[1024];
110 
111  lives_audio_buf_t **abufs;
112  volatile int read_abuf;
113 
114  volatile int astream_fd;
115 
116 } jack_driver_t;
117 
118 
119 #define JACK_MAX_OUTDEVICES 10
120 #define JACK_MAX_INDEVICES 10
121 
122 
124 
125 jack_driver_t *jack_get_driver(int dev_idx, boolean is_output);
126 
127 int jack_audio_init(void);
128 int jack_audio_read_init(void);
129 
130 int jack_open_device(jack_driver_t *);
131 int jack_open_device_read(jack_driver_t *);
132 
133 int jack_driver_activate(jack_driver_t *);
134 int jack_read_driver_activate(jack_driver_t *, boolean autocon);
135 
136 void jack_close_device(jack_driver_t *);
137 
138 boolean jack_try_reconnect(void);
139 
140 void jack_aud_pb_ready(int fileno);
141 
142 
143 // utils
144 volatile aserver_message_t *jack_get_msgq(jack_driver_t *);
145 uint64_t lives_jack_get_time(jack_driver_t *, boolean absolute);
146 boolean jack_audio_seek_frame(jack_driver_t *, int frame);
147 int64_t jack_audio_seek_bytes(jack_driver_t *, int64_t bytes);
148 
149 void jack_get_rec_avals(jack_driver_t *);
150 
151 uint64_t jack_transport_get_time(void);
152 
153 double lives_jack_get_pos(jack_driver_t *);
154 
155 
156 #endif
157 
158 
159 #endif
lives_audio_loop_t
Definition: audio.h:143
Definition: audio.h:77
lives_whentostop_t
which stream end should cause playback to finish ?
Definition: main.h:359
Definition: audio.h:59
lives_cancel_t
cancel reason
Definition: main.h:367