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

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

Issue 15979015: Reland 15721002: Hook up the device selection to the WebAudio live audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the comments. Created 7 years, 6 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_ 5 #ifndef MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_
6 #define MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_ 6 #define MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_
7 7
8 #include <Audioclient.h> 8 #include <Audioclient.h>
9 #include <MMDeviceAPI.h> 9 #include <MMDeviceAPI.h>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // as internal sample-value representation. 77 // as internal sample-value representation.
78 // - Perform fine-tuning for non-matching sample rates to reduce latency. 78 // - Perform fine-tuning for non-matching sample rates to reduce latency.
79 // 79 //
80 class MEDIA_EXPORT WASAPIUnifiedStream 80 class MEDIA_EXPORT WASAPIUnifiedStream
81 : public AudioOutputStream, 81 : public AudioOutputStream,
82 public base::DelegateSimpleThread::Delegate { 82 public base::DelegateSimpleThread::Delegate {
83 public: 83 public:
84 // The ctor takes all the usual parameters, plus |manager| which is the 84 // The ctor takes all the usual parameters, plus |manager| which is the
85 // the audio manager who is creating this object. 85 // the audio manager who is creating this object.
86 WASAPIUnifiedStream(AudioManagerWin* manager, 86 WASAPIUnifiedStream(AudioManagerWin* manager,
87 const AudioParameters& params); 87 const AudioParameters& params,
88 const std::string& input_device_id);
88 89
89 // The dtor is typically called by the AudioManager only and it is usually 90 // The dtor is typically called by the AudioManager only and it is usually
90 // triggered by calling AudioOutputStream::Close(). 91 // triggered by calling AudioOutputStream::Close().
91 virtual ~WASAPIUnifiedStream(); 92 virtual ~WASAPIUnifiedStream();
92 93
93 // Implementation of AudioOutputStream. 94 // Implementation of AudioOutputStream.
94 virtual bool Open() OVERRIDE; 95 virtual bool Open() OVERRIDE;
95 virtual void Start(AudioSourceCallback* callback) OVERRIDE; 96 virtual void Start(AudioSourceCallback* callback) OVERRIDE;
96 virtual void Stop() OVERRIDE; 97 virtual void Stop() OVERRIDE;
97 virtual void Close() OVERRIDE; 98 virtual void Close() OVERRIDE;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 177
177 // Our creator, the audio manager needs to be notified when we close. 178 // Our creator, the audio manager needs to be notified when we close.
178 AudioManagerWin* manager_; 179 AudioManagerWin* manager_;
179 180
180 // Contains the audio parameter structure provided at construction. 181 // Contains the audio parameter structure provided at construction.
181 AudioParameters params_; 182 AudioParameters params_;
182 // For convenience, same as in params_. 183 // For convenience, same as in params_.
183 int input_channels_; 184 int input_channels_;
184 int output_channels_; 185 int output_channels_;
185 186
187 // Unique ID of the input device to be opened.
188 const std::string input_device_id_;
189
186 // The sharing mode for the streams. 190 // The sharing mode for the streams.
187 // Valid values are AUDCLNT_SHAREMODE_SHARED and AUDCLNT_SHAREMODE_EXCLUSIVE 191 // Valid values are AUDCLNT_SHAREMODE_SHARED and AUDCLNT_SHAREMODE_EXCLUSIVE
188 // where AUDCLNT_SHAREMODE_SHARED is the default. 192 // where AUDCLNT_SHAREMODE_SHARED is the default.
189 AUDCLNT_SHAREMODE share_mode_; 193 AUDCLNT_SHAREMODE share_mode_;
190 194
191 // Rendering and capturing is driven by this thread (no message loop). 195 // Rendering and capturing is driven by this thread (no message loop).
192 // All OnMoreIOData() callbacks will be called from this thread. 196 // All OnMoreIOData() callbacks will be called from this thread.
193 scoped_ptr<base::DelegateSimpleThread> audio_io_thread_; 197 scoped_ptr<base::DelegateSimpleThread> audio_io_thread_;
194 198
195 // Contains the desired audio output format which is set up at construction. 199 // Contains the desired audio output format which is set up at construction.
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 FILE* data_file_; 343 FILE* data_file_;
340 FILE* param_file_; 344 FILE* param_file_;
341 #endif 345 #endif
342 346
343 DISALLOW_COPY_AND_ASSIGN(WASAPIUnifiedStream); 347 DISALLOW_COPY_AND_ASSIGN(WASAPIUnifiedStream);
344 }; 348 };
345 349
346 } // namespace media 350 } // namespace media
347 351
348 #endif // MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_ 352 #endif // MEDIA_AUDIO_WIN_AUDIO_UNIFIED_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698