eSpeak NG is an open source speech synthesizer that supports more than hundred languages and accents.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

espeakedit.cpp 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /***************************************************************************
  2. * Copyright (C) 2005 to 2015 by Jonathan Duddington *
  3. * email: [email protected] *
  4. * Copyright (C) 2013-2015 by Reece H. Dunn *
  5. * *
  6. * This program is free software; you can redistribute it and/or modify *
  7. * it under the terms of the GNU General Public License as published by *
  8. * the Free Software Foundation; either version 3 of the License, or *
  9. * (at your option) any later version. *
  10. * *
  11. * This program is distributed in the hope that it will be useful, *
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  14. * GNU General Public License for more details. *
  15. * *
  16. * You should have received a copy of the GNU General Public License *
  17. * along with this program; if not, see: *
  18. * <http://www.gnu.org/licenses/>. *
  19. ***************************************************************************/
  20. #include "wx/wx.h"
  21. #include <locale.h>
  22. #include "speak_lib.h"
  23. #include "espeak_ng.h"
  24. #include "speech.h"
  25. #include "phoneme.h"
  26. #include "synthesize.h"
  27. #include "voice.h"
  28. #include "spect.h"
  29. #include "translate.h"
  30. static const char *about_string2 = "espeakedit: %s\nAuthor: Jonathan Duddington (c) 2009\n\n"
  31. "Licensed under GNU General Public License version 3\n"
  32. "http://espeak.sourceforge.net/";
  33. static const char *about_string = "<font size=0><b>espeakedit </b> %s<br>Author: Jonathan Duddington (c) 2009<br>"
  34. "<a href=\"http://espeak.sourceforge.net/\">http://espeak.sourceforge.net</a><br>"
  35. "Licensed under <a href=\"http://espeak.sourceforge.net/license.html\">GNU General Public License version 3</a></font>";
  36. extern void CompilePhonemeData(void);
  37. extern void CompileSampleRate(void);
  38. extern espeak_ng_STATUS CompileIntonation(FILE *log);
  39. int progress_max;
  40. int gui_flag = 0;
  41. char path_source[sizeof(path_home)+20];
  42. char voice_name2[40];
  43. class MyApp: public wxApp
  44. {
  45. public:
  46. bool OnInit(void);
  47. int OnExit(void);
  48. };
  49. IMPLEMENT_APP(MyApp)
  50. wxString AppName = _T("espeakedit");
  51. int MyApp::OnExit()
  52. {//================
  53. return(0);
  54. }
  55. static const char *help_text =
  56. "\n\nespeakedit\n"
  57. "\tRun with GUI\n"
  58. "espeakedit --compile\n"
  59. "\tCompile phoneme data in espeak-data/phsource\n"
  60. "\tand dictionary data in espeak-data/dictsource\n";
  61. // Initialise this in OnInit, not statically
  62. bool MyApp::OnInit(void)
  63. {//=====================
  64. int j;
  65. char param[120];
  66. if(argc > 1)
  67. {
  68. #if wxUSE_UNICODE == 1
  69. wcstombs(param, argv[1], sizeof(param));
  70. #else
  71. const char *p = argv[1];
  72. while((param[j] = p[j]) != 0) j++;
  73. #endif
  74. }
  75. else
  76. {
  77. param[0] = '-';
  78. param[1] = 'h';
  79. param[2] = 0;
  80. }
  81. if((strcmp(param,"--help")==0) || (strcmp(param,"-h")==0))
  82. {
  83. printf(about_string2,espeak_Info(NULL));
  84. printf("%s", help_text);
  85. exit(0);
  86. }
  87. char *env;
  88. if((env = getenv("ESPEAK_DATA_PATH")) == NULL)
  89. env = getenv("HOME");
  90. snprintf(path_home,sizeof(path_home),"%s/espeak-data",env);
  91. snprintf(path_source,sizeof(path_source),"%s/../phsource/",path_home);
  92. if(strcmp(param,"--compile")==0)
  93. {
  94. samplerate_native = samplerate = 22050;
  95. LoadPhData(NULL);
  96. if(LoadVoice("", 0) == NULL)
  97. {
  98. fprintf(stderr, "Failed to load default voice\n");
  99. exit(1);
  100. }
  101. CompilePhonemeData();
  102. CompileIntonation(stderr);
  103. }
  104. exit(0);
  105. }