summaryrefslogtreecommitdiffstats
path: root/include/xas/mixer.h
blob: 3cf8067e43bc3fbab3ab704c730762d86dad89b4 (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
#ifndef _XAS_MIXER_H
#define _XAS_MIXER_H

#include <sys/types.h>

#include <xas/object.h>
#include <xas/audio.h>

#define XAS_MIXER_INPUT_STREAM_MANAGED (1 << 0)

typedef struct _xas_mixer_input {
    xas_audio_stream *stream;

    float gain,
          bias_l,
          bias_r;

    int flags;

    struct _xas_mixer_input *next;
} xas_mixer_input;

typedef struct _xas_mixer {
    xas_object obj;
    xas_mixer_input *inputs,
                      *last;

    xas_audio_stream *output;

    void *buf;
    size_t buffer_size;
} xas_mixer;

xas_mixer *xas_mixer_new(xas_audio_format format, size_t buffer_size);

void xas_mixer_destroy(xas_mixer *mixer);

xas_audio_stream *xas_mixer_output(xas_mixer *mixer);

xas_mixer_input *xas_mixer_input_add(xas_mixer *mixer,
                                         xas_audio_stream *stream,
                                         float gain,
                                         float pan);

xas_mixer_input *xas_mixer_object_add(xas_mixer *mixer,
                                          xas_object *object,
                                          float gain,
                                          float pan);

void xas_mixer_input_set_gain(xas_mixer_input *input, float gain);

void xas_mixer_input_set_pan(xas_mixer_input *input, float pan);

#endif /* _XAS_MIXER_H */