lightduer_voice.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /**
  2. * Copyright (2017) Baidu Inc. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * File: lightduer_voice.h
  18. * Auth: Su Hao (suhao@baidu.com)
  19. * Desc: Light duer voice APIS.
  20. */
  21. #include "baidu_json.h"
  22. #ifndef BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_VOICE_H
  23. #define BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_VOICE_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. typedef enum _duer_voice_mode_enum {
  28. DUER_VOICE_MODE_DEFAULT,
  29. DUER_VOICE_MODE_CHINESE_TO_ENGLISH,
  30. DUER_VOICE_MODE_ENGLISH_TO_CHINESE,
  31. DUER_VOICE_MODE_WCHAT,
  32. DUER_VOICE_MODE_C2E_BOT,
  33. DUER_VOICE_MODE_INTERACTIVE_CLASS,
  34. }
  35. duer_voice_mode;
  36. typedef void (*duer_voice_delay_func)(duer_u32_t);
  37. typedef const char* (*duer_get_dialog_id_func)(void);
  38. void duer_voice_set_delay_threshold(duer_u32_t delay, duer_voice_delay_func);
  39. void duer_voice_set_mode(duer_voice_mode mode);
  40. duer_voice_mode duer_voice_get_mode(void);
  41. int duer_voice_start(int samplerate);
  42. int duer_voice_send(const void *data, size_t size);
  43. int duer_voice_cache(duer_bool cached);
  44. int duer_voice_stop(void);
  45. int duer_voice_terminate(void);
  46. void duer_add_translate_flag(baidu_json *data);
  47. void duer_reg_dialog_id_cb(duer_get_dialog_id_func cb);
  48. /*
  49. * topic_id + 1
  50. *
  51. * * Return: Other topic_id value
  52. * 0 Failed
  53. */
  54. size_t duer_increase_topic_id(void);
  55. int duer_voice_set_speex_quality(int quality);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif/*BAIDU_DUER_LIGHTDUER_INCLUDE_LIGHTDUER_VOICE_H*/