1
0

audio.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. enum {
  10. master_chan = 0x00,
  11. Speed_control = 0x00,
  12. /* Items below are defined by USB standard: */
  13. Mute_control = 0x01,
  14. Volume_control = 0x02,
  15. Bass_control = 0x03,
  16. Mid_control = 0x04,
  17. Treble_control = 0x05,
  18. Equalizer_control = 0x06,
  19. Agc_control = 0x07,
  20. Delay_control = 0x08,
  21. Bassboost_control = 0x09,
  22. Loudness_control = 0x0a,
  23. /* Items below are defined by implementation: */
  24. Channel_control = 0x0b,
  25. Resolution_control = 0x0c,
  26. Ncontrol,
  27. Selector_control = 0x0d,
  28. sampling_freq_control = 0x01,
  29. Audiocsp = 0x000101, /* audio.control.0 */
  30. AUDIO_INTERFACE = 0x24,
  31. AUDIO_ENDPOINT = 0x25,
  32. };
  33. #define AS_GENERAL 1
  34. #define FORMAT_TYPE 2
  35. #define FORMAT_SPECIFIC 3
  36. #define PCM 1
  37. #define PCM8 2
  38. #define IEEE_FLOAT 3
  39. #define ALAW 4
  40. #define MULAW 5
  41. #define SAMPLING_FREQ_CONTROL 0x01
  42. typedef struct Audioalt Audioalt;
  43. struct Audioalt {
  44. int nchan;
  45. int res;
  46. int subframesize;
  47. int minfreq, maxfreq; /* continuous freqs */
  48. int freqs[8]; /* discrete freqs */
  49. int caps; /* see below for meanings */
  50. };
  51. enum {
  52. /* Audioalt->caps bits */
  53. has_setspeed = 0x1, /* has a speed_set command */
  54. has_pitchset = 0x2, /* has a pitch_set command */
  55. has_contfreq = 0x4, /* frequency continuously variable */
  56. has_discfreq = 0x8, /* discrete set of frequencies */
  57. onefreq = 0x10, /* only one frequency */
  58. maxpkt_only = 0x80, /* packets must be padded to max size */
  59. };
  60. typedef uint8_t byte;
  61. extern int setrec;
  62. extern int verbose;
  63. extern int defaultspeed[2];
  64. extern Dev *ad;
  65. extern Dev *buttondev;
  66. extern Channel *controlchan;
  67. extern Dev *epdev[2];
  68. void audio_interface(Dev *d, Desc *dd);
  69. void setalt(Dev *d, int endpt, int value);
  70. int getalt(Dev *d, int endpt);
  71. int setspeed(int rec, int speed);
  72. int setcontrol(int rec, char *name, int32_t *value);
  73. int getspecialcontrol(int rec, int ctl, int req, int32_t *value);
  74. int getcontrol(int rec, char *name, int32_t *value);
  75. int findalt(int rec, int nchan, int res, int speed);
  76. void getcontrols(void);
  77. void serve(void *);
  78. int nbchanprint(Channel *c, char *fmt, ...);
  79. int Aconv(Fmt *fp);