pa_linux_alsa.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #ifndef PA_LINUX_ALSA_H
  2. #define PA_LINUX_ALSA_H
  3. /*
  4. * $Id: pa_linux_alsa.h 1597 2011-02-11 00:15:51Z dmitrykos $
  5. * PortAudio Portable Real-Time Audio Library
  6. * ALSA-specific extensions
  7. *
  8. * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
  9. *
  10. * Permission is hereby granted, free of charge, to any person obtaining
  11. * a copy of this software and associated documentation files
  12. * (the "Software"), to deal in the Software without restriction,
  13. * including without limitation the rights to use, copy, modify, merge,
  14. * publish, distribute, sublicense, and/or sell copies of the Software,
  15. * and to permit persons to whom the Software is furnished to do so,
  16. * subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be
  19. * included in all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  24. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
  25. * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
  26. * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  27. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. */
  29. /*
  30. * The text above constitutes the entire PortAudio license; however,
  31. * the PortAudio community also makes the following non-binding requests:
  32. *
  33. * Any person wishing to distribute modifications to the Software is
  34. * requested to send the modifications to the original developer so that
  35. * they can be incorporated into the canonical version. It is also
  36. * requested that these non-binding requests be included along with the
  37. * license above.
  38. */
  39. /** @file
  40. * @ingroup public_header
  41. * @brief ALSA-specific PortAudio API extension header file.
  42. */
  43. #include "portaudio.h"
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47. typedef struct PaAlsaStreamInfo
  48. {
  49. unsigned long size;
  50. PaHostApiTypeId hostApiType;
  51. unsigned long version;
  52. const char *deviceString;
  53. }
  54. PaAlsaStreamInfo;
  55. /** Initialize host API specific structure, call this before setting relevant attributes. */
  56. void PaAlsa_InitializeStreamInfo( PaAlsaStreamInfo *info );
  57. /** Instruct whether to enable real-time priority when starting the audio thread.
  58. *
  59. * If this is turned on by the stream is started, the audio callback thread will be created
  60. * with the FIFO scheduling policy, which is suitable for realtime operation.
  61. **/
  62. void PaAlsa_EnableRealtimeScheduling( PaStream *s, int enable );
  63. #if 0
  64. void PaAlsa_EnableWatchdog( PaStream *s, int enable );
  65. #endif
  66. /** Get the ALSA-lib card index of this stream's input device. */
  67. PaError PaAlsa_GetStreamInputCard( PaStream *s, int *card );
  68. /** Get the ALSA-lib card index of this stream's output device. */
  69. PaError PaAlsa_GetStreamOutputCard( PaStream *s, int *card );
  70. /** Set the number of periods (buffer fragments) to configure devices with.
  71. *
  72. * By default the number of periods is 4, this is the lowest number of periods that works well on
  73. * the author's soundcard.
  74. * @param numPeriods The number of periods.
  75. */
  76. PaError PaAlsa_SetNumPeriods( int numPeriods );
  77. /** Set the maximum number of times to retry opening busy device (sleeping for a
  78. * short interval inbetween).
  79. */
  80. PaError PaAlsa_SetRetriesBusy( int retries );
  81. /** Set the path and name of ALSA library file if PortAudio is configured to load it dynamically (see
  82. * PA_ALSA_DYNAMIC). This setting will overwrite the default name set by PA_ALSA_PATHNAME define.
  83. * @param pathName Full path with filename. Only filename can be used, but dlopen() will lookup default
  84. * searchable directories (/usr/lib;/usr/local/lib) then.
  85. */
  86. void PaAlsa_SetLibraryPathName( const char *pathName );
  87. PaError PaAlsa_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex hostApiIndex ); // ppgb
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif