audio.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. // This file was generated by:
  5. // tools/json_schema_compiler/compiler.py.
  6. // NOTE: The format of types has changed. 'FooType' is now
  7. // 'chrome.audio.FooType'.
  8. // Please run the closure compiler before committing changes.
  9. // See https://chromium.googlesource.com/chromium/src/+/master/docs/closure_compilation.md
  10. /** @fileoverview Externs generated from namespace: audio */
  11. /** @const */
  12. chrome.audio = {};
  13. /**
  14. * @enum {string}
  15. * @see https://developer.chrome.com/extensions/audio#type-StreamType
  16. */
  17. chrome.audio.StreamType = {
  18. INPUT: 'INPUT',
  19. OUTPUT: 'OUTPUT',
  20. };
  21. /**
  22. * @enum {string}
  23. * @see https://developer.chrome.com/extensions/audio#type-DeviceType
  24. */
  25. chrome.audio.DeviceType = {
  26. HEADPHONE: 'HEADPHONE',
  27. MIC: 'MIC',
  28. USB: 'USB',
  29. BLUETOOTH: 'BLUETOOTH',
  30. HDMI: 'HDMI',
  31. INTERNAL_SPEAKER: 'INTERNAL_SPEAKER',
  32. INTERNAL_MIC: 'INTERNAL_MIC',
  33. FRONT_MIC: 'FRONT_MIC',
  34. REAR_MIC: 'REAR_MIC',
  35. KEYBOARD_MIC: 'KEYBOARD_MIC',
  36. HOTWORD: 'HOTWORD',
  37. LINEOUT: 'LINEOUT',
  38. POST_MIX_LOOPBACK: 'POST_MIX_LOOPBACK',
  39. POST_DSP_LOOPBACK: 'POST_DSP_LOOPBACK',
  40. ALSA_LOOPBACK: 'ALSA_LOOPBACK',
  41. OTHER: 'OTHER',
  42. };
  43. /**
  44. * @typedef {{
  45. * id: string,
  46. * name: string,
  47. * isActive: boolean,
  48. * isMuted: boolean,
  49. * volume: number
  50. * }}
  51. * @see https://developer.chrome.com/extensions/audio#type-OutputDeviceInfo
  52. */
  53. chrome.audio.OutputDeviceInfo;
  54. /**
  55. * @typedef {{
  56. * id: string,
  57. * name: string,
  58. * isActive: boolean,
  59. * isMuted: boolean,
  60. * gain: number
  61. * }}
  62. * @see https://developer.chrome.com/extensions/audio#type-InputDeviceInfo
  63. */
  64. chrome.audio.InputDeviceInfo;
  65. /**
  66. * @typedef {{
  67. * id: string,
  68. * streamType: !chrome.audio.StreamType,
  69. * deviceType: !chrome.audio.DeviceType,
  70. * displayName: string,
  71. * deviceName: string,
  72. * isActive: boolean,
  73. * level: number,
  74. * stableDeviceId: (string|undefined)
  75. * }}
  76. * @see https://developer.chrome.com/extensions/audio#type-AudioDeviceInfo
  77. */
  78. chrome.audio.AudioDeviceInfo;
  79. /**
  80. * @typedef {{
  81. * streamTypes: (!Array<!chrome.audio.StreamType>|undefined),
  82. * isActive: (boolean|undefined)
  83. * }}
  84. * @see https://developer.chrome.com/extensions/audio#type-DeviceFilter
  85. */
  86. chrome.audio.DeviceFilter;
  87. /**
  88. * @typedef {{
  89. * isMuted: (boolean|undefined),
  90. * volume: (number|undefined),
  91. * gain: (number|undefined),
  92. * level: (number|undefined)
  93. * }}
  94. * @see https://developer.chrome.com/extensions/audio#type-DeviceProperties
  95. */
  96. chrome.audio.DeviceProperties;
  97. /**
  98. * @typedef {{
  99. * input: (!Array<string>|undefined),
  100. * output: (!Array<string>|undefined)
  101. * }}
  102. * @see https://developer.chrome.com/extensions/audio#type-DeviceIdLists
  103. */
  104. chrome.audio.DeviceIdLists;
  105. /**
  106. * @typedef {{
  107. * streamType: !chrome.audio.StreamType,
  108. * isMuted: boolean
  109. * }}
  110. * @see https://developer.chrome.com/extensions/audio#type-MuteChangedEvent
  111. */
  112. chrome.audio.MuteChangedEvent;
  113. /**
  114. * @typedef {{
  115. * deviceId: string,
  116. * level: number
  117. * }}
  118. * @see https://developer.chrome.com/extensions/audio#type-LevelChangedEvent
  119. */
  120. chrome.audio.LevelChangedEvent;
  121. /**
  122. * Gets a list of audio devices filtered based on |filter|.
  123. * @param {?chrome.audio.DeviceFilter|undefined} filter Device properties by
  124. * which to filter the list of returned audio devices. If the filter is
  125. * not set or set to <code>{}</code>, returned device list will contain
  126. * all available audio devices.
  127. * @param {function(!Array<!chrome.audio.AudioDeviceInfo>): void} callback
  128. * Reports the requested list of audio devices.
  129. * @see https://developer.chrome.com/extensions/audio#method-getDevices
  130. */
  131. chrome.audio.getDevices = function(filter, callback) {};
  132. /**
  133. * Sets lists of active input and/or output devices.
  134. * @param {(!chrome.audio.DeviceIdLists|!Array<string>)} ids <p>Specifies IDs of
  135. * devices that should be active. If either the input or output list is
  136. * not set, devices in that category are unaffected. </p> <p>It
  137. * is an error to pass in a non-existent device ID.</p> <p><b>NOTE:</b>
  138. * While the method signature allows device IDs to be passed as a list
  139. * of strings, this method of setting active devices is deprecated and
  140. * should not be relied upon to work. Please use $(ref:DeviceIdLists)
  141. * instead. </p>
  142. * @param {function(): void} callback
  143. * @see https://developer.chrome.com/extensions/audio#method-setActiveDevices
  144. */
  145. chrome.audio.setActiveDevices = function(ids, callback) {};
  146. /**
  147. * Sets the properties for the input or output device.
  148. * @param {string} id
  149. * @param {!chrome.audio.DeviceProperties} properties
  150. * @param {function(): void} callback
  151. * @see https://developer.chrome.com/extensions/audio#method-setProperties
  152. */
  153. chrome.audio.setProperties = function(id, properties, callback) {};
  154. /**
  155. * Gets the system-wide mute state for the specified stream type.
  156. * @param {!chrome.audio.StreamType} streamType Stream type for which mute state
  157. * should be fetched.
  158. * @param {function(boolean): void} callback Callback reporting whether mute is
  159. * set or not for specified stream type.
  160. * @see https://developer.chrome.com/extensions/audio#method-getMute
  161. */
  162. chrome.audio.getMute = function(streamType, callback) {};
  163. /**
  164. * Sets mute state for a stream type. The mute state will apply to all audio
  165. * devices with the specified audio stream type.
  166. * @param {!chrome.audio.StreamType} streamType Stream type for which mute state
  167. * should be set.
  168. * @param {boolean} isMuted New mute value.
  169. * @param {function(): void=} callback
  170. * @see https://developer.chrome.com/extensions/audio#method-setMute
  171. */
  172. chrome.audio.setMute = function(streamType, isMuted, callback) {};
  173. /**
  174. * Gets the information of all audio output and input devices.
  175. * @param {function(!Array<!chrome.audio.OutputDeviceInfo>, !Array<!chrome.audio.InputDeviceInfo>): void}
  176. * callback
  177. * @deprecated Use $(ref:getDevices) instead.
  178. * @see https://developer.chrome.com/extensions/audio#method-getInfo
  179. */
  180. chrome.audio.getInfo = function(callback) {};
  181. /**
  182. * Fired when sound level changes for an active audio device.
  183. * @type {!ChromeEvent}
  184. * @see https://developer.chrome.com/extensions/audio#event-onLevelChanged
  185. */
  186. chrome.audio.onLevelChanged;
  187. /**
  188. * Fired when the mute state of the audio input or output changes. Note that
  189. * mute state is system-wide and the new value applies to every audio device
  190. * with specified stream type.
  191. * @type {!ChromeEvent}
  192. * @see https://developer.chrome.com/extensions/audio#event-onMuteChanged
  193. */
  194. chrome.audio.onMuteChanged;
  195. /**
  196. * Fired when audio devices change, either new devices being added, or existing
  197. * devices being removed.
  198. * @type {!ChromeEvent}
  199. * @see https://developer.chrome.com/extensions/audio#event-onDeviceListChanged
  200. */
  201. chrome.audio.onDeviceListChanged;
  202. /**
  203. * Fired when anything changes to the audio device configuration.
  204. * @type {!ChromeEvent}
  205. * @see https://developer.chrome.com/extensions/audio#event-onDeviceChanged
  206. */
  207. chrome.audio.onDeviceChanged;