// Interface to Mikropuhe for writing files. // TAB=3 spaces // // Some key points: // // - Interface is a DLL loaded at program's startup or when needed and unloaded when speech is no longer needed // - OLE/SAPI is not used at all // #ifdef TH_LINUX // Linux #define TH_STDCALL _cdecl #else // Win32 #define TH_STDCALL __stdcall #endif // DLL function type definitions - taken from atl.h #if defined(MPINT_DLLIMPORT) // If using import library #ifdef __cplusplus #define MPINTAPI extern "C" long __declspec(dllimport) TH_STDCALL #define MPINTAPI_(x) extern "C" __declspec(dllimport) x TH_STDCALL #else #define MPINTAPI long __declspec(dllimport) TH_STDCALL #define MPINTAPI_(x) __declspec(dllimport) x TH_STDCALL #endif #elif defined(MPINT_DLLIMPLEMENT) // When building Mikropuhe DLL #ifdef __cplusplus #ifdef TH_LINUXGCC #define MPINTAPI extern "C" long TH_STDCALL #define MPINTAPI_(x) extern "C" x TH_STDCALL #else #define MPINTAPI extern "C" long __declspec(dllexport) TH_STDCALL #define MPINTAPI_(x) extern "C" __declspec(dllexport) x TH_STDCALL #endif #else #define MPINTAPI long __declspec(dllexport) TH_STDCALL #define MPINTAPI_(x) __declspec(dllexport) x TH_STDCALL #endif #else // Give the prototypes #define MPINTAPI extern "C" long #define MPINTAPI_(x) extern "C" x // GetProcAddress used to link to dll. No need to prototypes. // Or dlopen() in Linux //#define MPINT_NOPROTOTYPES #endif // Error codes #define MPINT_ERR_GENERAL -2001 // Unspecific error #define MPINT_ERR_SYNTH -2002 // Error synthesizing text #define MPINT_ERR_MEM -2003 // Out of memory #define MPINT_ERR_DESTFILEOPEN -2004 // Could not open destination file for writing #define MPINT_ERR_DESTFILEWRITE -2005 // Writing destination file failed (disk full?) #define MPINT_ERR_EINVAL -2006 // Invalid parameter #define MPINT_ERR_INITBADKEY -2100 // MPINT_Init called with bad key #define MPINT_ERR_INITNOVOICES -2101 // MPINT_Init did not find any voice files from DLLs directory (*.tdb, *.m42) #define MPINT_ERR_INITVOICEFAIL -2102 // MPINT_Init could not load voice file #define MPINT_ERR_INITTEXTPARSE -2103 // MPINT_Init could not load text parsing file (mpwrfile.tul or mpwrfile.tfg) #define MPINT_ERR_SOUNDCARD -2104 // Only with MPINT_Speak-call #ifndef MPINT_SPEAKFILE_PARAMS #define MPINT_SPEAKFILE_PARAMS // nTags field of extended parameters for SpeakFile-call enum { MPINT_TAGS_OWN = 1, // Mikropuhe tags, Own tags are either -NOPx or _N=xxxxx (see Mikropuhe manual for details) MPINT_TAGS_SAPI4 = 2, // SAPI4-tags are allowed MPINT_TAGS_SAPI5 = 4, // SAPI5-tags are allowed //MPINT_TAGS_VXML = 8 // VoiceXML/SSML tags, they are included in sapi5 support }; // Extended parameters for SpeakFile-call // Always initialize this structure with memset(&rParam, 0, sizeof(rParam)) typedef struct { int nTags; // Combination of MPINT_TAGS_xxx, default=1 int nSaveSynthParams; // 1=Save synthesizer settings to global settings when speaking is complete, 0=Normal operation - do not save int nSampleFreq; // Sampling frequency for the resulting file, 0=Use synthesizer's native (default) // (8000=Run hi-quality telephony filter, other transformations are lo-quality) int nBits; // Sample size 8 or 16 bits, default=16 bits int nChannels; // 1=Mono, 2=Stereo, default=1 int nWriteWavHeader; // 0=Do not write WAV-header, 1=Write WAV-header, it's size will always be 44 bytes const char *pHomePath; // Home path for loading wav-files with tag