audio_device.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2018 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file audio device interface
  8. */
  9. #ifndef __AUDIO_DEVICE_H__
  10. #define __AUDIO_DEVICE_H__
  11. #include <audio_system.h>
  12. /**
  13. * @cond INTERNAL_HIDDEN
  14. */
  15. typedef enum
  16. {
  17. AUDIO_TYPE_IN,
  18. AUDIO_TYPE_OUT,
  19. } audio_type_e;
  20. typedef enum
  21. {
  22. AUDIO_DMA_MODE = 1,
  23. AUDIO_DSP_MODE = 2,
  24. AUDIO_ASRC_MODE = 4,
  25. AUDIO_DMA_RELOAD_MODE = 8,
  26. } audio_channel_mode_e;
  27. struct audio_device_t *audio_device_create(uint8_t stream_type, int sample_rate,
  28. uint8_t format, uint8_t audio_mode);
  29. int audio_device_attach_track(struct audio_device_t *device, struct audio_track_t *track);
  30. int audio_device_dettach_track(struct audio_device_t *device, struct audio_track_t *track);
  31. int audio_device_mix_data(struct audio_device_t *device);
  32. int audio_device_mix_data(struct audio_device_t *device);
  33. int audio_device_mix_data(struct audio_device_t *device);
  34. int audio_device_set_volume(struct audio_device_t *handle, int volume);
  35. int audio_device_start(struct audio_device_t *handle);
  36. int audio_device_pause(struct audio_device_t *handle);
  37. int audio_device_resume(struct audio_device_t *handle);
  38. int audio_device_stop(struct audio_device_t *handle);
  39. /**
  40. * INTERNAL_HIDDEN @endcond
  41. */
  42. #endif