summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/audio/audio_mixer.h
blob: e31ff2b2fe6805f1189bec9834ef109bd0b7c3f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_H_
#define CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_H_

#include "base/basictypes.h"

namespace chromeos {

class AudioMixer {
 public:
  AudioMixer() {}
  virtual ~AudioMixer() {}

  // Initializes the connection to the device.  This must be called on the UI
  // thread; blocking tasks may take place in the background.  Note that the
  // other methods in this interface can be called before Init().
  virtual void Init() = 0;

  // Returns the most-recently-set volume, in the range [0.0, 100.0].
  virtual double GetVolumePercent() = 0;

  // Sets the volume, possibly asynchronously.
  // |percent| should be in the range [0.0, 100.0].
  virtual void SetVolumePercent(double percent) = 0;

  // Is the device currently muted?
  virtual bool IsMuted() = 0;

  // Mutes or unmutes the device, possibly asynchronously.  The caller must
  // first verify that the mute state is not locked by calling IsMuteLocked.
  virtual void SetMuted(bool mute) = 0;

  // Is the device's mute state currently locked?
  virtual bool IsMuteLocked() = 0;

  // Locks the mute state of the device to whatever state it currently is in.
  // Call SetMuteLocked with false to allow changing the mute state again.
  virtual void SetMuteLocked(bool locked) = 0;

  // Is the capture device currently muted?
  virtual bool IsCaptureMuted() = 0;

  // Mutes or unmutes the capture device, possible asynchronously.  The caller
  // must first verify that the mute state is not locked by calling
  // IsCaptureMuteLocked.
  virtual void SetCaptureMuted(bool mute) = 0;

  // Is the capture device's mute state currently locked?
  virtual bool IsCaptureMuteLocked() = 0;

  // Locks the capture mute state of the device.
  virtual void SetCaptureMuteLocked(bool locked) = 0;

 private:
  DISALLOW_COPY_AND_ASSIGN(AudioMixer);
};

}  // namespace chromeos

#endif  // CHROME_BROWSER_CHROMEOS_AUDIO_AUDIO_MIXER_H_