summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/envelope.h
blob: 4fa36579600ae25fd5e6dfb8856ecf025d3bfbb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef foopulseenvelopehfoo
#define foopulseenvelopehfoo

/***
  This file is part of PulseAudio.

  Copyright 2007 Lennart Poettering

  PulseAudio is free software; you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License as
  published by the Free Software Foundation; either version 2.1 of the
  License, or (at your option) any later version.

  PulseAudio is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with PulseAudio; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  USA.
***/

#include <pulsecore/macro.h>
#include <pulsecore/memchunk.h>

#include <pulse/sample.h>

#define PA_ENVELOPE_POINTS_MAX 4U

typedef struct pa_envelope pa_envelope;
typedef struct pa_envelope_item pa_envelope_item;

typedef struct pa_envelope_def {
    unsigned n_points;

    pa_usec_t points_x[PA_ENVELOPE_POINTS_MAX];
    struct {
        int32_t i[PA_ENVELOPE_POINTS_MAX];
        float f[PA_ENVELOPE_POINTS_MAX];
    } points_y;
} pa_envelope_def;

pa_envelope *pa_envelope_new(const pa_sample_spec *ss);
void pa_envelope_free(pa_envelope *e);
pa_envelope_item *pa_envelope_add(pa_envelope *e, const pa_envelope_def *def);
pa_envelope_item *pa_envelope_replace(pa_envelope *e, pa_envelope_item *i, const pa_envelope_def *def);
void pa_envelope_remove(pa_envelope *e, pa_envelope_item *i);
void pa_envelope_apply(pa_envelope *e, pa_memchunk *chunk);
void pa_envelope_rewind(pa_envelope *e, size_t n_bytes);
void pa_envelope_restart(pa_envelope* e);
pa_bool_t pa_envelope_is_finished(pa_envelope* e);
int32_t pa_envelope_length(pa_envelope *e);

#endif