OLD | NEW |
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 23 matching lines...) Expand all Loading... |
34 size_t numberOfChannels) | 34 size_t numberOfChannels) |
35 : AudioDSPKernelProcessor(sampleRate, numberOfChannels), | 35 : AudioDSPKernelProcessor(sampleRate, numberOfChannels), |
36 m_oversample(OverSampleNone) {} | 36 m_oversample(OverSampleNone) {} |
37 | 37 |
38 WaveShaperProcessor::~WaveShaperProcessor() { | 38 WaveShaperProcessor::~WaveShaperProcessor() { |
39 if (isInitialized()) | 39 if (isInitialized()) |
40 uninitialize(); | 40 uninitialize(); |
41 } | 41 } |
42 | 42 |
43 std::unique_ptr<AudioDSPKernel> WaveShaperProcessor::createKernel() { | 43 std::unique_ptr<AudioDSPKernel> WaveShaperProcessor::createKernel() { |
44 return makeUnique<WaveShaperDSPKernel>(this); | 44 return WTF::makeUnique<WaveShaperDSPKernel>(this); |
45 } | 45 } |
46 | 46 |
47 void WaveShaperProcessor::setCurve(const float* curveData, | 47 void WaveShaperProcessor::setCurve(const float* curveData, |
48 unsigned curveLength) { | 48 unsigned curveLength) { |
49 DCHECK(isMainThread()); | 49 DCHECK(isMainThread()); |
50 | 50 |
51 // This synchronizes with process(). | 51 // This synchronizes with process(). |
52 MutexLocker processLocker(m_processLock); | 52 MutexLocker processLocker(m_processLock); |
53 | 53 |
54 if (curveLength == 0 || !curveData) { | 54 if (curveLength == 0 || !curveData) { |
55 m_curve = nullptr; | 55 m_curve = nullptr; |
56 return; | 56 return; |
57 } | 57 } |
58 | 58 |
59 // Copy the curve data, if any, to our internal buffer. | 59 // Copy the curve data, if any, to our internal buffer. |
60 m_curve = makeUnique<Vector<float>>(curveLength); | 60 m_curve = WTF::makeUnique<Vector<float>>(curveLength); |
61 memcpy(m_curve->data(), curveData, sizeof(float) * curveLength); | 61 memcpy(m_curve->data(), curveData, sizeof(float) * curveLength); |
62 } | 62 } |
63 | 63 |
64 void WaveShaperProcessor::setOversample(OverSampleType oversample) { | 64 void WaveShaperProcessor::setOversample(OverSampleType oversample) { |
65 // This synchronizes with process(). | 65 // This synchronizes with process(). |
66 MutexLocker processLocker(m_processLock); | 66 MutexLocker processLocker(m_processLock); |
67 | 67 |
68 m_oversample = oversample; | 68 m_oversample = oversample; |
69 | 69 |
70 if (oversample != OverSampleNone) { | 70 if (oversample != OverSampleNone) { |
(...skipping 30 matching lines...) Expand all Loading... |
101 destination->channel(i)->mutableData(), | 101 destination->channel(i)->mutableData(), |
102 framesToProcess); | 102 framesToProcess); |
103 } else { | 103 } else { |
104 // Too bad - the tryLock() failed. We must be in the middle of a setCurve() | 104 // Too bad - the tryLock() failed. We must be in the middle of a setCurve() |
105 // call. | 105 // call. |
106 destination->zero(); | 106 destination->zero(); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace blink | 110 } // namespace blink |
OLD | NEW |