2004-06-23 23:17:30 +00:00
|
|
|
#ifndef foosampleutilhfoo
|
|
|
|
|
#define foosampleutilhfoo
|
|
|
|
|
|
2004-07-16 19:56:36 +00:00
|
|
|
/***
|
2006-06-19 21:53:48 +00:00
|
|
|
This file is part of PulseAudio.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2007-02-13 15:35:19 +00:00
|
|
|
Copyright 2004-2006 Lennart Poettering
|
|
|
|
|
Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2004-07-16 19:56:36 +00:00
|
|
|
by the Free Software Foundation; either version 2 of the License,
|
|
|
|
|
or (at your option) any later version.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
2004-07-16 19:56:36 +00:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2006-06-19 21:53:48 +00:00
|
|
|
along with PulseAudio; if not, write to the Free Software
|
2004-07-16 19:56:36 +00:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulse/sample.h>
|
|
|
|
|
#include <pulse/volume.h>
|
|
|
|
|
#include <pulsecore/memblock.h>
|
|
|
|
|
#include <pulsecore/memchunk.h>
|
2004-06-29 20:37:24 +00:00
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
typedef struct pa_silence_cache {
|
|
|
|
|
pa_memblock* blocks[PA_SAMPLE_MAX];
|
|
|
|
|
} pa_silence_cache;
|
|
|
|
|
|
|
|
|
|
void pa_silence_cache_init(pa_silence_cache *cache);
|
|
|
|
|
void pa_silence_cache_done(pa_silence_cache *cache);
|
|
|
|
|
|
|
|
|
|
void *pa_silence_memory(void *p, size_t length, const pa_sample_spec *spec);
|
|
|
|
|
pa_memchunk* pa_silence_memchunk(pa_memchunk *c, const pa_sample_spec *spec);
|
|
|
|
|
pa_memblock* pa_silence_memblock(pa_memblock *b, const pa_sample_spec *spec);
|
|
|
|
|
|
|
|
|
|
pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool, pa_memchunk* ret, const pa_sample_spec *spec, size_t length);
|
2004-06-23 23:17:30 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
typedef struct pa_mix_info {
|
|
|
|
|
pa_memchunk chunk;
|
2006-01-27 16:25:31 +00:00
|
|
|
pa_cvolume volume;
|
2004-06-23 23:17:30 +00:00
|
|
|
void *userdata;
|
2007-11-09 17:11:45 +00:00
|
|
|
|
|
|
|
|
/* The following fields are used internally by pa_mix(), should
|
|
|
|
|
* not be initialised by the caller of pa_mix(). */
|
|
|
|
|
void *ptr;
|
|
|
|
|
union {
|
|
|
|
|
int32_t i;
|
|
|
|
|
float f;
|
|
|
|
|
} linear[PA_CHANNELS_MAX];
|
2006-01-27 16:25:31 +00:00
|
|
|
} pa_mix_info;
|
|
|
|
|
|
|
|
|
|
size_t pa_mix(
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_mix_info channels[],
|
2006-01-27 16:25:31 +00:00
|
|
|
unsigned nchannels,
|
|
|
|
|
void *data,
|
|
|
|
|
size_t length,
|
|
|
|
|
const pa_sample_spec *spec,
|
2006-02-23 12:04:31 +00:00
|
|
|
const pa_cvolume *volume,
|
2007-11-09 17:11:45 +00:00
|
|
|
pa_bool_t mute);
|
2006-01-27 16:25:31 +00:00
|
|
|
|
|
|
|
|
void pa_volume_memchunk(
|
|
|
|
|
pa_memchunk*c,
|
|
|
|
|
const pa_sample_spec *spec,
|
|
|
|
|
const pa_cvolume *volume);
|
2004-06-29 20:37:24 +00:00
|
|
|
|
2007-10-28 19:13:50 +00:00
|
|
|
size_t pa_frame_align(size_t l, const pa_sample_spec *ss) PA_GCC_PURE;
|
|
|
|
|
|
2008-10-21 18:26:24 +02:00
|
|
|
pa_bool_t pa_frame_aligned(size_t l, const pa_sample_spec *ss) PA_GCC_PURE;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
void pa_interleave(const void *src[], unsigned channels, void *dst, size_t ss, unsigned n);
|
|
|
|
|
void pa_deinterleave(const void *src, void *dst[], unsigned channels, size_t ss, unsigned n);
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
void pa_sample_clamp(pa_sample_format_t format, void *dst, size_t dstr, const void *src, size_t sstr, unsigned n);
|
|
|
|
|
|
2008-08-28 17:53:01 +02:00
|
|
|
pa_usec_t pa_bytes_to_usec_round_up(uint64_t length, const pa_sample_spec *spec);
|
|
|
|
|
size_t pa_usec_to_bytes_round_up(pa_usec_t t, const pa_sample_spec *spec);
|
|
|
|
|
|
2009-01-08 21:12:03 +01:00
|
|
|
void pa_memchunk_dump_to_file(pa_memchunk *c, const char *fn);
|
|
|
|
|
|
2004-06-23 23:17:30 +00:00
|
|
|
#endif
|