/native/external/espeak/src/synth_mbrola.cpp

http://eyes-free.googlecode.com/ · C++ · 753 lines · 581 code · 127 blank · 45 comment · 138 complexity · d89e79291fddd0e500a5c60f1c9ee4f9 MD5 · raw file

  1. /***************************************************************************
  2. * Copyright (C) 2005 to 2007 by Jonathan Duddington *
  3. * email: jonsd@users.sourceforge.net *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 3 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write see: *
  17. * <http://www.gnu.org/licenses/>. *
  18. ***************************************************************************/
  19. #include "StdAfx.h"
  20. #include <stdio.h>
  21. #include <ctype.h>
  22. #include <wctype.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <math.h>
  26. #include "speak_lib.h"
  27. #include "speech.h"
  28. #include "phoneme.h"
  29. #include "synthesize.h"
  30. #include "translate.h"
  31. #include "voice.h"
  32. extern int Read4Bytes(FILE *f);
  33. extern void SetPitch2(voice_t *voice, int pitch1, int pitch2, int *pitch_base, int *pitch_range);
  34. #ifdef USE_MBROLA_LIB
  35. extern unsigned char *outbuf;
  36. #ifndef PLATFORM_WINDOWS
  37. #include "mbrolib.h"
  38. void * mb_handle;
  39. #else
  40. #include <windows.h>
  41. typedef void (WINAPI *PROCVV)(void);
  42. typedef void (WINAPI *PROCVI)(int);
  43. typedef void (WINAPI *PROCVF)(float);
  44. typedef int (WINAPI *PROCIV)();
  45. typedef int (WINAPI *PROCIC) (char *);
  46. typedef int (WINAPI *PROCISI)(short *,int);
  47. typedef char* (WINAPI *PROCVCI)(char *,int);
  48. PROCIC init_MBR;
  49. PROCIC write_MBR;
  50. PROCIV flush_MBR;
  51. PROCISI read_MBR;
  52. PROCVV close_MBR;
  53. PROCVV reset_MBR;
  54. PROCIV lastError_MBR;
  55. PROCVCI lastErrorStr_MBR;
  56. PROCVI setNoError_MBR;
  57. PROCVI setFreq_MBR;
  58. PROCVF setVolumeRatio_MBR;
  59. HINSTANCE hinstDllMBR = NULL;
  60. BOOL load_MBR()
  61. {
  62. if(hinstDllMBR != NULL)
  63. return TRUE; // already loaded
  64. if (!(hinstDllMBR=LoadLibrary("mbrola.dll")))
  65. return FALSE;
  66. init_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"init_MBR");
  67. write_MBR =(PROCIC) GetProcAddress(hinstDllMBR,"write_MBR");
  68. flush_MBR =(PROCIV) GetProcAddress(hinstDllMBR,"flush_MBR");
  69. read_MBR =(PROCISI) GetProcAddress(hinstDllMBR,"read_MBR");
  70. close_MBR =(PROCVV) GetProcAddress(hinstDllMBR,"close_MBR");
  71. reset_MBR =(PROCVV) GetProcAddress(hinstDllMBR,"reset_MBR");
  72. lastError_MBR =(PROCIV) GetProcAddress(hinstDllMBR,"lastError_MBR");
  73. lastErrorStr_MBR =(PROCVCI) GetProcAddress(hinstDllMBR,"lastErrorStr_MBR");
  74. setNoError_MBR =(PROCVI) GetProcAddress(hinstDllMBR,"setNoError_MBR");
  75. setVolumeRatio_MBR =(PROCVF) GetProcAddress(hinstDllMBR,"setVolumeRatio_MBR");
  76. return TRUE;
  77. }
  78. void unload_MBR()
  79. {
  80. if (hinstDllMBR)
  81. {
  82. FreeLibrary (hinstDllMBR);
  83. hinstDllMBR=NULL;
  84. }
  85. }
  86. #endif // windows
  87. #endif // USE_MBROLA_LIB
  88. MBROLA_TAB *mbrola_tab = NULL;
  89. int mbrola_control = 0;
  90. espeak_ERROR LoadMbrolaTable(const char *mbrola_voice, const char *phtrans, int srate)
  91. {//===================================================================================
  92. // Load a phoneme name translation table from espeak-data/mbrola
  93. int size;
  94. int ix;
  95. int *pw;
  96. FILE *f_in;
  97. char path[sizeof(path_home)+15];
  98. mbrola_name[0] = 0;
  99. if(mbrola_voice == NULL)
  100. {
  101. samplerate = samplerate_native;
  102. SetParameter(espeakVOICETYPE,0,0);
  103. return(EE_OK);
  104. }
  105. sprintf(path,"%s/mbrola/%s",path_home,mbrola_voice);
  106. #ifdef USE_MBROLA_LIB
  107. #ifdef PLATFORM_WINDOWS
  108. if(load_MBR() == FALSE) // load mbrola.dll
  109. return(EE_INTERNAL_ERROR);
  110. if(init_MBR(path) != 0) // initialise the required mbrola voice
  111. return(EE_NOT_FOUND);
  112. setNoError_MBR(1); // don't stop on phoneme errors
  113. #else
  114. mb_handle = mbrolib_init(srate);
  115. mbrolib_parameter m_parameters;
  116. if(mb_handle == NULL)
  117. return(EE_INTERNAL_ERROR);
  118. MBROLIB_ERROR a_status = mbrolib_set_voice(mb_handle, mbrola_voice);
  119. if(a_status != MBROLIB_OK)
  120. return(EE_NOT_FOUND);
  121. #endif // not windows
  122. #endif // USE_MBROLA_LIB
  123. // read eSpeak's mbrola phoneme translation data, eg. en1_phtrans
  124. sprintf(path,"%s/mbrola_ph/%s",path_home,phtrans);
  125. size = GetFileLength(path);
  126. if((f_in = fopen(path,"r")) == NULL)
  127. return(EE_NOT_FOUND);
  128. if((mbrola_tab = (MBROLA_TAB *)realloc(mbrola_tab,size)) == NULL)
  129. {
  130. fclose(f_in);
  131. return(EE_INTERNAL_ERROR);
  132. }
  133. mbrola_control = Read4Bytes(f_in);
  134. pw = (int *)mbrola_tab;
  135. for(ix=4; ix<size; ix+=4)
  136. {
  137. *pw++ = Read4Bytes(f_in);
  138. }
  139. fread(mbrola_tab,size,1,f_in);
  140. fclose(f_in);
  141. #ifdef USE_MBROLA_LIB
  142. #ifdef PLATFORM_WINDOWS
  143. setVolumeRatio_MBR((float)(mbrola_control & 0xff) /16.0);
  144. #else
  145. mbrolib_get_parameter(mb_handle,&m_parameters);
  146. m_parameters.ignore_error = 1;
  147. m_parameters.volume_ratio = (float)(mbrola_control & 0xff) /16.0;
  148. mbrolib_set_parameter(mb_handle,&m_parameters);
  149. #endif // not windows
  150. #endif // USE_MBROLA_LIB
  151. option_quiet = 1;
  152. samplerate = srate;
  153. if(srate == 22050)
  154. SetParameter(espeakVOICETYPE,0,0);
  155. else
  156. SetParameter(espeakVOICETYPE,1,0);
  157. strcpy(mbrola_name,mbrola_voice);
  158. return(EE_OK);
  159. } // end of LoadMbrolaTable
  160. int GetMbrName(PHONEME_LIST *plist, PHONEME_TAB *ph, PHONEME_TAB *ph_prev, PHONEME_TAB *ph_next, int *name2, int *split, int *control)
  161. {//==============================================================================================================
  162. // Look up a phoneme in the mbrola phoneme name translation table
  163. // It may give none, 1, or 2 mbrola phonemes
  164. int mnem = ph->mnemonic;
  165. MBROLA_TAB *pr;
  166. PHONEME_TAB *other_ph;
  167. int found = 0;
  168. // control
  169. // bit 0 skip the next phoneme
  170. // bit 1 match this and Previous phoneme
  171. // bit 2 only at the start of a word
  172. // bit 3 don't match two phonemes across a word boundary
  173. pr = mbrola_tab;
  174. while(pr->name != 0)
  175. {
  176. if(mnem == pr->name)
  177. {
  178. if(pr->next_phoneme == 0)
  179. found = 1;
  180. else
  181. if((pr->next_phoneme == ':') && (plist->synthflags & SFLAG_LENGTHEN))
  182. {
  183. found = 1;
  184. }
  185. else
  186. {
  187. if(pr->control & 2)
  188. other_ph = ph_prev;
  189. else
  190. if((pr->control & 8) && ((plist+1)->newword))
  191. other_ph = phoneme_tab[phPAUSE]; // don't match the next phoneme over a word boundary
  192. else
  193. other_ph = ph_next;
  194. if((pr->next_phoneme == other_ph->mnemonic) ||
  195. ((pr->next_phoneme == 2) && (other_ph->type == phVOWEL)) ||
  196. ((pr->next_phoneme == '_') && (other_ph->type == phPAUSE)))
  197. {
  198. found = 1;
  199. }
  200. }
  201. if((pr->control & 4) && (plist->newword == 0)) // only at start of word
  202. found = 0;
  203. if(found)
  204. {
  205. *name2 = pr->mbr_name2;
  206. *split = pr->percent;
  207. *control = pr->control;
  208. return(pr->mbr_name);
  209. }
  210. }
  211. pr++;
  212. }
  213. *name2=0;
  214. *split=0;
  215. *control=0;
  216. return(mnem);
  217. }
  218. static char *WritePitch(int env, int pitch1, int pitch2, int split, int final)
  219. {//===========================================================================
  220. // final=1: only give the final pitch value.
  221. int x;
  222. int ix;
  223. int pitch_base;
  224. int pitch_range;
  225. int p1,p2,p_end;
  226. unsigned char *pitch_env;
  227. int max = -1;
  228. int min = 999;
  229. int y_max=0;
  230. int y_min=0;
  231. int env100 = 80; // apply the pitch change only over this proportion of the mbrola phoneme(s)
  232. int y2;
  233. int y[4];
  234. int env_split;
  235. char buf[50];
  236. static char output[50];
  237. output[0] = 0;
  238. pitch_env = envelope_data[env];
  239. SetPitch2(voice, pitch1, pitch2, &pitch_base, &pitch_range);
  240. env_split = (split * 128)/100;
  241. if(env_split < 0)
  242. env_split = 0-env_split;
  243. // find max and min in the pitch envelope
  244. for(x=0; x<128; x++)
  245. {
  246. if(pitch_env[x] > max)
  247. {
  248. max = pitch_env[x];
  249. y_max = x;
  250. }
  251. if(pitch_env[x] < min)
  252. {
  253. min = pitch_env[x];
  254. y_min = x;
  255. }
  256. }
  257. // set an additional pitch point half way through the phoneme.
  258. // but look for a maximum or a minimum and use that instead
  259. y[2] = 64;
  260. if((y_max > 0) && (y_max < 127))
  261. {
  262. y[2] = y_max;
  263. }
  264. if((y_min > 0) && (y_min < 127))
  265. {
  266. y[2] = y_min;
  267. }
  268. y[1] = y[2] / 2;
  269. y[3] = y[2] + (127 - y[2])/2;
  270. // set initial pitch
  271. p1 = ((pitch_env[0]*pitch_range)>>8) + pitch_base; // Hz << 12
  272. p_end = ((pitch_env[127]*pitch_range)>>8) + pitch_base;
  273. if(split >= 0)
  274. {
  275. sprintf(buf," 0 %d",p1/4096);
  276. strcat(output,buf);
  277. }
  278. // don't use intermediate pitch points for linear rise and fall
  279. if(env > 1)
  280. {
  281. for(ix=1; ix<4; ix++)
  282. {
  283. p2 = ((pitch_env[y[ix]]*pitch_range)>>8) + pitch_base;
  284. if(split > 0)
  285. {
  286. y2 = (y[ix] * env100)/env_split;
  287. }
  288. else
  289. if(split < 0)
  290. {
  291. y2 = ((y[ix]-env_split) * env100)/env_split;
  292. }
  293. else
  294. {
  295. y2 = (y[ix] * env100)/128;
  296. }
  297. if((y2 > 0) && (y2 <= env100))
  298. {
  299. sprintf(buf," %d %d",y2,p2/4096);
  300. strcat(output,buf);
  301. }
  302. }
  303. }
  304. p_end = p_end/4096;
  305. if(split <= 0)
  306. {
  307. sprintf(buf," %d %d",env100,p_end);
  308. strcat(output,buf);
  309. }
  310. if(env100 < 100)
  311. {
  312. sprintf(buf," %d %d",100,p_end);
  313. strcat(output,buf);
  314. }
  315. strcat(output,"\n");
  316. if(final)
  317. sprintf(output,"\t100 %d\n",p_end);
  318. return(output);
  319. } // end of WritePitch
  320. #ifdef USE_MBROLA_LIB
  321. static void MbrolaMarker(int type, int char_posn, int length, int value)
  322. {//=====================================================================
  323. MarkerEvent(type,(char_posn & 0xffffff) | (length << 24),value,outbuf);
  324. }
  325. static void MbrolaEmbedded(int &embix, int sourceix)
  326. {//=================================================
  327. // There were embedded commands in the text at this point
  328. unsigned int word; // bit 7=last command for this word, bits 5,6 sign, bits 0-4 command
  329. unsigned int value;
  330. int command;
  331. int sign=0;
  332. do {
  333. word = embedded_list[embix++];
  334. value = word >> 8;
  335. command = word & 0x1f;
  336. if((word & 0x60) == 0x60)
  337. sign = -1;
  338. else
  339. if((word & 0x60) == 0x40)
  340. sign = 1;
  341. if(command < N_EMBEDDED_VALUES)
  342. {
  343. if(sign == 0)
  344. embedded_value[command] = value;
  345. else
  346. embedded_value[command] += (value * sign);
  347. }
  348. switch(command & 0x1f)
  349. {
  350. case EMBED_M: // named marker
  351. MbrolaMarker(espeakEVENT_MARK, (sourceix & 0x7ff) + clause_start_char, 0, value);
  352. break;
  353. }
  354. } while ((word & 0x80) == 0);
  355. }
  356. #ifdef PLATFORM_WINDOWS
  357. int MbrolaSynth(char *p_mbrola)
  358. {//============================
  359. // p_mbrola is a string of mbrola pho lines - Windows
  360. int len;
  361. int finished;
  362. int result=0;
  363. if(synth_callback == NULL)
  364. return(1);
  365. if(p_mbrola == NULL)
  366. flush_MBR();
  367. else
  368. result = write_MBR(p_mbrola);
  369. finished = 0;
  370. while(!finished && ((len = read_MBR((short *)outbuf, outbuf_size/2)) > 0))
  371. {
  372. out_ptr = outbuf + len*2;
  373. if(event_list)
  374. {
  375. event_list[event_list_ix].type = espeakEVENT_LIST_TERMINATED; // indicates end of event list
  376. event_list[event_list_ix].user_data = 0;
  377. }
  378. count_samples += len;
  379. finished = synth_callback((short *)outbuf, len, event_list);
  380. event_list_ix=0;
  381. }
  382. if(finished)
  383. {
  384. // cancelled by user, discard any unused mbrola speech
  385. flush_MBR();
  386. while((len = read_MBR((short *)outbuf, outbuf_size/2)) > 0);
  387. }
  388. return(finished);
  389. } // end of SynthMbrola
  390. #else
  391. int MbrolaSynth(char *p_mbrola)
  392. {//============================
  393. // p_mbrola is a string of mbrola pho lines - Linux
  394. // This is wrong
  395. // It must be called from WavegenFill()
  396. int len;
  397. int finished;
  398. int result=0;
  399. if(synth_callback == NULL)
  400. return(1);
  401. if(p_mbrola == NULL)
  402. mbrolib_flush(mb_handle);
  403. else
  404. result = mbrolib_write(mb_handle,p_mbrola,strlen(p_mbrola));
  405. finished = 0;
  406. while(!finished && (mbrolib_read(mb_handle, (short *)out_ptr, (out_end - out_ptr)/2, &len) == MBROLIB_OK))
  407. {
  408. if(len == 0)
  409. break;
  410. out_ptr += (len*2);
  411. if(event_list)
  412. {
  413. event_list[event_list_ix].type = espeakEVENT_LIST_TERMINATED; // indicates end of event list
  414. event_list[event_list_ix].user_data = 0;
  415. }
  416. count_samples += len;
  417. finished = synth_callback((short *)outbuf, len, event_list);
  418. event_list_ix=0;
  419. }
  420. if(finished)
  421. {
  422. // cancelled by user, discard any unused mbrola speech
  423. mbrolib_flush(mb_handle);
  424. while(mbrolib_read(mb_handle, (short *)outbuf, outbuf_size/2, &len) == MBROLIB_OK)
  425. {
  426. if(len == 0)
  427. break;
  428. }
  429. }
  430. return(finished);
  431. } // end of SynthMbrola
  432. #endif // not windows
  433. #endif // USE_MBROLA_LIB
  434. void MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, FILE *f_mbrola)
  435. {//======================================================================
  436. // Generate a mbrola pho file
  437. unsigned int name;
  438. int phix;
  439. int len;
  440. int len1;
  441. PHONEME_TAB *ph;
  442. PHONEME_TAB *ph_next;
  443. PHONEME_TAB *ph_prev;
  444. PHONEME_LIST *p;
  445. PHONEME_LIST *next;
  446. PHONEME_LIST *prev;
  447. int pause = 0;
  448. int released;
  449. int name2;
  450. int control;
  451. int done;
  452. int len_percent;
  453. const char *final_pitch;
  454. char buf[80];
  455. char mbr_buf[120];
  456. #ifdef USE_MBROLA_LIB
  457. int embedded_ix=0;
  458. int word_count=0;
  459. event_list_ix = 0;
  460. out_ptr = outbuf;
  461. #ifdef PLATFORM_WINDOWS
  462. setNoError_MBR(1); // don't stop on phoneme errors
  463. #endif
  464. #else
  465. // fprintf(f_mbrola,";; v=%.2f\n",(float)(mbrola_control & 0xff)/16.0); // ;; v= has no effect on mbrola
  466. #endif
  467. for(phix=1; phix < n_phonemes; phix++)
  468. {
  469. mbr_buf[0] = 0;
  470. p = &plist[phix];
  471. next = &plist[phix+1];
  472. prev = &plist[phix-1];
  473. ph = p->ph;
  474. ph_prev = plist[phix-1].ph;
  475. ph_next = plist[phix+1].ph;
  476. #ifdef USE_MBROLA_LIB
  477. if(p->synthflags & SFLAG_EMBEDDED)
  478. {
  479. MbrolaEmbedded(embedded_ix, p->sourceix);
  480. }
  481. if(p->newword & 4)
  482. MbrolaMarker(espeakEVENT_SENTENCE, (p->sourceix & 0x7ff) + clause_start_char, 0, count_sentences);
  483. if(p->newword & 1)
  484. MbrolaMarker(espeakEVENT_WORD, (p->sourceix & 0x7ff) + clause_start_char, p->sourceix >> 11, clause_start_word + word_count++);
  485. #endif
  486. name = GetMbrName(p,ph,ph_prev,ph_next,&name2,&len_percent,&control);
  487. if(control & 1)
  488. phix++;
  489. if(name == 0)
  490. continue; // ignore this phoneme
  491. if((ph->type == phPAUSE) && (name == ph->mnemonic))
  492. {
  493. // a pause phoneme, which has not been changed by the translation
  494. name = '_';
  495. len = (p->length * speed_factor1)/256;
  496. // if(len == 0) continue;
  497. if(len == 0)
  498. len = 1;
  499. }
  500. else
  501. len = (80 * speed_factor2)/256;
  502. sprintf(buf,"%s\t",WordToString(name));
  503. strcat(mbr_buf,buf);
  504. if(name2 == '_')
  505. {
  506. // add a pause after this phoneme
  507. pause = PauseLength(len_percent,0);
  508. name2 = 0;
  509. }
  510. done = 0;
  511. final_pitch = "";
  512. switch(ph->type)
  513. {
  514. case phVOWEL:
  515. len = ph->std_length;
  516. if(p->synthflags & SFLAG_LENGTHEN)
  517. len += phoneme_tab[phonLENGTHEN]->std_length; // phoneme was followed by an extra : symbol
  518. if(ph_next->type == phPAUSE)
  519. len += 50; // lengthen vowels before a pause
  520. len = (len * p->length)/256;
  521. if(name2 == 0)
  522. {
  523. sprintf(buf,"%d\t%s", len, WritePitch(p->env,p->pitch1,p->pitch2,0,0));
  524. strcat(mbr_buf,buf);
  525. }
  526. else
  527. {
  528. len1 = (len * len_percent)/100;
  529. sprintf(buf,"%d\t%s", len1, WritePitch(p->env,p->pitch1,p->pitch2,len_percent,0));
  530. strcat(mbr_buf,buf);
  531. sprintf(buf,"%s\t%d\t%s", WordToString(name2), len-len1, WritePitch(p->env,p->pitch1,p->pitch2,-len_percent,0));
  532. strcat(mbr_buf,buf);
  533. }
  534. done = 1;
  535. break;
  536. case phSTOP:
  537. released = 0;
  538. if(next->type==phVOWEL) released = 1;
  539. if(next->type==phLIQUID && !next->newword) released = 1;
  540. if(released)
  541. len = DoSample(p->ph,next->ph,2,0,-1);
  542. else
  543. len = DoSample(p->ph,phoneme_tab[phonPAUSE],2,0,-1);
  544. len = (len * 1000)/samplerate; // convert to mS
  545. len += PauseLength(p->prepause,1);
  546. break;
  547. case phVSTOP:
  548. len = (80 * speed_factor2)/256;
  549. break;
  550. case phFRICATIVE:
  551. len = 0;
  552. if(p->synthflags & SFLAG_LENGTHEN)
  553. len = DoSample(ph,ph_next,2,p->length,-1); // play it twice for [s:] etc.
  554. len += DoSample(ph,ph_next,2,p->length,-1);
  555. len = (len * 1000)/samplerate; // convert to mS
  556. break;
  557. case phNASAL:
  558. if(next->type != phVOWEL)
  559. {
  560. len = DoSpect(p->ph,prev->ph,phoneme_tab[phonPAUSE],2,p,-1);
  561. len = (len * 1000)/samplerate;
  562. if(next->type == phPAUSE)
  563. len += 50;
  564. final_pitch = WritePitch(p->env,p->pitch1,p->pitch2,0,1);
  565. }
  566. break;
  567. case phLIQUID:
  568. if(next->type == phPAUSE)
  569. {
  570. len += 50;
  571. final_pitch = WritePitch(p->env,p->pitch1,p->pitch2,0,1);
  572. }
  573. break;
  574. }
  575. if(!done)
  576. {
  577. if(name2 != 0)
  578. {
  579. len1 = (len * len_percent)/100;
  580. sprintf(buf,"%d\n%s\t",len1,WordToString(name2));
  581. strcat(mbr_buf,buf);
  582. len -= len1;
  583. }
  584. sprintf(buf,"%d%s\n",len,final_pitch);
  585. strcat(mbr_buf,buf);
  586. }
  587. if(pause)
  588. {
  589. sprintf(buf,"_ \t%d\n",PauseLength(pause,0));
  590. strcat(mbr_buf,buf);
  591. pause = 0;
  592. }
  593. if(f_mbrola)
  594. {
  595. fwrite(mbr_buf,1,strlen(mbr_buf),f_mbrola); // write .pho to a file
  596. }
  597. else
  598. {
  599. #ifdef USE_MBROLA_LIB
  600. if(MbrolaSynth(mbr_buf) != 0)
  601. return;
  602. #endif
  603. }
  604. }
  605. #ifdef USE_MBROLA_LIB
  606. MbrolaSynth(NULL);
  607. #endif
  608. } // end of MbrolaTranslate
  609. #ifdef TEST_MBROLA
  610. PHONEME_LIST mbrola_phlist;
  611. int mbrola_n_ph;
  612. int mbrola_phix;
  613. int MbrolaFill(int fill_zeros)
  614. {//===========================
  615. }
  616. int MbrolaGenerate(PHONEME_LIST *phoneme_list, int *n_ph, int resume)
  617. {//==================================================================
  618. if(resume == 0)
  619. {
  620. mbrola_phlist = phoneme_list;
  621. mbrola_n_ph = n_ph;
  622. mbrola_phix = 0;
  623. }
  624. resume(0); // finished phoneme list
  625. }
  626. #endif