Navit SVN

/work/compile/navit/src/navit/support/espeak/mbrolib.h

00001 #ifndef MBROLIB_H
00002 #define MBROLIB_H
00003 
00004 /*
00005  * mbrolib: mbrola wrapper.
00006  *
00007  * Copyright (C) 2007 Gilles Casse <gcasse@oralux.org>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 3 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022  *
00023 */
00024 
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028 
00029 /* < types */
00030 
00033 typedef struct {
00034   int ignore_error; /* 1=Ignore any fatal error or unknown diphone */ 
00035   char comment_char; /* Comment character */
00036   float volume_ratio; /* Volume ratio */
00037   float frequency_ratio; /* Applied to pitch points */
00038   float time_ratio; /* Applied to phone durations */
00039 } mbrolib_parameter;
00040 
00041 
00044 typedef enum {
00045   MBROLIB_OK=0,
00046   MBROLIB_DATABASE_NOT_INSTALLED,
00047   MBROLIB_INVAL,
00048   MBROLIB_OUT_OF_MEMORY,
00049   MBROLIB_OUT_OF_RANGE,
00050   MBROLIB_READ_ERROR,
00051   MBROLIB_WRITE_ERROR
00052 } MBROLIB_ERROR;
00053 
00054 
00055 
00058 typedef enum {
00059   MBROLIB_FEMALE,
00060   MBROLIB_MALE
00061 } MBROLIB_GENDER;
00062 
00063 
00064 
00067 typedef struct {
00068   char *name; /* name (for example: "en1") */
00069   char *filename; /* database pathname (for example: "/usr/share/mbrola/voices/en1) */
00070   int rate; /* database sample rate */
00071   MBROLIB_GENDER gender;
00072   const char *language; /* Language and optional dialect qualifier in ascii (e.g. en, fr_ca). */
00073 } mbrolib_voice;
00074 
00075 /* > */
00076 
00077 
00085 void* mbrolib_init( int sample_rate);
00086 typedef void* (t_mbrolib_init)(int);
00087 
00088 
00100 const mbrolib_voice ** mbrolib_list_voices( void* the_handle);
00101 typedef const mbrolib_voice ** (t_mbrolib_list_voices)(void*);
00102 
00103 
00104 
00114 MBROLIB_ERROR mbrolib_set_voice( void* the_handle, const char* the_name);
00115 typedef MBROLIB_ERROR (t_mbrolib_set_voice)( void*, const char*);
00116 
00117 
00118 
00128 MBROLIB_ERROR mbrolib_get_parameter(void* the_handle, mbrolib_parameter* the_parameter);
00129 typedef MBROLIB_ERROR (t_mbrolib_get_parameter)(void*, mbrolib_parameter*);
00130 
00131 
00132 
00141 MBROLIB_ERROR mbrolib_set_parameter(void* the_handle, const mbrolib_parameter* the_parameter);
00142 typedef MBROLIB_ERROR (t_mbrolib_set_parameter)(void*, const mbrolib_parameter*);
00143 
00144 
00145 
00156 MBROLIB_ERROR mbrolib_write(void* the_handle, const char* the_mbrola_phonemes, size_t the_size);
00157 typedef MBROLIB_ERROR (t_mbrolib_write)(void*, const char*, size_t);
00158 
00159 
00160 
00174 MBROLIB_ERROR mbrolib_read(void* the_handle, short* the_samples, int the_max_size, int* the_read_size);
00175 typedef MBROLIB_ERROR (t_mbrolib_read)(void*, short*, int, int*);
00176 
00177 
00178 
00184 void mbrolib_flush(void* the_handle);
00185 typedef void (t_mbrolib_flush)(void*);
00186 
00187 
00188 
00196 MBROLIB_ERROR mbrolib_terminate(void* the_handle);
00197 typedef MBROLIB_ERROR (t_mbrolib_terminate)(void*);
00198 
00199 
00200 
00201 #ifdef __cplusplus
00202 }
00203 #endif
00204 
00205 #endif