| 208 | } |
| 209 | |
| 210 | bool ProcessorChain::initPluginInstance(Processor* proc, const String& layout, String& err) { |
| 211 | traceScope(); |
| 212 | if (!setProcessorBusesLayout(proc, layout)) { |
| 213 | err = "failed to find a working I/O configuration"; |
| 214 | return false; |
| 215 | } |
| 216 | AudioProcessor::ProcessingPrecision prec = AudioProcessor::singlePrecision; |
| 217 | if (isUsingDoublePrecision() && supportsDoublePrecisionProcessing()) { |
| 218 | if (proc->supportsDoublePrecisionProcessing()) { |
| 219 | prec = AudioProcessor::doublePrecision; |
| 220 | } else { |
| 221 | logln("host wants double precission but plugin '" << proc->getName() << "' does not support it"); |
| 222 | } |
| 223 | } |
| 224 | proc->setProcessingPrecision(prec); |
| 225 | proc->prepareToPlay(getSampleRate(), getBlockSize()); |
| 226 | proc->enableAllBuses(); |
| 227 | AudioPlayHead::PositionInfo posInfo; |
| 228 | posInfo.setTimeInSamples(makeOptional(0)); |
| 229 | posInfo.setTimeInSeconds(makeOptional(0.0)); |
| 230 | posInfo.setBpm(makeOptional(120.0)); |
| 231 | ProcessorChain::PlayHead pHead(&posInfo); |
| 232 | // set a temporary playhead just for preProcessBlocks |
| 233 | proc->setPlayHead(&pHead); |
| 234 | // process some samples now, as some plugins might update their latency only then |
| 235 | if (prec == AudioProcessor::doublePrecision) { |
| 236 | preProcessBlocks<double>(proc); |
| 237 | } else { |
| 238 | preProcessBlocks<float>(proc); |
| 239 | } |
| 240 | // set the audio workers playhead |
| 241 | proc->setPlayHead(getPlayHead()); |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | bool ProcessorChain::addPluginProcessor(const String& id, const String& settings, const String& layout, |
| 246 | uint64 monoChannels, String& err) { |
no test coverage detected