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.

mbrowrap.h 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. * mbrowrap -- A wrapper library around the mbrola binary
  3. * providing a subset of the API from the Windows mbrola DLL.
  4. *
  5. * Copyright (C) 2010 by Nicolas Pitre <[email protected]>
  6. * Copyright (C) 2016 Reece H. Dunn
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. #ifndef MBROWRAP_H
  19. #define MBROWRAP_H
  20. #ifdef __cplusplus
  21. extern "C"
  22. {
  23. #endif
  24. #if !defined(_WIN32) && !defined(_WIN64)
  25. #define WINAPI
  26. typedef int BOOL;
  27. #endif
  28. /*
  29. * Initialize mbrola. The 'voice_path' argument must contain the
  30. * path and file name to the mbrola voice database to be used. Returned
  31. * value is 0 on success, or an error code otherwise (currently only -1
  32. * is returned. If not successful, lastErrorStr_MBR() will provide the
  33. * error reason. If this is successful, then close_MBR() must be called
  34. * before init_MBR() can be called again.
  35. */
  36. int (WINAPI *init_MBR)(char *voice_path);
  37. /*
  38. * Stop mbrola and release any resources. It is necessary to call
  39. * this after a successful call to init_MBR() before init_MBR() can be
  40. * called again.
  41. */
  42. void (WINAPI *close_MBR)(void);
  43. /*
  44. * Stop any ongoing processing and flush all buffers. After this call
  45. * any synthesis request will start afresh.
  46. */
  47. void (WINAPI *reset_MBR)(void);
  48. /*
  49. * Return at most 'nb_samples' audio samples into 'buffer'. The returned
  50. * value is the actual number of samples returned, or -1 on error.
  51. * If not successful, lastErrorStr_MBR() will provide the error reason.
  52. * Samples are always 16-bit little endian.
  53. */
  54. int (WINAPI *read_MBR)(short *buffer, int nb_samples);
  55. /*
  56. * Write a NULL terminated string of phoneme in the input buffer.
  57. * Return the number of chars actually written, or -1 on error.
  58. * If not successful, lastErrorStr_MBR() will provide the error reason.
  59. */
  60. int (WINAPI *write_MBR)(char *data);
  61. /*
  62. * Send a flush command to the mbrola input stream.
  63. * This is currently similar to write_MBR("#\n"). Return 1 on success
  64. * or 0 on failure. If not successful, lastErrorStr_MBR() will provide
  65. * the error reason.
  66. */
  67. int (WINAPI *flush_MBR)(void);
  68. /*
  69. * Return the audio sample frequency of the used voice database.
  70. */
  71. int (WINAPI *getFreq_MBR)(void);
  72. /*
  73. * Overall volume.
  74. */
  75. void (WINAPI *setVolumeRatio_MBR)(float value);
  76. /*
  77. * Copy into 'buffer' at most 'bufsize' bytes from the latest error
  78. * message. This may also contain non-fatal errors from mbrola. When
  79. * no error message is pending then an empty string is returned.
  80. * Consecutive calls to lastErrorStr_MBR() will return the same message.
  81. */
  82. char * (WINAPI *lastErrorStr_MBR)(char *buffer, int bufsize);
  83. /*
  84. * Tolerance to missing diphones.
  85. */
  86. void (WINAPI *setNoError_MBR)(int no_error);
  87. BOOL load_MBR(void);
  88. void unload_MBR(void);
  89. #ifdef __cplusplus
  90. }
  91. #endif
  92. #endif