| 89 | } |
| 90 | |
| 91 | void WaveShaperNode::process(ContextRenderLock & r, int bufferSize) |
| 92 | { |
| 93 | if (m_newCurve) |
| 94 | { |
| 95 | // @TODO mutex |
| 96 | std::vector<float>* x = nullptr; |
| 97 | std::swap(x, m_newCurve); |
| 98 | m_curve = *x; |
| 99 | delete x; |
| 100 | } |
| 101 | |
| 102 | AudioBus* destinationBus = output(0)->bus(r); |
| 103 | if (!isInitialized() || !m_curve.size()) |
| 104 | { |
| 105 | destinationBus->zero(); |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | AudioBus* sourceBus = input(0)->bus(r); |
| 110 | if (!input(0)->isConnected()) |
| 111 | { |
| 112 | destinationBus->zero(); |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | int srcChannelCount = sourceBus->numberOfChannels(); |
| 117 | int dstChannelCount = destinationBus->numberOfChannels(); |
| 118 | if (srcChannelCount != dstChannelCount) |
| 119 | { |
| 120 | output(0)->setNumberOfChannels(r, srcChannelCount); |
| 121 | destinationBus = output(0)->bus(r); |
| 122 | } |
| 123 | |
| 124 | for (int i = 0; i < srcChannelCount; ++i) |
| 125 | { |
| 126 | processBuffer(r, sourceBus->channel(i)->data(), destinationBus->channel(i)->mutableData(), bufferSize); |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | } // namespace lab |
nothing calls this directly
no test coverage detected