7 #ifdef HAVE_PULSE_AUDIO
9 #include <pulse/context.h>
10 #include <pulse/thread-mainloop.h>
11 #include <pulse/introspect.h>
12 #include <pulse/stream.h>
13 #include <pulse/proplist.h>
14 #include <pulse/error.h>
16 #define PULSE_MAX_OUTPUT_CHANS PA_CHANNEL_POSITION_MAX
18 #define LIVES_PA_BUFF_MAXLEN 32768
19 #define LIVES_PA_BUFF_TARGET 4096
20 #define LIVES_PA_BUFF_MINREQ 2048
21 #define LIVES_PA_BUFF_FRAGSIZE 4096
23 #define PA_SAMPSIZE 16
33 pa_threaded_mainloop *mloop;
36 pa_proplist *pa_props;
38 volatile int64_t usec_start;
39 volatile int64_t extrausec;
43 pa_stream_state_t state;
46 volatile int in_arate;
55 uint64_t out_chans_available;
65 audio_buffer_t *aPlayPtr;
68 uint8_t *sound_buffer;
80 volatile uint64_t frames_written;
86 volatile off_t real_seek_pos;
89 boolean reverse_endian;
98 volatile int playing_file;
101 volatile int read_abuf;
105 double volume_linear;
107 volatile int astream_fd;
109 volatile float abs_maxvol_heard;
111 volatile boolean is_corked;
116 boolean lives_pulse_init(
short startup_phase);
118 int pulse_audio_init(
void);
119 int pulse_audio_read_init(
void);
121 pulse_driver_t *pulse_get_driver(
boolean is_output);
123 int pulse_driver_activate(pulse_driver_t *);
124 void pulse_close_client(pulse_driver_t *);
126 void pulse_shutdown(
void);
128 void pulse_aud_pb_ready(
int fileno);
130 size_t pulse_flush_read_data(pulse_driver_t *,
int fileno,
size_t rbytes,
boolean rev_endian,
void *data);
132 void pulse_driver_uncork(pulse_driver_t *);
133 void pulse_driver_cork(pulse_driver_t *);
135 boolean pulse_try_reconnect(
void);
140 int64_t pulse_audio_seek_bytes(pulse_driver_t *, int64_t bytes,
lives_clip_t *);
142 boolean pa_time_reset(pulse_driver_t *, int64_t offset);
143 void pulse_tscale_reset(pulse_driver_t *);
145 ticks_t lives_pulse_get_time(pulse_driver_t *);
147 double lives_pulse_get_pos(pulse_driver_t *);
149 size_t pulse_get_buffsize(pulse_driver_t *);
152 void pa_mloop_lock(
void);
153 void pa_mloop_unlock(
void);
157 boolean pulse_audio_seek_frame(pulse_driver_t *,
double frame);
159 void pulse_get_rec_avals(pulse_driver_t *);