alsa_device.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. Copyright (C) 2004-2006 Jean-Marc Valin
  3. Copyright (C) 2006 Commonwealth Scientific and Industrial Research
  4. Organisation (CSIRO) Australia
  5. Redistribution and use in source and binary forms, with or without
  6. modification, are permitted provided that the following conditions are
  7. met:
  8. 1. Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. 2. Redistributions in binary form must reproduce the above copyright
  11. notice, this list of conditions and the following disclaimer in the
  12. documentation and/or other materials provided with the distribution.
  13. 3. The name of the author may not be used to endorse or promote products
  14. derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  17. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  19. INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  24. ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  25. POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. #ifndef ALSA_DEVICE_H
  28. #define ALSA_DEVICE_H
  29. #include <sys/poll.h>
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. struct AlsaDevice_;
  34. typedef struct AlsaDevice_ AlsaDevice;
  35. AlsaDevice *alsa_device_open(char *device_name, unsigned int rate, int channels, int period);
  36. void alsa_device_close(AlsaDevice *dev);
  37. int alsa_device_read(AlsaDevice *dev, short *pcm, int len);
  38. int alsa_device_write(AlsaDevice *dev, const short *pcm, int len);
  39. int alsa_device_capture_ready(AlsaDevice *dev, struct pollfd *pfds, unsigned int nfds);
  40. int alsa_device_playback_ready(AlsaDevice *dev, struct pollfd *pfds, unsigned int nfds);
  41. void alsa_device_start(AlsaDevice *dev);
  42. int alsa_device_nfds(AlsaDevice *dev);
  43. void alsa_device_getfds(AlsaDevice *dev, struct pollfd *pfds, unsigned int nfds);
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif