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