summaryrefslogtreecommitdiffstats
path: root/include/xas/vox.h
blob: 5a1cacf373c9c55b87bf31057d1da1d71a810575 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef _XAS_VOX_H
#define _XAS_VOX_H

#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>

#include <xas/audio.h>

#define XAS_VOX_SETTINGS_TMP_PATH    "/tmp/xas-vox.XXXXXX"
#define XAS_VOX_SETTINGS_TMP_PATHLEN 64

enum xas_vox_state {
    XAS_VOX_IDLE,
    XAS_VOX_ACTIVE
};

typedef struct _xas_vox {
    xas_audio_format format;
    size_t buffer_size;

    const char *text2wave_path;
    int argn;
    char **args;

    enum xas_vox_state state;

    int pid,
        stdin,
        stdout;

    char tmpfile[XAS_VOX_SETTINGS_TMP_PATHLEN];
    int tmpfd;
    FILE *tmpfh;

    FILE *in;
} xas_vox;

xas_vox *xas_vox_new_args(xas_audio_format format,
                              size_t buffer_size,
                              const char *text2wave_path,
                              int argn,
                              char **args);

xas_vox *xas_vox_new(xas_audio_format format,
                         size_t buffer_size,
                         const char *text2wave_path);

void xas_vox_destroy(xas_vox *vox);

int xas_vox_set_voice(xas_vox *vox, const char *voice);

int xas_vox_set_parameter(xas_vox *vox,
                            const char *name,
                            const char *value);

int xas_vox_set_parameter_str(xas_vox *vox,
                                const char *name,
                                const char *value);

int xas_vox_set_parameter_float(xas_vox *vox,
                                  const char *name,
                                  float value);

int xas_vox_set_parameter_int(xas_vox *vox,
                                const char *name,
                                int value);

int xas_vox_stop(xas_vox *vox);

int xas_vox_active(xas_vox *vox);

int xas_vox_generate(xas_vox *vox);

int xas_vox_vsayf(xas_vox *vox, const char *message, va_list args);

int xas_vox_sayf(xas_vox *vox, const char *message, ...);

int xas_vox_say(xas_vox *vox, const char *message);

xas_audio_stream *xas_vox_stream_new(xas_vox *vox);

#endif /* _XAS_VOX_H */