audio.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Audio 'LIB' defines
  3. */
  4. #define AUDIO_OUT_HEADPHONES 0x01
  5. #define AUDIO_OUT_INTERNAL_SPEAKER 0x02
  6. #define AUDIO_OUT_LINE_OUT 0x04
  7. enum { DECODE_TEST, DECODE_AUDIO, DECODE_FILE, DECODE_BUFFER, DECODE_WAV,
  8. DECODE_AU,DECODE_CDR,DECODE_AUDIOFILE };
  9. #define AUDIO_FORMAT_MASK 0x100
  10. #define AUDIO_FORMAT_16 0x100
  11. #define AUDIO_FORMAT_8 0x000
  12. #define AUDIO_FORMAT_SIGNED_16 0x110
  13. #define AUDIO_FORMAT_UNSIGNED_16 0x120
  14. #define AUDIO_FORMAT_UNSIGNED_8 0x1
  15. #define AUDIO_FORMAT_SIGNED_8 0x2
  16. #define AUDIO_FORMAT_ULAW_8 0x4
  17. #define AUDIO_FORMAT_ALAW_8 0x8
  18. /* 3% rate tolerance */
  19. #define AUDIO_RATE_TOLERANCE 3
  20. #if 0
  21. #if defined(HPUX) || defined(SUNOS) || defined(SOLARIS) || defined(OSS) || defined(__NetBSD__) || defined(SPARCLINUX) || defined(__FreeBSD__)
  22. #endif
  23. #endif
  24. #define AUDIO_USES_FD
  25. #ifdef SGI
  26. /* #include <audio.h> */
  27. #include <dmedia/audio.h>
  28. #endif
  29. #ifdef ALSA
  30. #include <sys/asoundlib.h>
  31. #endif
  32. struct audio_info_struct
  33. {
  34. #ifdef AUDIO_USES_FD
  35. int fn; /* filenumber */
  36. #endif
  37. #ifdef SGI
  38. ALconfig config;
  39. ALport port;
  40. #endif
  41. long rate;
  42. long gain;
  43. int output;
  44. #ifdef ALSA
  45. void *handle;
  46. snd_pcm_format_t alsa_format;
  47. #endif
  48. char *device;
  49. int channels;
  50. int format;
  51. int private1;
  52. void *private2;
  53. };
  54. struct audio_name {
  55. int val;
  56. char *name;
  57. char *sname;
  58. };
  59. extern void audio_capabilities(struct audio_info_struct *);
  60. extern void audio_fit_capabilities(struct audio_info_struct *ai,int c,int r);
  61. extern char *audio_encoding_name(int format);
  62. extern int audio_play_samples(struct audio_info_struct *,unsigned char *,int);
  63. extern int audio_open(struct audio_info_struct *);
  64. extern int audio_reset_parameters(struct audio_info_struct *);
  65. extern int audio_rate_best_match(struct audio_info_struct *ai);
  66. extern int audio_set_rate(struct audio_info_struct *);
  67. extern int audio_set_format(struct audio_info_struct *);
  68. extern int audio_get_formats(struct audio_info_struct *);
  69. extern int audio_set_channels(struct audio_info_struct *);
  70. extern int audio_write_sample(struct audio_info_struct *,short *,int);
  71. extern int audio_close(struct audio_info_struct *);
  72. extern void audio_info_struct_init(struct audio_info_struct *);
  73. extern void audio_queueflush(struct audio_info_struct *ai);