tone_player_api.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _TONE_PLAYER_API_H
  2. #define _TONE_PLAYER_API_H
  3. #include "audio_config.h"
  4. // #include "sine_make.h"
  5. #define TONE_STOP 0
  6. #define TONE_START 1
  7. #define CONFIG_USE_DEFAULT_SINE 1
  8. #define DEVICE_EVENT_FROM_TONE (('T' << 24) | ('N' << 16) | ('E' << 8) | '\0')
  9. #define TONE_DEFAULT_VOL SYS_MAX_VOL
  10. #define TONE_REPEAT_BEGIN(a) (char *)((0x1 << 30) | (a & 0xffff))
  11. #define TONE_REPEAT_END() (char *)(0x2 << 30)
  12. #define IS_REPEAT_BEGIN(a) ((((u32)a >> 30) & 0x3) == 0x1 ? 1 : 0)
  13. #define IS_REPEAT_END(a) ((((u32)a >> 30) & 0x3) == 0x2 ? 1 : 0)
  14. #define TONE_REPEAT_COUNT(a) (((u32)a) & 0xffff)
  15. #define DEFAULT_SINE_TONE(a) (char *)(((u32)0x3 << 30) | (a))
  16. #define IS_DEFAULT_SINE(a) ((((u32)a >> 30) & 0x3) == 0x3 ? 1 : 0)
  17. #define DEFAULT_SINE_ID(a) ((u32)a & 0xffff)
  18. typedef const struct sin_param *(*get_sine_param_t)(u8 id, u8 *num);
  19. void tone_play_set_sine_param_handler(get_sine_param_t handler);
  20. int tone_play(const char *name, u8 preemption) ;
  21. int tone_play_no_tws(const char *name, u8 preemption);
  22. int tone_play_with_callback(const char *name, u8 preemption, void (*user_evt_handler)(void *priv), void *priv);
  23. int tone_file_list_play(const char **list, u8 preemption);
  24. int tone_play_stop(void);
  25. int tone_sin_play(int time_ms, u8 wait);
  26. int tone_get_status();
  27. int tone_file_list_stop(u8 no_end);
  28. /*
  29. *@brief:提示音比较,确认目标提示音和正在播放的提示音是否一致
  30. *@return: 0 匹配
  31. * 非0 不匹配或者当前没有提示音播放
  32. *@note:通过提示音名字比较
  33. */
  34. int tone_name_compare(const char *name);
  35. enum {
  36. TONE_PLAY_END_CB_CMD_NONE = -1,
  37. TONE_FLAG_KEY_START,
  38. TONE_FLAG_KEY_START_UP_CLK,
  39. };
  40. #endif