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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 } | 77 } |
78 | 78 |
79 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination,
size_t framesToProcess) | 79 void WaveShaperProcessor::process(const AudioBus* source, AudioBus* destination,
size_t framesToProcess) |
80 { | 80 { |
81 if (!isInitialized()) { | 81 if (!isInitialized()) { |
82 destination->zero(); | 82 destination->zero(); |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 bool channelCountMatches = source->numberOfChannels() == destination->number
OfChannels() && source->numberOfChannels() == m_kernels.size(); | 86 bool channelCountMatches = source->numberOfChannels() == destination->number
OfChannels() && source->numberOfChannels() == m_kernels.size(); |
87 ASSERT(channelCountMatches); | 87 DCHECK(channelCountMatches); |
88 if (!channelCountMatches) | 88 if (!channelCountMatches) |
89 return; | 89 return; |
90 | 90 |
91 // The audio thread can't block on this lock, so we call tryLock() instead. | 91 // The audio thread can't block on this lock, so we call tryLock() instead. |
92 MutexTryLocker tryLocker(m_processLock); | 92 MutexTryLocker tryLocker(m_processLock); |
93 if (tryLocker.locked()) { | 93 if (tryLocker.locked()) { |
94 // For each channel of our input, process using the corresponding WaveSh
aperDSPKernel into the output channel. | 94 // For each channel of our input, process using the corresponding WaveSh
aperDSPKernel into the output channel. |
95 for (unsigned i = 0; i < m_kernels.size(); ++i) | 95 for (unsigned i = 0; i < m_kernels.size(); ++i) |
96 m_kernels[i]->process(source->channel(i)->data(), destination->chann
el(i)->mutableData(), framesToProcess); | 96 m_kernels[i]->process(source->channel(i)->data(), destination->chann
el(i)->mutableData(), framesToProcess); |
97 } else { | 97 } else { |
98 // Too bad - the tryLock() failed. We must be in the middle of a setCurv
e() call. | 98 // Too bad - the tryLock() failed. We must be in the middle of a setCurv
e() call. |
99 destination->zero(); | 99 destination->zero(); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 } // namespace blink | 103 } // namespace blink |
104 | 104 |
OLD | NEW |