mbrowrap.h
3.13 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* mbrowrap -- A wrapper library around the mbrola binary
* providing a subset of the API from the Windows mbrola DLL.
*
* Copyright (C) 2010 by Nicolas Pitre <nico@fluxnic.net>
* Copyright (C) 2016 Reece H. Dunn
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*/
#ifndef MBROWRAP_H
#define MBROWRAP_H
#ifdef __cplusplus
extern "C"
{
#endif
#if !defined(_WIN32) && !defined(_WIN64)
#define WINAPI
typedef int BOOL;
#endif
/*
* Initialize mbrola. The 'voice_path' argument must contain the
* path and file name to the mbrola voice database to be used. Returned
* value is 0 on success, or an error code otherwise (currently only -1
* is returned. If not successful, lastErrorStr_MBR() will provide the
* error reason. If this is successful, then close_MBR() must be called
* before init_MBR() can be called again.
*/
int (WINAPI *init_MBR)(char *voice_path);
/*
* Stop mbrola and release any resources. It is necessary to call
* this after a successful call to init_MBR() before init_MBR() can be
* called again.
*/
void (WINAPI *close_MBR)(void);
/*
* Stop any ongoing processing and flush all buffers. After this call
* any synthesis request will start afresh.
*/
void (WINAPI *reset_MBR)(void);
/*
* Return at most 'nb_samples' audio samples into 'buffer'. The returned
* value is the actual number of samples returned, or -1 on error.
* If not successful, lastErrorStr_MBR() will provide the error reason.
* Samples are always 16-bit little endian.
*/
int (WINAPI *read_MBR)(short *buffer, int nb_samples);
/*
* Write a NULL terminated string of phoneme in the input buffer.
* Return the number of chars actually written, or -1 on error.
* If not successful, lastErrorStr_MBR() will provide the error reason.
*/
int (WINAPI *write_MBR)(char *data);
/*
* Send a flush command to the mbrola input stream.
* This is currently similar to write_MBR("#\n"). Return 1 on success
* or 0 on failure. If not successful, lastErrorStr_MBR() will provide
* the error reason.
*/
int (WINAPI *flush_MBR)(void);
/*
* Return the audio sample frequency of the used voice database.
*/
int (WINAPI *getFreq_MBR)(void);
/*
* Overall volume.
*/
void (WINAPI *setVolumeRatio_MBR)(float value);
/*
* Copy into 'buffer' at most 'bufsize' bytes from the latest error
* message. This may also contain non-fatal errors from mbrola. When
* no error message is pending then an empty string is returned.
* Consecutive calls to lastErrorStr_MBR() will return the same message.
*/
char * (WINAPI *lastErrorStr_MBR)(char *buffer, int bufsize);
/*
* Tolerance to missing diphones.
*/
void (WINAPI *setNoError_MBR)(int no_error);
BOOL load_MBR(void);
void unload_MBR(void);
#ifdef __cplusplus
}
#endif
#endif