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

Side by Side Diff: third_party/WebKit/Source/platform/audio/HRTFElevation.cpp

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 const String& subjectName, 254 const String& subjectName,
255 int elevation, 255 int elevation,
256 float sampleRate) { 256 float sampleRate) {
257 bool isElevationGood = 257 bool isElevationGood =
258 elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation; 258 elevation >= -45 && elevation <= 90 && (elevation / 15) * 15 == elevation;
259 ASSERT(isElevationGood); 259 ASSERT(isElevationGood);
260 if (!isElevationGood) 260 if (!isElevationGood)
261 return nullptr; 261 return nullptr;
262 262
263 std::unique_ptr<HRTFKernelList> kernelListL = 263 std::unique_ptr<HRTFKernelList> kernelListL =
264 wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); 264 makeUnique<HRTFKernelList>(NumberOfTotalAzimuths);
265 std::unique_ptr<HRTFKernelList> kernelListR = 265 std::unique_ptr<HRTFKernelList> kernelListR =
266 wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); 266 makeUnique<HRTFKernelList>(NumberOfTotalAzimuths);
267 267
268 // Load convolution kernels from HRTF files. 268 // Load convolution kernels from HRTF files.
269 int interpolatedIndex = 0; 269 int interpolatedIndex = 0;
270 for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) { 270 for (unsigned rawIndex = 0; rawIndex < NumberOfRawAzimuths; ++rawIndex) {
271 // Don't let elevation exceed maximum for this azimuth. 271 // Don't let elevation exceed maximum for this azimuth.
272 int maxElevation = maxElevations[rawIndex]; 272 int maxElevation = maxElevations[rawIndex];
273 int actualElevation = std::min(elevation, maxElevation); 273 int actualElevation = std::min(elevation, maxElevation);
274 274
275 bool success = calculateKernelsForAzimuthElevation( 275 bool success = calculateKernelsForAzimuthElevation(
276 rawIndex * AzimuthSpacing, actualElevation, sampleRate, subjectName, 276 rawIndex * AzimuthSpacing, actualElevation, sampleRate, subjectName,
(...skipping 30 matching lines...) Expand all
307 HRTFElevation* hrtfElevation2, 307 HRTFElevation* hrtfElevation2,
308 float x, 308 float x,
309 float sampleRate) { 309 float sampleRate) {
310 ASSERT(hrtfElevation1 && hrtfElevation2); 310 ASSERT(hrtfElevation1 && hrtfElevation2);
311 if (!hrtfElevation1 || !hrtfElevation2) 311 if (!hrtfElevation1 || !hrtfElevation2)
312 return nullptr; 312 return nullptr;
313 313
314 ASSERT(x >= 0.0 && x < 1.0); 314 ASSERT(x >= 0.0 && x < 1.0);
315 315
316 std::unique_ptr<HRTFKernelList> kernelListL = 316 std::unique_ptr<HRTFKernelList> kernelListL =
317 wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); 317 makeUnique<HRTFKernelList>(NumberOfTotalAzimuths);
318 std::unique_ptr<HRTFKernelList> kernelListR = 318 std::unique_ptr<HRTFKernelList> kernelListR =
319 wrapUnique(new HRTFKernelList(NumberOfTotalAzimuths)); 319 makeUnique<HRTFKernelList>(NumberOfTotalAzimuths);
320 320
321 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL(); 321 HRTFKernelList* kernelListL1 = hrtfElevation1->kernelListL();
322 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR(); 322 HRTFKernelList* kernelListR1 = hrtfElevation1->kernelListR();
323 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL(); 323 HRTFKernelList* kernelListL2 = hrtfElevation2->kernelListL();
324 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR(); 324 HRTFKernelList* kernelListR2 = hrtfElevation2->kernelListR();
325 325
326 // Interpolate kernels of corresponding azimuths of the two elevations. 326 // Interpolate kernels of corresponding azimuths of the two elevations.
327 for (unsigned i = 0; i < NumberOfTotalAzimuths; ++i) { 327 for (unsigned i = 0; i < NumberOfTotalAzimuths; ++i) {
328 (*kernelListL)[i] = HRTFKernel::createInterpolatedKernel( 328 (*kernelListL)[i] = HRTFKernel::createInterpolatedKernel(
329 kernelListL1->at(i).get(), kernelListL2->at(i).get(), x); 329 kernelListL1->at(i).get(), kernelListL2->at(i).get(), x);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay(); 374 double frameDelay2R = m_kernelListR->at(azimuthIndex2)->frameDelay();
375 375
376 // Linearly interpolate delays. 376 // Linearly interpolate delays.
377 frameDelayL = 377 frameDelayL =
378 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L; 378 (1.0 - azimuthBlend) * frameDelayL + azimuthBlend * frameDelay2L;
379 frameDelayR = 379 frameDelayR =
380 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R; 380 (1.0 - azimuthBlend) * frameDelayR + azimuthBlend * frameDelay2R;
381 } 381 }
382 382
383 } // namespace blink 383 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698