1 /* 2 * Copyright (c) 2005, 2006, IBM Corp. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. * 10 * Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * * Neither the name of IBM Corp. nor the names of its 14 * contributors may be used to endorse or promote products derived from 15 * this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 /* 31 * 32 * eci.h APIs for IBM Text To Speech 33 * 34 */ 35 36 #ifndef __ECI_H 37 #define __ECI_H 38 39 40 #ifndef MOTIF 41 typedef int Boolean; 42 #endif 43 44 #define ECITrue 1 45 #define ECIFalse 0 46 47 #ifndef ECIFNDECLARE 48 typedef signed long ECIint32; 49 #ifdef _MSC_VER 50 #ifdef _WIN32_WCE 51 typedef char ECIsystemChar; 52 #define ECIFNDECLARE __stdcall 53 #elif defined _WIN32 54 #include <tchar.h> 55 typedef _TCHAR ECIsystemChar; 56 #define ECIFNDECLARE __stdcall 57 #endif 58 59 #elif defined __TURBOC__ 60 #ifdef __WIN32__ 61 #include <tchar.h> 62 #define ECIFNDECLARE __stdcall 63 typedef _TCHAR ECIsystemChar; 64 #endif 65 #else 66 #define ECIFNDECLARE 67 typedef char ECIsystemChar; 68 #endif 69 #endif 70 71 #ifndef NULL_ECI_HAND 72 #define NULL_ECI_HAND 0 73 #endif 74 75 #define ECI_PRESET_VOICES 8 76 #define ECI_USER_DEFINED_VOICES 8 77 78 #define ECI_VOICE_NAME_LENGTH 30 79 80 #define ECI_NOERROR 0x00000000 81 #define ECI_SYSTEMERROR 0x00000001 82 #define ECI_MEMORYERROR 0x00000002 83 #define ECI_MODULELOADERROR 0x00000004 84 #define ECI_DELTAERROR 0x00000008 85 #define ECI_SYNTHERROR 0x00000010 86 #define ECI_DEVICEERROR 0x00000020 87 #define ECI_DICTERROR 0x00000040 88 #define ECI_PARAMETERERROR 0x00000080 89 #define ECI_SYNTHESIZINGERROR 0x00000100 90 #define ECI_DEVICEBUSY 0x00000200 91 #define ECI_SYNTHESISPAUSED 0x00000400 92 #define ECI_REENTRANTCALL 0x00000800 93 #define ECI_ROMANIZERERROR 0x00001000 94 #define ECI_SYNTHESIZING 0x00002000 95 96 #define eciPhonemeLength (4) 97 98 #ifdef __cplusplus 99 extern "C" { 100 #endif 101 102 typedef void* ECIHand; 103 104 typedef const void* ECIInputText; 105 106 enum ECIParam { 107 eciSynthMode, 108 eciInputType, 109 eciTextMode, 110 eciDictionary, 111 eciSampleRate = 5, 112 eciWantPhonemeIndices = 7, 113 eciRealWorldUnits, 114 eciLanguageDialect, 115 eciNumberMode, 116 eciWantWordIndex = 12, 117 eciNumDeviceBlocks, 118 eciSizeDeviceBlocks, 119 eciNumPrerollDeviceBlocks, 120 eciSizePrerollDeviceBlocks, 121 eciNumParams 122 }; 123 124 enum ECIVoiceParam { 125 eciGender, 126 eciHeadSize, 127 eciPitchBaseline, 128 eciPitchFluctuation, 129 eciRoughness, 130 eciBreathiness, 131 eciSpeed, 132 eciVolume, 133 eciNumVoiceParams 134 }; 135 136 enum ECIDictError { 137 DictNoError, 138 DictFileNotFound, 139 DictOutOfMemory, 140 DictInternalError, 141 DictNoEntry, 142 DictErrLookUpKey, 143 DictAccessError, 144 DictInvalidVolume 145 }; 146 147 enum ECIVoiceError { 148 VoiceNoError, 149 VoiceSystemError, 150 VoiceNotRegisteredError, 151 VoiceInvalidFileFormatError 152 }; 153 154 typedef void* ECIDictHand; 155 #define NULL_DICT_HAND 0 156 enum ECIDictVolume { 157 eciMainDict = 0, 158 eciRootDict = 1, 159 eciAbbvDict = 2, 160 eciMainDictExt = 3 161 }; 162 163 enum ECILanguageDialect { 164 NODEFINEDCODESET = 0x00000000, 165 eciGeneralAmericanEnglish = 0x00010000, 166 eciBritishEnglish = 0x00010001, 167 eciCastilianSpanish = 0x00020000, 168 eciMexicanSpanish = 0x00020001, 169 eciStandardFrench = 0x00030000, 170 eciCanadianFrench = 0x00030001, 171 eciStandardGerman = 0x00040000, 172 eciStandardItalian = 0x00050000, 173 eciMandarinChinese = 0x00060000, 174 eciMandarinChineseGB = eciMandarinChinese, 175 eciMandarinChinesePinYin = 0x00060100, 176 eciMandarinChineseUCS = 0x00060800, 177 eciTaiwaneseMandarin = 0x00060001, 178 eciTaiwaneseMandarinBig5 = eciTaiwaneseMandarin, 179 eciTaiwaneseMandarinZhuYin = 0x00060101, 180 eciTaiwaneseMandarinPinYin = 0x00060201, 181 eciTaiwaneseMandarinUCS = 0x00060801, 182 eciBrazilianPortuguese = 0x00070000, 183 eciStandardJapanese = 0x00080000, 184 eciStandardJapaneseSJIS = eciStandardJapanese, 185 eciStandardJapaneseUCS = 0x00080800, 186 eciStandardFinnish = 0x00090000, 187 eciStandardKorean = 0x000A0000, 188 eciStandardKoreanUHC = eciStandardKorean, 189 eciStandardKoreanUCS = 0x000A0800, 190 eciStandardCantonese = 0x000B0000, 191 eciStandardCantoneseGB = eciStandardCantonese, 192 eciStandardCantoneseUCS = 0x000B0800, 193 eciHongKongCantonese = 0x000B0001, 194 eciHongKongCantoneseBig5 = eciHongKongCantonese, 195 eciHongKongCantoneseUCS = 0x000B0801, 196 eciStandardDutch = 0x000C0000, 197 eciStandardNorwegian = 0x000D0000, 198 eciStandardSwedish = 0x000E0000, 199 eciStandardDanish = 0x000F0000, 200 eciStandardReserved = 0x00100000, 201 eciStandardThai = 0x00110000, 202 eciStandardThaiTIS = eciStandardThai 203 204 }; 205 206 enum ECIPartOfSpeech { 207 eciUndefinedPOS = 0, 208 eciFutsuuMeishi = 1, 209 eciKoyuuMeishi, 210 eciSahenMeishi, 211 eciMingCi 212 }; 213 214 #if defined(WIN32) 215 #pragma pack(push, 1) 216 #elif defined(UNDER_CE) && (defined(MIPS) || defined(SH3)) 217 #pragma pack(push, 4) 218 #endif 219 typedef struct { 220 union { 221 unsigned char sz[eciPhonemeLength+1]; 222 unsigned short wsz[eciPhonemeLength+1]; 223 } phoneme; 224 enum ECILanguageDialect eciLanguageDialect; 225 unsigned char mouthHeight; 226 unsigned char mouthWidth; 227 unsigned char mouthUpturn; 228 unsigned char jawOpen; 229 unsigned char teethUpperVisible; 230 unsigned char teethLowerVisible; 231 unsigned char tonguePosn; 232 unsigned char lipTension; 233 } ECIMouthData; 234 235 typedef struct ECIVoiceAttrib { 236 int eciSampleRate; 237 enum ECILanguageDialect languageID; 238 } ECIVoiceAttrib; 239 240 #if defined(WIN32) || ( defined(UNDER_CE) && (defined(MIPS) || defined(SH3)) ) 241 #pragma pack(pop) 242 #endif 243 244 enum ECIMessage { 245 eciWaveformBuffer, eciPhonemeBuffer, eciIndexReply, eciPhonemeIndexReply, eciWordIndexReply, eciStringIndexReply, 246 eciAudioIndexReply, eciSynthesisBreak 247 }; 248 249 enum ECICallbackReturn { 250 eciDataNotProcessed, eciDataProcessed, eciDataAbort 251 }; 252 253 typedef enum ECICallbackReturn (*ECICallback)(ECIHand hEngine, enum ECIMessage Msg, long lParam, void *pData); 254 255 #if defined(_WIN32) || defined(_Windows) 256 enum ECIDialogBox { 257 eciGeneralDB, 258 eciAboutDB, 259 eciVoicesDB, 260 eciReadingDB, 261 eciMainDictionaryDB, 262 eciRootDictionaryDB, 263 eciNumDialogBoxes 264 }; 265 #endif 266 267 268 #ifdef __cplusplus 269 } 270 #endif 271 272 #ifdef __cplusplus 273 extern "C" { 274 #endif 275 276 ECIHand ECIFNDECLARE eciNew(void); 277 ECIHand ECIFNDECLARE eciNewEx(enum ECILanguageDialect Value); 278 int ECIFNDECLARE eciGetAvailableLanguages(enum ECILanguageDialect *aLanguages, int *nLanguages); 279 ECIHand ECIFNDECLARE eciDelete(ECIHand hEngine); 280 Boolean ECIFNDECLARE eciReset(ECIHand hEngine); 281 Boolean ECIFNDECLARE eciIsBeingReentered(ECIHand hEngine); 282 void ECIFNDECLARE eciVersion(char *pBuffer); 283 int ECIFNDECLARE eciProgStatus(ECIHand hEngine); 284 void ECIFNDECLARE eciErrorMessage(ECIHand hEngine, void* buffer); 285 void ECIFNDECLARE eciClearErrors(ECIHand hEngine); 286 Boolean ECIFNDECLARE eciTestPhrase(ECIHand hEngine); 287 Boolean ECIFNDECLARE eciSpeakText(ECIInputText pText, Boolean bAnnotationsInTextPhrase); 288 Boolean ECIFNDECLARE eciSpeakTextEx(ECIInputText pText, Boolean bAnnotationsInTextPhrase, enum ECILanguageDialect Value); 289 int ECIFNDECLARE eciGetParam(ECIHand hEngine, enum ECIParam Param); 290 int ECIFNDECLARE eciSetParam(ECIHand hEngine, enum ECIParam Param, int iValue); 291 int ECIFNDECLARE eciGetDefaultParam(enum ECIParam parameter); 292 int ECIFNDECLARE eciSetDefaultParam(enum ECIParam parameter, int value); 293 Boolean ECIFNDECLARE eciCopyVoice(ECIHand hEngine, int iVoiceFrom, int iVoiceTo); 294 Boolean ECIFNDECLARE eciGetVoiceName(ECIHand hEngine, int iVoice, void *pBuffer); 295 Boolean ECIFNDECLARE eciSetVoiceName(ECIHand hEngine, int iVoice, const void *pBuffer); 296 int ECIFNDECLARE eciGetVoiceParam(ECIHand hEngine, int iVoice, enum ECIVoiceParam Param); 297 int ECIFNDECLARE eciSetVoiceParam(ECIHand hEngine, int iVoice, 298 enum ECIVoiceParam Param, int iValue); 299 Boolean ECIFNDECLARE eciAddText(ECIHand hEngine, ECIInputText pText); 300 Boolean ECIFNDECLARE eciInsertIndex(ECIHand hEngine, int iIndex); 301 Boolean ECIFNDECLARE eciSynthesize(ECIHand hEngine); 302 Boolean ECIFNDECLARE eciSynthesizeFile(ECIHand hEngine, const void *pFilename); 303 Boolean ECIFNDECLARE eciClearInput(ECIHand hEngine); 304 Boolean ECIFNDECLARE eciGeneratePhonemes(ECIHand hEngine, int iSize, void *pBuffer); 305 int ECIFNDECLARE eciGetIndex(ECIHand hEngine); 306 Boolean ECIFNDECLARE eciStop(ECIHand hEngine); 307 Boolean ECIFNDECLARE eciSpeaking(ECIHand hEngine); 308 Boolean ECIFNDECLARE eciSynchronize(ECIHand hEngine); 309 Boolean ECIFNDECLARE eciSetOutputBuffer(ECIHand hEngine, int iSize, short *psBuffer); 310 Boolean ECIFNDECLARE eciSetOutputFilename(ECIHand hEngine, const void *pFilename); 311 Boolean ECIFNDECLARE eciSetOutputDevice(ECIHand hEngine, int iDevNum); 312 Boolean ECIFNDECLARE eciPause(ECIHand hEngine, Boolean On); 313 void ECIFNDECLARE eciRegisterCallback(ECIHand hEngine, ECICallback Callback, void *pData); 314 ECIDictHand ECIFNDECLARE eciNewDict(ECIHand hEngine); 315 ECIDictHand ECIFNDECLARE eciGetDict(ECIHand hEngine); 316 enum ECIDictError ECIFNDECLARE eciSetDict(ECIHand hEngine, ECIDictHand hDict); 317 ECIDictHand ECIFNDECLARE eciDeleteDict(ECIHand hEngine, ECIDictHand hDict); 318 enum ECIDictError ECIFNDECLARE eciLoadDict(ECIHand hEngine, ECIDictHand hDict, enum ECIDictVolume DictVol, ECIInputText pFilename); 319 enum ECIDictError ECIFNDECLARE eciSaveDict(ECIHand hEngine, ECIDictHand hDict, enum ECIDictVolume DictVol, ECIInputText pFilename); 320 enum ECIDictError ECIFNDECLARE eciUpdateDict(ECIHand hEngine, ECIDictHand hDict, 321 enum ECIDictVolume DictVol, ECIInputText pKey, ECIInputText pTranslationValue); 322 enum ECIDictError ECIFNDECLARE eciDictFindFirst(ECIHand hEngine, 323 ECIDictHand hDict, enum ECIDictVolume DictVol, 324 ECIInputText *ppKey, ECIInputText *ppTranslationValue); 325 enum ECIDictError ECIFNDECLARE eciDictFindNext(ECIHand hEngine, 326 ECIDictHand hDict, enum ECIDictVolume DictVol, 327 ECIInputText *ppKey, ECIInputText *ppTranslationValue); 328 const char *ECIFNDECLARE eciDictLookup(ECIHand hEngine, 329 ECIDictHand hDict, enum ECIDictVolume DictVol, 330 ECIInputText pKey); 331 enum ECIDictError ECIFNDECLARE eciUpdateDictA(ECIHand hEngine, 332 ECIDictHand hDict, enum ECIDictVolume DictVol, 333 ECIInputText pKey, ECIInputText pTranslationValue, enum ECIPartOfSpeech PartOfSpeech); 334 enum ECIDictError ECIFNDECLARE eciDictFindFirstA(ECIHand hEngine, 335 ECIDictHand hDict, enum ECIDictVolume DictVol, 336 ECIInputText *ppKey, ECIInputText *ppTranslationValue, enum ECIPartOfSpeech *pPartOfSpeech); 337 enum ECIDictError ECIFNDECLARE eciDictFindNextA(ECIHand hEngine, 338 ECIDictHand hDict, enum ECIDictVolume DictVol, 339 ECIInputText *ppKey, ECIInputText *ppTranslationValue, enum ECIPartOfSpeech *pPartOfSpeech); 340 enum ECIDictError ECIFNDECLARE eciDictLookupA(ECIHand hEngine, 341 ECIDictHand hDict, enum ECIDictVolume DictVol, 342 ECIInputText pKey, ECIInputText *ppTranslationValue, enum ECIPartOfSpeech *pPartOfSpeech); 343 344 345 #define eciDictFindFirst(eciHandle, dictHandle, dictVolume, ppkey, pptranslation) \ 346 eciDictFindFirst((eciHandle), (dictHandle), (dictVolume), (ECIInputText *) (ppkey), (ECIInputText *) (pptranslation)) 347 #define eciDictFindNext(eciHandle, dictHandle, dictVolume, ppkey, pptranslation) \ 348 eciDictFindNext((eciHandle), (dictHandle), (dictVolume), (ECIInputText *) (ppkey), (ECIInputText *) (pptranslation)) 349 350 enum ECIVoiceError ECIFNDECLARE eciRegisterVoice(ECIHand eciHand, int voiceNumber, void *vData, ECIVoiceAttrib *vAttrib); 351 enum ECIVoiceError ECIFNDECLARE eciUnregisterVoice(ECIHand eciHand, int voiceNumber, ECIVoiceAttrib *vAttrib, void **vData); 352 353 #ifndef __ECIFILTER_H 354 #define __ECIFILTER_H 355 356 typedef void *ECIFilterHand; 357 358 #define NULL_FILTER_HAND 0 359 360 /*typedef*/ enum ECIFilterError { 361 FilterNoError, 362 FilterFileNotFound, 363 FilterOutOfMemory, 364 FilterInternalError, 365 FilterAccessError 366 }; 367 368 enum ECIFilterError ECIFNDECLARE eciDeactivateFilter(ECIHand eciHandle, ECIFilterHand pFilter); 369 #ifdef __cplusplus 370 ECIFilterHand ECIFNDECLARE eciNewFilter(ECIHand eciHandle, unsigned int filterNum = 0, Boolean bGlobal = false); 371 #else 372 ECIFilterHand ECIFNDECLARE eciNewFilter(ECIHand eciHandle, unsigned int filterNum, Boolean bGlobal); 373 #endif 374 enum ECIFilterError ECIFNDECLARE eciActivateFilter(ECIHand eciHandle, ECIFilterHand whichFilterHand); 375 ECIFilterHand ECIFNDECLARE eciDeleteFilter(ECIHand eciHandle, ECIFilterHand whichFilterHand); 376 enum ECIFilterError ECIFNDECLARE eciUpdateFilter(ECIHand eciHandle, ECIFilterHand whichFilterHand, 377 ECIInputText key, ECIInputText translation); 378 enum ECIFilterError ECIFNDECLARE eciGetFilteredText(ECIHand eciHandle, ECIFilterHand whichFilterHand, 379 ECIInputText input, ECIInputText *filteredText); 380 #endif 381 382 #ifdef __cplusplus 383 } 384 #endif 385 386 #endif 387