Go to the documentation of this file.
7 #ifndef HAS_LIVES_AUDIO_H
8 #define HAS_LIVES_AUDIO_H
10 #define SAMPLE_MAX_16BIT_P 32767.4999999f
11 #define SAMPLE_MAX_16BIT_N 32768.0f
12 #define SAMPLE_MAX_16BITI 32768
22 # define DEFAULT_AUDIO_RATE 44100
24 # define DEFAULT_AUDIO_CHANS 2
25 # define DEFAULT_AUDIO_SAMPS 16
26 # define DEFAULT_AUDIO_SIGNED8 (AFORM_UNSIGNED)
27 # define DEFAULT_AUDIO_SIGNED16 (!AFORM_UNSIGNED)
36 #define MAX_AUDIO_MEM 32 * 1024 * 1024
39 #define RENDER_BLOCK_SIZE 1024
42 #define SILENCE_BLOCK_SIZE BUFFER_FILL_BYTES_LARGE
47 #define XSAMPLES 393216
49 #define AUD_WRITE_CHECK 0xFFFFFFFFF4000000
51 #define WEED_LEAF_HOST_KEEP_ADATA "keep_adata"
56 #define ASERVER_CMD_PROCESSED 0
57 #define ASERVER_CMD_FILE_OPEN 1
58 #define ASERVER_CMD_FILE_CLOSE 2
59 #define ASERVER_CMD_FILE_SEEK 3
62 typedef struct _aserver_message_t {
66 volatile struct _aserver_message_t *
next;
145 typedef enum lives_audio_loop {
154 boolean normalise_audio(
int fnum,
double start,
double end,
float thresh);
160 boolean pad_with_silence(
int out_fd,
void *buff, off64_t oins_size, int64_t ins_size,
int asamps,
int aunsigned,
164 uint64_t nsamples,
size_t tbytes,
double scale,
int nDstChannels,
int nSrcChannels,
int swap_sign)
GNU_HOT;
167 uint64_t nsamples,
size_t tbytes,
double scale,
int nDstChannels,
int nSrcChannels,
int swap_endian,
171 uint64_t nsamples,
size_t tbytes,
double scale,
int nDstChannels,
int nSrcChannels,
int swap_sign)
GNU_HOT;
173 float sample_move_d16_float(
float *dst,
short *src, uint64_t nsamples, uint64_t src_skip,
int is_unsigned,
boolean rev_endian,
176 int64_t
sample_move_float_int(
void *holding_buff,
float **float_buffer,
int nsamps,
double scale,
int chans,
int asamps,
178 boolean swap_endian,
boolean float_interleaved,
float vol)
GNU_HOT;
192 void aud_fade(
int fileno,
double startt,
double endt,
double startv,
double endv);
205 void jack_rec_audio_to_clip(
int fileno,
int oldfileno,
207 void jack_rec_audio_end(
boolean close_dev,
boolean close_fd);
210 #ifdef HAVE_PULSE_AUDIO
211 void pulse_rec_audio_to_clip(
int fileno,
int oldfileno,
213 void pulse_rec_audio_end(
boolean close_dev,
boolean close_fd);
223 weed_timecode_t fill_tc,
int what_to_get,
boolean exact);
225 boolean get_audio_from_plugin(
float **fbuffer,
int nchans,
int arate,
int nsamps,
boolean is_audio_thread);
236 #define is_realtime_aplayer(ptype) ((ptype == AUD_PLAYER_JACK || ptype == AUD_PLAYER_PULSE || ptype == AUD_PLAYER_NONE))
269 #define lives_vol_from_linear(vol) ((float)squared(squared((vol))))
270 #define lives_vol_to_linear(vol) (sqrtf(sqrtf((vol))))
void free_jack_audio_buffers(void)
boolean pad_with_silence(int out_fd, void *buff, off64_t oins_size, int64_t ins_size, int asamps, int aunsigned, boolean big_endian)
lives_operation_t operation
int out_achans
channels for buffer* side
void reinit_audio_gen(void)
void wake_audio_thread(void)
boolean eof
did we read EOF ? [readonly by client]
void sample_move_d16_d8(uint8_t *dst, short *src, uint64_t nsamples, size_t tbytes, double scale, int nDstChannels, int nSrcChannels, int swap_sign) GNU_HOT
convert from any number of source channels to any number of destination channels - 8 bit output
lives_audio_track_state_t * audio_frame_to_atstate(weed_plant_t *event, int *ntracks)
int32_t ** buffer24
sample data in 24 bit format (or NULL)
char * get_audio_file_name(int fnum, boolean opening)
void audio_stream(void *buff, size_t nbytes, int fd)
void fill_abuffer_from(lives_audio_buf_t *abuf, weed_plant_t *event_list, weed_plant_t *st_event, boolean exact)
void free_pulse_audio_buffers(void)
volatile size_t samples_filled
number of samples filled (readonly client)
void audio_cache_end(void)
double _shrink_factor
resampling ratio
size_t start_sample
used for reading (readonly server)
int64_t sample_move_float_int(void *holding_buff, float **float_buffer, int nsamps, double scale, int chans, int asamps, int usigned, boolean swap_endian, boolean float_interleaved, float vol) GNU_HOT
returns frames output
uint8_t * _filebuffer
raw data to/from file - can be cast to int16_t
boolean normalise_audio(int fnum, double start, double end, float thresh)
void append_to_audio_bufferf(float *src, uint64_t nsamples, int channum)
float get_float_audio_val_at_time(int fnum, int afd, double secs, int chnum, int chans) GNU_HOT
boolean resync_audio(double frameno)
resync audio playback to the current video frame
uint8_t ** buffer16_8
sample data in 8 bit format (or NULL)
float audiofile_get_maxvol(int fnum, double start, double end, float thresh)
boolean float_deinterleave(float *fbuffer, int nsamps, int nchans) GNU_HOT
volatile boolean die
set to TRUE to shut down thread
void sample_move_float_float(float *dst, float *src, uint64_t nsamples, double scale, int dst_skip) GNU_HOT
lives_cancel_t handle_audio_timeout(void)
void sample_move_d16_d16(short *dst, short *src, uint64_t nsamples, size_t tbytes, double scale, int nDstChannels, int nSrcChannels, int swap_endian, int swap_sign) GNU_HOT
const char * audio_player_get_display_name(const char *aplayer)
void sample_silence_stream(int nchans, int64_t nframes)
boolean start_audio_stream(void)
void append_to_audio_buffer16(void *src, uint64_t nsamples, int channum)
void preview_aud_vol(void)
@ LIVES_CONVERT_OPERATION
int64_t sample_move_abuf_float(float **obuf, int nchans, int nsamps, int out_arate, float vol) GNU_HOT
copy audio data from cache into audio sound buffer
void aud_fade(int fileno, double startt, double endt, double startv, double endv)
fade in/fade out
void free_audio_frame_buffer(lives_audio_buf_t *abuf)
float ** bufferf
sample data in float format (or NULL)
lives_cancel_t
cancel reason
void stop_audio_stream(void)
int32_t ** buffer32
sample data in 32 bit format (or NULL)
void apply_rte_audio_end(boolean del)
int _cseek
current seek pos
lives_audio_buf_t * audio_cache_get_buffer(void)
int64_t render_audio_segment(int nfiles, int *from_files, int to_file, double *avels, double *fromtime, ticks_t tc_start, ticks_t tc_end, double *chvol, double opvol_start, double opvol_end, lives_audio_buf_t *obuf)
size_t samp_space
buffer space in samples (* by sizeof(type) to get bytesize) [if interleaf, also * by chans]
boolean get_audio_from_plugin(float **fbuffer, int nchans, int arate, int nsamps, boolean is_audio_thread)
int _cfileno
current fileno
boolean apply_rte_audio(int64_t nframes)
float sample_move_d16_float(float *dst, short *src, uint64_t nsamples, uint64_t src_skip, int is_unsigned, boolean rev_endian, float vol) GNU_HOT
void sample_silence_dS(float *dst, uint64_t nsamples)
size_t _csamp_space
current sample buffer size in single channel samples
double shrink_factor
resampling ratio
void init_pulse_audio_buffers(int achans, int arate, boolean exact)
char * lives_get_audio_file_name(int fnum)
void clear_audio_stream(void)
boolean adjust_clip_volume(int fileno, float newvol, boolean make_backup)
void init_jack_audio_buffers(int achans, int arate, boolean exact)
volatile boolean is_ready
void sample_move_d8_d16(short *dst, uint8_t *src, uint64_t nsamples, size_t tbytes, double scale, int nDstChannels, int nSrcChannels, int swap_sign) GNU_HOT
boolean sequential
hint that we will read sequentially starting from seek
void audio_free_fnames(void)
lives_audio_buf_t * audio_cache_init(void)
volatile struct _aserver_message_t * next
boolean push_audio_to_channel(weed_plant_t *filter, weed_plant_t *achan, lives_audio_buf_t *abuf)
fill the audio channel(s) for effects with mixed audio / video
ssize_t _cbytesize
current _filebuffer bytesize; if this changes we need to realloc _filebuffer
uint8_t ** buffer8
sample data in 8 bit format (or NULL)
void init_audio_frame_buffers(short aplayer)
int _casamps
current out_asamps
char * get_achannel_name(int totchans, int idx) WARN_UNUSED
lives_audio_track_state_t * get_audio_and_effects_state_at(weed_plant_t *event_list, weed_plant_t *st_event, weed_timecode_t fill_tc, int what_to_get, boolean exact)
get audio (and optionally video) state at timecode tc OR before event st_event
boolean apply_rte_audio_init(void)
short ** buffer16
sample data in 16 bit format (or NULL)
int in_achans
channels for _filebuffer side
int64_t sample_move_abuf_int16(short *obuf, int nchans, int nsamps, int out_arate) GNU_HOT
copy audio data from cache into audio sound buffer
int _cachans
current output channels
boolean float_interleave(float *fbuffer, int nsamps, int nchans) GNU_HOT