Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: media/audio/win/core_audio_util_win.h

Issue 11226057: Adds Core Audio Utility methods for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit test based on feedback from Tommi Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 // Utility methods for the Core Audio API on Windows.
6 // Always ensure that Core Audio is supported before using these methods.
7 // Use media::CoreAudioIsSupported() for this purpose.
8
9 #ifndef MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_
10 #define MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_
11
12 #include <audioclient.h>
13 #include <mmdeviceapi.h>
14 #include <string>
15
16 #include "base/basictypes.h"
17 #include "base/win/scoped_comptr.h"
18 #include "media/audio/audio_device_name.h"
19 #include "media/base/media_export.h"
20
21 using base::win::ScopedComPtr;
22
23 namespace media {
24
25 class MEDIA_EXPORT CoreAudioUtil {
26 public:
27 // Returns true if Windows Core Audio is supported.
28 static bool CoreAudioIsSupported();
29
30 // The Windows Multimedia Device (MMDevice) API enables audio clients to
31 // discover audio endpoint devices and determine their capabilities.
32
33 // Number of active audio devices in the specified flow data flow direction.
34 // Set |data_flow| to eAll to retrive the total number of active audio
35 // devices.
36 static int NumberOfActiveDevices(EDataFlow data_flow);
37
38 // Creates an IMMDeviceEnumerator interface which provides methods for
39 // enumerating audio endpoint devices.
40 static ScopedComPtr<IMMDeviceEnumerator> CreateDeviceEnumerator();
41
42 // Create a default endpoint device that is specified by a data-flow
43 // direction and role, e.g. default render device.
44 static ScopedComPtr<IMMDevice> CreateDefaultDevice(
45 EDataFlow data_flow, ERole role);
46
47 // Create an endpoint device that is specified by a unique endpoint device-
48 // identification string.
49 static ScopedComPtr<IMMDevice> CreateDevice(const std::string& device_id);
50
51 // Returns the unique ID and user-friendly name of a given endpoint device.
52 // Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}", and
53 // "Microphone (Realtek High Definition Audio)".
54 static HRESULT GetDeviceName(IMMDevice* device, AudioDeviceName* name);
55
56 // Gets the user-friendly name of the endpoint devcice which is represented
57 // by a uniqe id in |device_id|.
58 static std::string GetFriendlyName(const std::string& device_id);
59
60 // Returns true if the provided uniqe |device_id| correspinds to the current
61 // default device for the specified by a data-flow direction and role.
62 static bool DeviceIsDefault(
63 EDataFlow flow, ERole role, std::string device_id);
64
65 // Query if the audio device is a rendering device or a capture device.
66 static EDataFlow GetDataFlow(IMMDevice* device);
67
68 // The Windows Audio Session API (WASAPI) enables client applications to
69 // manage the flow of audio data between the application and an audio endpoint
70 // device.
71
72 // Create an IAudioClient interface for an existing IMMDevice given by
73 // |audio_device|. Flow direction and role is define by the |audio_device|.
74 // The IAudioClient interface enables a client to create and initialize an
75 // audio stream between an audio application and the audio engine (for a
76 // shared-mode stream) or the hardware buffer of an audio endpoint device
77 // (for an exclusive-mode stream).
78 static ScopedComPtr<IAudioClient> CreateClient(IMMDevice* audio_device);
79
80 private:
81 CoreAudioUtil() {}
82 virtual ~CoreAudioUtil() {}
scherkus (not reviewing) 2012/10/25 16:52:13 no need for virtual
henrika (OOO until Aug 14) 2012/10/26 17:51:56 Done.
83 DISALLOW_COPY_AND_ASSIGN(CoreAudioUtil);
84 };
85
86 } // namespace media
87
88 #endif // MEDIA_AUDIO_WIN_CORE_AUDIO_UTIL_WIN_H_
OLDNEW
« no previous file with comments | « no previous file | media/audio/win/core_audio_util_win.cc » ('j') | media/audio/win/core_audio_util_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698