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

Side by Side Diff: webkit/glue/webaudiodevice_impl.cc

Issue 6002005: Implement renderer AudioDevice API for low-latency audio output... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "webkit/glue/webaudiodevice_impl.h"
6
7 using WebKit::WebAudioDevice;
8 using WebKit::WebVector;
9
10 namespace webkit_glue {
11
12 WebAudioDeviceImpl::WebAudioDeviceImpl(size_t buffer_size,
13 int channels,
14 double sample_rate,
15 WebAudioDevice::RenderCallback* callback)
16 : audio_device_(buffer_size, channels, sample_rate, this),
17 client_callback_(callback) {
18 }
19
20 WebAudioDeviceImpl::~WebAudioDeviceImpl() {
21 stop();
22 }
23
24 void WebAudioDeviceImpl::start() {
25 audio_device_.Start();
26 }
27
28 void WebAudioDeviceImpl::stop() {
29 audio_device_.Stop();
30 }
31
32 void WebAudioDeviceImpl::Render(const std::vector<float*>& audio_data,
33 size_t number_of_frames) {
34 // Make the client callback to get rendered audio.
35 DCHECK(client_callback_);
36 if (client_callback_) {
37 // Wrap the pointers using WebVector.
38 WebVector<float*> web_audio_data(audio_data.size());
39 for (size_t i = 0; i < audio_data.size(); ++i)
40 web_audio_data[i] = audio_data[i];
41
42 client_callback_->render(web_audio_data, number_of_frames);
43 }
44 }
45
46 } // namespace webkit_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698