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_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 #include "base/callback.h" | |
| 11 | |
| 12 namespace chromeos { | |
| 13 | |
| 14 class AudioMixer { | |
| 15 public: | |
| 16 enum State { | |
| 17 UNINITIALIZED = 0, | |
| 18 INITIALIZING, | |
| 19 READY, | |
| 20 SHUTTING_DOWN, | |
| 21 IN_ERROR, | |
| 22 }; | |
| 23 | |
| 24 AudioMixer(); | |
| 25 virtual ~AudioMixer(); | |
| 26 | |
|
davejcool
2011/01/05 21:11:05
I'm inlining the constructor and destructor again
| |
| 27 // Non-Blocking call. Connect to Mixer, find a default device, then call the | |
| 28 // callback when complete with success code. | |
| 29 typedef Callback1<bool>::Type InitDoneCallback; | |
| 30 virtual bool Init(InitDoneCallback* callback) = 0; | |
| 31 | |
| 32 // Call may block. Mixer will be connected before returning, unless error. | |
| 33 virtual bool InitSync() = 0; | |
| 34 | |
| 35 // Call may block. Returns a default of kSilenceDb on error. | |
| 36 virtual double GetVolumeDb() const = 0; | |
| 37 | |
| 38 // Non-Blocking call. Returns the actual volume limits possible according | |
| 39 // to the mixer. Limits are left unchanged on error | |
| 40 virtual bool GetVolumeLimits(double* vol_min, double* vol_max) = 0; | |
| 41 | |
| 42 // Non-blocking call. | |
| 43 virtual void SetVolumeDb(double vol_db) = 0; | |
| 44 | |
| 45 // Call may block. Gets the mute state of the default device (true == mute). | |
| 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 // Approximation of pure silence expressed in decibels. | |
| 58 static const double kSilenceDb = -200.0; | |
| 59 | |
| 60 private: | |
| 61 DISALLOW_COPY_AND_ASSIGN(AudioMixer); | |
| 62 }; | |
| 63 | |
| 64 } // namespace chromeos | |
| 65 | |
| 66 #endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_H_ | |
| 67 | |
| OLD | NEW |