1 // Copyright (c) 2012 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.
5 #ifndef MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
6 #define MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_
10 #include "media/audio/audio_manager_base.h"
14 class AudioDeviceListenerWin
;
16 // Windows implementation of the AudioManager singleton. This class is internal
17 // to the audio output and only internal users can call methods not exposed by
18 // the AudioManager class.
19 class MEDIA_EXPORT AudioManagerWin
: public AudioManagerBase
{
23 // Implementation of AudioManager.
24 virtual bool HasAudioOutputDevices() OVERRIDE
;
25 virtual bool HasAudioInputDevices() OVERRIDE
;
26 virtual string16
GetAudioInputDeviceModel() OVERRIDE
;
27 virtual void ShowAudioInputSettings() OVERRIDE
;
28 virtual void GetAudioInputDeviceNames(media::AudioDeviceNames
* device_names
)
30 virtual AudioParameters
GetInputStreamParameters(
31 const std::string
& device_id
) OVERRIDE
;
33 // Implementation of AudioManagerBase.
34 virtual AudioOutputStream
* MakeLinearOutputStream(
35 const AudioParameters
& params
) OVERRIDE
;
36 virtual AudioOutputStream
* MakeLowLatencyOutputStream(
37 const AudioParameters
& params
,
38 const std::string
& input_device_id
) OVERRIDE
;
39 virtual AudioInputStream
* MakeLinearInputStream(
40 const AudioParameters
& params
, const std::string
& device_id
) OVERRIDE
;
41 virtual AudioInputStream
* MakeLowLatencyInputStream(
42 const AudioParameters
& params
, const std::string
& device_id
) OVERRIDE
;
45 virtual ~AudioManagerWin();
47 virtual AudioParameters
GetPreferredOutputStreamParameters(
48 const AudioParameters
& input_params
) OVERRIDE
;
51 enum EnumerationType
{
52 kUninitializedEnumeration
= 0,
57 // Allow unit test to modify the utilized enumeration API.
58 friend class AudioInputDeviceTest
;
60 EnumerationType enumeration_type_
;
61 EnumerationType
enumeration_type() { return enumeration_type_
; }
62 void SetEnumerationType(EnumerationType type
) {
63 enumeration_type_
= type
;
66 // Returns a PCMWaveInAudioInputStream instance or NULL on failure.
67 // This method converts MMDevice-style device ID to WaveIn-style device ID if
69 // (Please see device_enumeration_win.h for more info about the two kinds of
71 AudioInputStream
* CreatePCMWaveInAudioInputStream(
72 const AudioParameters
& params
,
73 const std::string
& device_id
);
75 // Helper methods for constructing AudioDeviceListenerWin on the audio thread.
76 void CreateDeviceListener();
77 void DestroyDeviceListener();
79 // Listen for output device changes.
80 scoped_ptr
<AudioDeviceListenerWin
> output_device_listener_
;
82 DISALLOW_COPY_AND_ASSIGN(AudioManagerWin
);
87 #endif // MEDIA_AUDIO_WIN_AUDIO_MANAGER_WIN_H_