MCPcopy Create free account
hub / github.com/apohl79/audiogridder / initPluginInstance

Method initPluginInstance

Server/Source/ProcessorChain.cpp:210–243  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210bool 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
245bool ProcessorChain::addPluginProcessor(const String& id, const String& settings, const String& layout,
246 uint64 monoChannels, String& err) {

Callers 1

loadMethod · 0.80

Calls 7

getSampleRateFunction · 0.85
enableAllBusesMethod · 0.80
getNameMethod · 0.45
prepareToPlayMethod · 0.45
setPlayHeadMethod · 0.45

Tested by

no test coverage detected