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

Side by Side Diff: Source/modules/webaudio/OfflineAudioDestinationNode.cpp

Issue 363613003: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
« no previous file with comments | « Source/modules/webaudio/DelayDSPKernel.cpp ('k') | Source/modules/webaudio/OscillatorNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 18 matching lines...) Expand all
29 #include "modules/webaudio/OfflineAudioDestinationNode.h" 29 #include "modules/webaudio/OfflineAudioDestinationNode.h"
30 30
31 #include <algorithm> 31 #include <algorithm>
32 #include "platform/audio/AudioBus.h" 32 #include "platform/audio/AudioBus.h"
33 #include "platform/audio/HRTFDatabaseLoader.h" 33 #include "platform/audio/HRTFDatabaseLoader.h"
34 #include "modules/webaudio/AudioContext.h" 34 #include "modules/webaudio/AudioContext.h"
35 #include "platform/Task.h" 35 #include "platform/Task.h"
36 #include "public/platform/Platform.h" 36 #include "public/platform/Platform.h"
37 #include "wtf/MainThread.h" 37 #include "wtf/MainThread.h"
38 38
39 using namespace std;
40
41 namespace WebCore { 39 namespace WebCore {
42 40
43 const size_t renderQuantumSize = 128; 41 const size_t renderQuantumSize = 128;
44 42
45 OfflineAudioDestinationNode::OfflineAudioDestinationNode(AudioContext* context, AudioBuffer* renderTarget) 43 OfflineAudioDestinationNode::OfflineAudioDestinationNode(AudioContext* context, AudioBuffer* renderTarget)
46 : AudioDestinationNode(context, renderTarget->sampleRate()) 44 : AudioDestinationNode(context, renderTarget->sampleRate())
47 , m_renderTarget(renderTarget) 45 , m_renderTarget(renderTarget)
48 , m_startedRendering(false) 46 , m_startedRendering(false)
49 { 47 {
50 m_renderBus = AudioBus::create(renderTarget->numberOfChannels(), renderQuant umSize); 48 m_renderBus = AudioBus::create(renderTarget->numberOfChannels(), renderQuant umSize);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Break up the render target into smaller "render quantize" sized pieces. 112 // Break up the render target into smaller "render quantize" sized pieces.
115 // Render until we're finished. 113 // Render until we're finished.
116 size_t framesToProcess = m_renderTarget->length(); 114 size_t framesToProcess = m_renderTarget->length();
117 unsigned numberOfChannels = m_renderTarget->numberOfChannels(); 115 unsigned numberOfChannels = m_renderTarget->numberOfChannels();
118 116
119 unsigned n = 0; 117 unsigned n = 0;
120 while (framesToProcess > 0) { 118 while (framesToProcess > 0) {
121 // Render one render quantum. 119 // Render one render quantum.
122 render(0, m_renderBus.get(), renderQuantumSize); 120 render(0, m_renderBus.get(), renderQuantumSize);
123 121
124 size_t framesAvailableToCopy = min(framesToProcess, renderQuantumSize); 122 size_t framesAvailableToCopy = std::min(framesToProcess, renderQuantumSi ze);
125 123
126 for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++chann elIndex) { 124 for (unsigned channelIndex = 0; channelIndex < numberOfChannels; ++chann elIndex) {
127 const float* source = m_renderBus->channel(channelIndex)->data(); 125 const float* source = m_renderBus->channel(channelIndex)->data();
128 float* destination = m_renderTarget->getChannelData(channelIndex)->d ata(); 126 float* destination = m_renderTarget->getChannelData(channelIndex)->d ata();
129 memcpy(destination + n, source, sizeof(float) * framesAvailableToCop y); 127 memcpy(destination + n, source, sizeof(float) * framesAvailableToCop y);
130 } 128 }
131 129
132 n += framesAvailableToCopy; 130 n += framesAvailableToCopy;
133 framesToProcess -= framesAvailableToCopy; 131 framesToProcess -= framesAvailableToCopy;
134 } 132 }
(...skipping 20 matching lines...) Expand all
155 153
156 void OfflineAudioDestinationNode::trace(Visitor* visitor) 154 void OfflineAudioDestinationNode::trace(Visitor* visitor)
157 { 155 {
158 visitor->trace(m_renderTarget); 156 visitor->trace(m_renderTarget);
159 AudioDestinationNode::trace(visitor); 157 AudioDestinationNode::trace(visitor);
160 } 158 }
161 159
162 } // namespace WebCore 160 } // namespace WebCore
163 161
164 #endif // ENABLE(WEB_AUDIO) 162 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/DelayDSPKernel.cpp ('k') | Source/modules/webaudio/OscillatorNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698