1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5#include "nsISupports.idl"
6
7[scriptable, builtinclass, uuid(df31c280-1ef1-11e5-867f-0800200c9a66)]
8interface nsIAudioManager : nsISupports
9{
10  /**
11   * Microphone muted?
12   */
13  attribute boolean microphoneMuted;
14
15  /**
16   * Set the phone's audio mode.
17   */
18  const long PHONE_STATE_INVALID          = -2;
19  const long PHONE_STATE_CURRENT          = -1;
20  const long PHONE_STATE_NORMAL           = 0;
21  const long PHONE_STATE_RINGTONE         = 1;
22  const long PHONE_STATE_IN_CALL          = 2;
23  const long PHONE_STATE_IN_COMMUNICATION = 3;
24
25  attribute long phoneState;
26
27  /**
28   * Configure a particular device ("force") to be used for one of the uses
29   * (communication, media playback, etc.)
30   */
31  const long FORCE_NONE            = 0; // the default
32  const long FORCE_SPEAKER         = 1;
33  const long FORCE_HEADPHONES      = 2;
34  const long FORCE_BT_SCO          = 3;
35  const long FORCE_BT_A2DP         = 4;
36  const long FORCE_WIRED_ACCESSORY = 5;
37  const long FORCE_BT_CAR_DOCK     = 6;
38  const long FORCE_BT_DESK_DOCK    = 7;
39  const long FORCE_ANALOG_DOCK     = 8;
40  const long FORCE_DIGITAL_DOCK    = 9;
41  const long FORCE_NO_BT_A2DP      = 10;
42  const long USE_COMMUNICATION     = 0;
43  const long USE_MEDIA             = 1;
44  const long USE_RECORD            = 2;
45  const long USE_DOCK              = 3;
46
47  void setForceForUse(in long usage, in long force);
48  long getForceForUse(in long usage);
49
50  /**
51   * These functions would be used when we enable the new volume control API
52   * (mozAudioChannelManager). The range of volume index is from 0 to N.
53   * More details on : https://gist.github.com/evanxd/41d8e2d91c5201a42bfa
54   */
55  void setAudioChannelVolume(in unsigned long channel, in unsigned long index);
56  unsigned long getAudioChannelVolume(in unsigned long channel);
57  unsigned long getMaxAudioChannelVolume(in unsigned long channel);
58};
59