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

Side by Side Diff: third_party/WebKit/Source/platform/audio/DynamicsCompressorKernel.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) 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 * 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 m_meteringReleaseK = static_cast<float>(discreteTimeConstantForSampleRate( 66 m_meteringReleaseK = static_cast<float>(discreteTimeConstantForSampleRate(
67 meteringReleaseTimeConstant, sampleRate)); 67 meteringReleaseTimeConstant, sampleRate));
68 } 68 }
69 69
70 void DynamicsCompressorKernel::setNumberOfChannels(unsigned numberOfChannels) { 70 void DynamicsCompressorKernel::setNumberOfChannels(unsigned numberOfChannels) {
71 if (m_preDelayBuffers.size() == numberOfChannels) 71 if (m_preDelayBuffers.size() == numberOfChannels)
72 return; 72 return;
73 73
74 m_preDelayBuffers.clear(); 74 m_preDelayBuffers.clear();
75 for (unsigned i = 0; i < numberOfChannels; ++i) 75 for (unsigned i = 0; i < numberOfChannels; ++i)
76 m_preDelayBuffers.append( 76 m_preDelayBuffers.append(makeUnique<AudioFloatArray>(MaxPreDelayFrames));
77 wrapUnique(new AudioFloatArray(MaxPreDelayFrames)));
78 } 77 }
79 78
80 void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime) { 79 void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime) {
81 // Re-configure look-ahead section pre-delay if delay time has changed. 80 // Re-configure look-ahead section pre-delay if delay time has changed.
82 unsigned preDelayFrames = preDelayTime * sampleRate(); 81 unsigned preDelayFrames = preDelayTime * sampleRate();
83 if (preDelayFrames > MaxPreDelayFrames - 1) 82 if (preDelayFrames > MaxPreDelayFrames - 1)
84 preDelayFrames = MaxPreDelayFrames - 1; 83 preDelayFrames = MaxPreDelayFrames - 1;
85 84
86 if (m_lastPreDelayFrames != preDelayFrames) { 85 if (m_lastPreDelayFrames != preDelayFrames) {
87 m_lastPreDelayFrames = preDelayFrames; 86 m_lastPreDelayFrames = preDelayFrames;
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 for (unsigned i = 0; i < m_preDelayBuffers.size(); ++i) 479 for (unsigned i = 0; i < m_preDelayBuffers.size(); ++i)
481 m_preDelayBuffers[i]->zero(); 480 m_preDelayBuffers[i]->zero();
482 481
483 m_preDelayReadIndex = 0; 482 m_preDelayReadIndex = 0;
484 m_preDelayWriteIndex = DefaultPreDelayFrames; 483 m_preDelayWriteIndex = DefaultPreDelayFrames;
485 484
486 m_maxAttackCompressionDiffDb = -1; // uninitialized state 485 m_maxAttackCompressionDiffDb = -1; // uninitialized state
487 } 486 }
488 487
489 } // namespace blink 488 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698