| 36 | } |
| 37 | |
| 38 | void AudioDSPKernelProcessor::process(ContextRenderLock & r, const AudioBus * source, AudioBus * destination, int framesToProcess) |
| 39 | { |
| 40 | ASSERT(source && destination); |
| 41 | if (!source || !destination) |
| 42 | return; |
| 43 | |
| 44 | if (!isInitialized()) |
| 45 | { |
| 46 | destination->zero(); |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | size_t src_channels = source->numberOfChannels(); |
| 51 | size_t dst_channels = destination->numberOfChannels(); |
| 52 | size_t kernel_count = std::min(src_channels, dst_channels); |
| 53 | |
| 54 | if (m_kernels.size() != dst_channels) |
| 55 | { |
| 56 | m_kernels.clear(); |
| 57 | for (int i = 0; i < dst_channels; ++i) |
| 58 | m_kernels.push_back(std::unique_ptr<AudioDSPKernel>(createKernel())); |
| 59 | } |
| 60 | |
| 61 | bool channelCountMatches = source->numberOfChannels() == destination->numberOfChannels() && source->numberOfChannels() == m_kernels.size(); |
| 62 | ASSERT(channelCountMatches); |
| 63 | if (!channelCountMatches) |
| 64 | return; |
| 65 | |
| 66 | for (unsigned i = 0; i < m_kernels.size(); ++i) |
| 67 | m_kernels[i]->process(r, source->channel(i)->data(), |
| 68 | destination->channel(i)->mutableData(), framesToProcess); |
| 69 | } |
| 70 | |
| 71 | // Resets filter state |
| 72 | void AudioDSPKernelProcessor::reset() |
nothing calls this directly
no test coverage detected