summaryrefslogtreecommitdiffstats
path: root/include/xas/synth.h
blob: 1d070aacd14f9932ad9ceaff54ac8b621f60429c (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
#ifndef _XAS_SYNTH_H
#define _XAS_SYNTH_H

#include <stdint.h>
#include <sys/types.h>

#include <xas/audio.h>

typedef struct _xas_synth xas_synth;

typedef int16_t (*xas_synth_callback_sample)(xas_synth *synth, void *ctx);

typedef void (*xas_synth_callback_cleanup)(xas_synth *synth, void *ctx);

struct _xas_synth {
    size_t sample_size,
           sample_rate;

    xas_synth_callback_sample  sample;
    xas_synth_callback_cleanup cleanup;
    void *ctx;
};

xas_audio_stream *xas_synth_new(size_t sample_size,
                                    size_t sample_rate,
                                    size_t buffer_size,
                                    xas_synth_callback_sample  sample,
                                    xas_synth_callback_cleanup cleanup,
                                    void *ctx);

#endif /* _XAS_SYNTH_H */