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.

api.c 2.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 2017 Reece H. Dunn
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write see:
  16. * <http://www.gnu.org/licenses/>.
  17. */
  18. #include "config.h"
  19. #include <assert.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <espeak-ng/espeak_ng.h>
  23. #include <espeak-ng/speak_lib.h>
  24. #include <espeak-ng/encoding.h>
  25. #include "speech.h"
  26. #include "phoneme.h"
  27. #include "synthesize.h"
  28. #include "translate.h"
  29. void
  30. test_espeak_terminate_without_initialize()
  31. {
  32. printf("testing espeak_Terminate without espeak_Initialize\n");
  33. assert(event_list == NULL);
  34. assert(espeak_Terminate() == EE_OK);
  35. assert(event_list == NULL);
  36. }
  37. void
  38. test_espeak_initialize()
  39. {
  40. printf("testing espeak_Initialize\n");
  41. assert(event_list == NULL);
  42. assert(espeak_Initialize(AUDIO_OUTPUT_PLAYBACK, 0, NULL, 0) == 22050);
  43. assert(event_list != NULL);
  44. assert(espeak_Terminate() == EE_OK);
  45. assert(event_list == NULL);
  46. }
  47. void
  48. test_espeak_synth()
  49. {
  50. printf("testing espeak_Synth\n");
  51. assert(event_list == NULL);
  52. assert(espeak_Initialize(AUDIO_OUTPUT_RETRIEVAL, 0, NULL, 0) == 22050);
  53. assert(event_list != NULL);
  54. const char *test = "One two three.";
  55. assert(espeak_Synth(test, strlen(test)+1, 0, POS_CHARACTER, 0, espeakCHARS_AUTO, NULL, NULL) == EE_OK);
  56. assert(espeak_Synchronize() == EE_OK);
  57. assert(espeak_Terminate() == EE_OK);
  58. assert(event_list == NULL);
  59. }
  60. int
  61. main(int argc, char **argv)
  62. {
  63. test_espeak_terminate_without_initialize();
  64. test_espeak_initialize();
  65. test_espeak_synth();
  66. return EXIT_SUCCESS;
  67. }