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.

wave.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (C) 2007, Gilles Casse <[email protected]>
  3. * Copyright (C) 2015 Reece H. Dunn
  4. * based on AudioIO.cc (Audacity-1.2.4b) and wavegen.cpp
  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: <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef WAVE_H
  20. #define WAVE_H
  21. #ifndef PLATFORM_DOS
  22. #include "stdint.h"
  23. #endif
  24. #ifdef __cplusplus
  25. extern "C"
  26. {
  27. #endif
  28. extern int option_device_number;
  29. extern int wave_init(int samplerate);
  30. extern void *wave_open(const char *the_api);
  31. extern size_t wave_write(void *theHandler, char *theMono16BitsWaveBuffer, size_t theSize);
  32. extern int wave_close(void *theHandler);
  33. extern void wave_flush(void *theHandler);
  34. extern int wave_is_busy(void *theHandler);
  35. extern void wave_terminate();
  36. extern uint32_t wave_get_read_position(void *theHandler);
  37. extern uint32_t wave_get_write_position(void *theHandler);
  38. // Supply the remaining time in ms before the sample is played
  39. // (or 0 if the event has been already played).
  40. // sample: sample identifier
  41. // time: supplied value in ms
  42. //
  43. // return 0 if ok or -1 otherwise (stream not opened).
  44. extern int wave_get_remaining_time(uint32_t sample, uint32_t *time);
  45. // set the callback which informs if the output is still enabled.
  46. // Helpful if a new sample is waiting for free space whereas sound must be stopped.
  47. typedef int (t_wave_callback)(void);
  48. extern void wave_set_callback_is_output_enabled(t_wave_callback *cb);
  49. // general functions
  50. extern void clock_gettime2(struct timespec *ts);
  51. extern void add_time_in_ms(struct timespec *ts, int time_in_ms);
  52. // for tests
  53. extern void *wave_test_get_write_buffer();
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif