OLD | NEW |
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 * 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 27 matching lines...) Expand all Loading... |
38 : AudioDSPKernel(processor), | 38 : AudioDSPKernel(processor), |
39 m_writeIndex(0), | 39 m_writeIndex(0), |
40 m_firstTime(true), | 40 m_firstTime(true), |
41 m_delayTimes(processingSizeInFrames) {} | 41 m_delayTimes(processingSizeInFrames) {} |
42 | 42 |
43 AudioDelayDSPKernel::AudioDelayDSPKernel(double maxDelayTime, float sampleRate) | 43 AudioDelayDSPKernel::AudioDelayDSPKernel(double maxDelayTime, float sampleRate) |
44 : AudioDSPKernel(sampleRate), | 44 : AudioDSPKernel(sampleRate), |
45 m_maxDelayTime(maxDelayTime), | 45 m_maxDelayTime(maxDelayTime), |
46 m_writeIndex(0), | 46 m_writeIndex(0), |
47 m_firstTime(true) { | 47 m_firstTime(true) { |
48 ASSERT(maxDelayTime > 0.0 && !std::isnan(maxDelayTime)); | 48 DCHECK_GT(maxDelayTime, 0.0); |
| 49 DCHECK(!std::isnan(maxDelayTime)); |
49 if (maxDelayTime <= 0.0 || std::isnan(maxDelayTime)) | 50 if (maxDelayTime <= 0.0 || std::isnan(maxDelayTime)) |
50 return; | 51 return; |
51 | 52 |
52 size_t bufferLength = bufferLengthForDelay(maxDelayTime, sampleRate); | 53 size_t bufferLength = bufferLengthForDelay(maxDelayTime, sampleRate); |
53 DCHECK(bufferLength); | 54 DCHECK(bufferLength); |
54 if (!bufferLength) | 55 if (!bufferLength) |
55 return; | 56 return; |
56 | 57 |
57 m_buffer.allocate(bufferLength); | 58 m_buffer.allocate(bufferLength); |
58 m_buffer.zero(); | 59 m_buffer.zero(); |
(...skipping 25 matching lines...) Expand all Loading... |
84 void AudioDelayDSPKernel::process(const float* source, | 85 void AudioDelayDSPKernel::process(const float* source, |
85 float* destination, | 86 float* destination, |
86 size_t framesToProcess) { | 87 size_t framesToProcess) { |
87 size_t bufferLength = m_buffer.size(); | 88 size_t bufferLength = m_buffer.size(); |
88 float* buffer = m_buffer.data(); | 89 float* buffer = m_buffer.data(); |
89 | 90 |
90 DCHECK(bufferLength); | 91 DCHECK(bufferLength); |
91 if (!bufferLength) | 92 if (!bufferLength) |
92 return; | 93 return; |
93 | 94 |
94 ASSERT(source && destination); | 95 DCHECK(source); |
| 96 DCHECK(destination); |
95 if (!source || !destination) | 97 if (!source || !destination) |
96 return; | 98 return; |
97 | 99 |
98 float sampleRate = this->sampleRate(); | 100 float sampleRate = this->sampleRate(); |
99 double delayTime = 0; | 101 double delayTime = 0; |
100 float* delayTimes = m_delayTimes.data(); | 102 float* delayTimes = m_delayTimes.data(); |
101 double maxTime = maxDelayTime(); | 103 double maxTime = maxDelayTime(); |
102 | 104 |
103 bool sampleAccurate = hasSampleAccurateValues(); | 105 bool sampleAccurate = hasSampleAccurateValues(); |
104 | 106 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Account for worst case delay. | 165 // Account for worst case delay. |
164 // Don't try to track actual delay time which can change dynamically. | 166 // Don't try to track actual delay time which can change dynamically. |
165 return m_maxDelayTime; | 167 return m_maxDelayTime; |
166 } | 168 } |
167 | 169 |
168 double AudioDelayDSPKernel::latencyTime() const { | 170 double AudioDelayDSPKernel::latencyTime() const { |
169 return 0; | 171 return 0; |
170 } | 172 } |
171 | 173 |
172 } // namespace blink | 174 } // namespace blink |
OLD | NEW |