wavplayer.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Date Author Notes
  7. * 2019-07-15 Zero-Free first implementation
  8. */
  9. #ifndef __WAVPLAYER_H__
  10. #define __WAVPLAYER_H__
  11. /**
  12. * wav player status
  13. */
  14. enum PLAYER_STATE
  15. {
  16. PLAYER_STATE_STOPED = 0,
  17. PLAYER_STATE_PLAYING = 1,
  18. PLAYER_STATE_PAUSED = 2,
  19. };
  20. /**
  21. * @brief Play wav music
  22. *
  23. * @param uri the pointer for file path
  24. *
  25. * @return
  26. * - 0 Success
  27. * - others Failed
  28. */
  29. int wavplayer_play(char *uri);
  30. /**
  31. * @brief Stop music
  32. *
  33. * @return
  34. * - 0 Success
  35. * - others Failed
  36. */
  37. int wavplayer_stop(void);
  38. /**
  39. * @brief Pause music
  40. *
  41. * @return
  42. * - 0 Success
  43. * - others Failed
  44. */
  45. int wavplayer_pause(void);
  46. /**
  47. * @brief Resume music
  48. *
  49. * @return
  50. * - 0 Success
  51. * - others Failed
  52. */
  53. int wavplayer_resume(void);
  54. /**
  55. * @brief Set volume
  56. *
  57. * @param volume volume value(0 ~ 99)
  58. *
  59. * @return
  60. * - 0 Success
  61. * - others Failed
  62. */
  63. int wavplayer_volume_set(int volume);
  64. /**
  65. * @brief Get volume
  66. *
  67. * @return volume value(0 ~ 99)
  68. */
  69. int wavplayer_volume_get(void);
  70. /**
  71. * @brief Get wav player state
  72. *
  73. * @return
  74. * - PLAYER_STATE_STOPED stoped status
  75. * - PLAYER_STATE_PLAYING playing status
  76. * - PLAYER_STATE_PAUSED paused
  77. */
  78. int wavplayer_state_get(void);
  79. /**
  80. * @brief Get the uri that is currently playing
  81. *
  82. * @return uri that is currently playing
  83. */
  84. char *wavplayer_uri_get(void);
  85. #endif