Chromium Code Reviews| Index: chrome/browser/chromeos/audio_mixer_base.h |
| diff --git a/chrome/browser/chromeos/audio_mixer_base.h b/chrome/browser/chromeos/audio_mixer_base.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8591ceb443bbb17ec0c242c591cebc62f6690776 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/audio_mixer_base.h |
| @@ -0,0 +1,65 @@ |
| +// Copyright (c) 2010 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_MIXER_BASE_H_ |
| +#define CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_BASE_H_ |
| +#pragma once |
| + |
| +#include "base/basictypes.h" |
| +#include "base/callback.h" |
| + |
| +namespace chromeos { |
| + |
| +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
|
| + |
| +class AudioMixerBase { |
|
scherkus (not reviewing)
2010/12/22 22:31:58
this looks more like an interface rather than a ba
|
| + public: |
| + enum State { |
| + UNINITIALIZED = 0, |
| + INITIALIZING, |
| + READY, |
| + SHUTTING_DOWN, |
| + IN_ERROR |
|
scherkus (not reviewing)
2010/12/22 22:31:58
nit: add trailing ,
|
| + }; |
| + |
| + AudioMixerBase() {} |
|
scherkus (not reviewing)
2010/12/22 22:31:58
avoid inlining virtual methods (i.e., put these in
|
| + virtual ~AudioMixerBase() {} |
| + |
| + // Non-blocking, connect to Mixer and find a default device, and call |
| + // callback when complete with success code. |
| + typedef Callback1<bool>::Type InitDoneCallback; |
| + virtual bool Init(InitDoneCallback* callback) = 0; |
| + |
| + // Blocking init call guarantees Mixer is connected before returning. |
| + virtual bool InitSync() = 0; |
| + |
| + // Blocking call. Returns a default of kSilenceDb on error. |
| + virtual double GetVolumeDb() const = 0; |
| + |
| + 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..
|
| + |
| + // Non-blocking call. |
|
scherkus (not reviewing)
2010/12/22 22:31:58
do all these blocking comments apply to both pulse
|
| + virtual void SetVolumeDb(double vol_db) = 0; |
| + |
| + // Gets the mute state of the default device (true == mute). Blocking call. |
| + // Returns a default of false on error. |
| + virtual bool IsMute() const = 0; |
| + |
| + // Non-Blocking call. |
| + virtual void SetMute(bool mute) = 0; |
| + |
| + // Returns READY if we have a valid working connection to the Mixer. |
| + // This can return IN_ERROR if we lose the connection, even after an original |
| + // successful init. Non-blocking call. |
| + virtual State CheckState() const = 0; |
| + |
| + protected: |
|
scherkus (not reviewing)
2010/12/22 22:31:58
believe this should be private (no need to have su
|
| + |
|
scherkus (not reviewing)
2010/12/22 22:31:58
nit: no blank line
|
| + DISALLOW_COPY_AND_ASSIGN(AudioMixerBase); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_AUDIO_MIXER_BASE_H_ |
| + |