///////////////////////////////////////////////////////
| 206 | |
| 207 | //////////////////////////////////////////////////////////// |
| 208 | void MiniaudioUtils::SoundBase::processEffect(const float** framesIn, |
| 209 | std::uint32_t& frameCountIn, |
| 210 | float** framesOut, |
| 211 | std::uint32_t& frameCountOut) const |
| 212 | { |
| 213 | // If a processor is set, call it |
| 214 | if (effectProcessor) |
| 215 | { |
| 216 | if (!framesIn) |
| 217 | frameCountIn = 0; |
| 218 | |
| 219 | effectProcessor(framesIn ? framesIn[0] : nullptr, frameCountIn, framesOut[0], frameCountOut, effectNode.channelCount); |
| 220 | return; |
| 221 | } |
| 222 | |
| 223 | // Otherwise just pass the data through 1:1 |
| 224 | if (framesIn == nullptr) |
| 225 | { |
| 226 | frameCountIn = 0; |
| 227 | frameCountOut = 0; |
| 228 | return; |
| 229 | } |
| 230 | |
| 231 | const auto toProcess = std::min(frameCountIn, frameCountOut); |
| 232 | std::memcpy(framesOut[0], framesIn[0], toProcess * effectNode.channelCount * sizeof(float)); |
| 233 | frameCountIn = toProcess; |
| 234 | frameCountOut = toProcess; |
| 235 | } |
| 236 | |
| 237 | |
| 238 | //////////////////////////////////////////////////////////// |