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

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: Improved comments Created 8 years, 2 months 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_
scherkus (not reviewing) 2012/10/24 16:48:04 nit: it's your call but we don't have to add a _wi
henrika (OOO until Aug 14) 2012/10/24 19:25:44 Got it. I actually think that I followed lint here
tommi (sloooow) - chröme 2012/10/29 10:45:26 Lint was pointing out that the #if guard must matc
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 // Returns true if Windows Core Audio is supported.
26 MEDIA_EXPORT bool CoreAudioIsSupported();
27
28 // --- MMDevice
scherkus (not reviewing) 2012/10/24 16:48:04 I find this comment is redundant given the one imm
henrika (OOO until Aug 14) 2012/10/24 19:25:44 Will modify.
henrika (OOO until Aug 14) 2012/10/25 15:14:08 Done.
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 devices.
35 MEDIA_EXPORT int CoreAudioNumberOfActiveDevices(EDataFlow data_flow);
DaleCurtis 2012/10/25 01:08:08 kind of stinks to have to prefix all these with Co
henrika (OOO until Aug 14) 2012/10/25 15:14:08 Agree. That is why I started out with a nested nam
36
37 // Creates an IMMDeviceEnumerator interface which provides methods for
38 // enumerating audio endpoint devices.
39 MEDIA_EXPORT ScopedComPtr<IMMDeviceEnumerator>
40 CoreAudioCreateDeviceEnumerator();
41
42 // Create a default endpoint device that is specified by a data-flow
43 // direction and role, e.g. default render device.
44 MEDIA_EXPORT ScopedComPtr<IMMDevice> CoreAudioCreateDefaultDevice(
45 EDataFlow data_flow, ERole role);
46
47 // Create an endpoint device that is specified by a unique endpoint device-
48 // identification string.
49 MEDIA_EXPORT ScopedComPtr<IMMDevice> CoreAudioCreateDevice(
50 const std::string& device_id);
51
52 // Returns the unique ID and user-friendly name of a given endpoint device.
53 // Example: "{0.0.1.00000000}.{8db6020f-18e3-4f25-b6f5-7726c9122574}", and
54 // "Microphone (Realtek High Definition Audio)".
55 MEDIA_EXPORT HRESULT CoreAudioGetDeviceName(IMMDevice* device,
56 AudioDeviceName* name);
57
58 // Gets the user-friendly name of the endpoint devcice which is represented
59 // by a uniqe id in |device_id|.
60 MEDIA_EXPORT std::string CoreAudioGetFriendlyName(const std::string& device_id);
61
62 // Returns true if the provided uniqe |device_id| correspinds to the current
63 // default device for the specified by a data-flow direction and role.
64 MEDIA_EXPORT bool CoreAudioDeviceIsDefault(EDataFlow flow, ERole role,
65 std::string device_id);
66
67 // Query if the audio endpoint device is a rendering device or a capture device.
68 MEDIA_EXPORT EDataFlow CoreAudioGetDataFlow(IMMDevice* device);
69
70 // --- WASAPI
scherkus (not reviewing) 2012/10/24 16:48:04 ditto
henrika (OOO until Aug 14) 2012/10/24 19:25:44 Will modify.
henrika (OOO until Aug 14) 2012/10/25 15:14:08 Done.
71
72 // The Windows Audio Session API (WASAPI) enables client applications to
73 // manage the flow of audio data between the application and an audio endpoint
74 // device.
75
76 // Create an IAudioClient interface for an existing IMMDevice given by
77 // |audio_device|. Flow direction and role is define by the |audio_device|.
78 // The IAudioClient interface enables a client to create and initialize an
79 // audio stream between an audio application and the audio engine (for a
80 // shared-mode stream) or the hardware buffer of an audio endpoint device
81 // (for an exclusive-mode stream).
82 MEDIA_EXPORT ScopedComPtr<IAudioClient> CoreAudioCreateClient(
83 IMMDevice* audio_device);
84
85 // TODO(henrika): add more methods here...
scherkus (not reviewing) 2012/10/24 16:48:04 this isn't very descriptive -- I'd either have it
henrika (OOO until Aug 14) 2012/10/24 19:25:44 Agree. Will delete.
86
87 } // namespace media
88
89 #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