Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2010 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 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_BASE_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_BASE_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/callback.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 | |
| 14 const double kSilenceDb = -200.0; | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
this needs a comment + move the actual assignment
davejcool
2010/12/23 03:09:02
It seems a const can't be defined elsewhere except
| |
| 15 | |
| 16 class AudioMixerBase { | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
this looks more like an interface rather than a ba
| |
| 17 public: | |
| 18 enum State { | |
| 19 UNINITIALIZED = 0, | |
| 20 INITIALIZING, | |
| 21 READY, | |
| 22 SHUTTING_DOWN, | |
| 23 IN_ERROR | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
nit: add trailing ,
| |
| 24 }; | |
| 25 | |
| 26 AudioMixerBase() {} | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
avoid inlining virtual methods (i.e., put these in
| |
| 27 virtual ~AudioMixerBase() {} | |
| 28 | |
| 29 // Non-blocking, connect to Mixer and find a default device, and call | |
| 30 // callback when complete with success code. | |
| 31 typedef Callback1<bool>::Type InitDoneCallback; | |
| 32 virtual bool Init(InitDoneCallback* callback) = 0; | |
| 33 | |
| 34 // Blocking init call guarantees Mixer is connected before returning. | |
| 35 virtual bool InitSync() = 0; | |
| 36 | |
| 37 // Blocking call. Returns a default of kSilenceDb on error. | |
| 38 virtual double GetVolumeDb() const = 0; | |
| 39 | |
| 40 virtual void GetVolumeLimits(double* vol_min, double* vol_max) = 0; | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
needs a comment
is it blocking? etc..
| |
| 41 | |
| 42 // Non-blocking call. | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
do all these blocking comments apply to both pulse
| |
| 43 virtual void SetVolumeDb(double vol_db) = 0; | |
| 44 | |
| 45 // Gets the mute state of the default device (true == mute). Blocking call. | |
| 46 // Returns a default of false on error. | |
| 47 virtual bool IsMute() const = 0; | |
| 48 | |
| 49 // Non-Blocking call. | |
| 50 virtual void SetMute(bool mute) = 0; | |
| 51 | |
| 52 // Returns READY if we have a valid working connection to the Mixer. | |
| 53 // This can return IN_ERROR if we lose the connection, even after an original | |
| 54 // successful init. Non-blocking call. | |
| 55 virtual State CheckState() const = 0; | |
| 56 | |
| 57 protected: | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
believe this should be private (no need to have su
| |
| 58 | |
|
scherkus (not reviewing)
2010/12/22 22:31:58
nit: no blank line
| |
| 59 DISALLOW_COPY_AND_ASSIGN(AudioMixerBase); | |
| 60 }; | |
| 61 | |
| 62 } // namespace chromeos | |
| 63 | |
| 64 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_BASE_H_ | |
| 65 | |
| OLD | NEW |