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

Method processBlockInternal

Server/Source/Processor.cpp:555–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

553
554template <typename T>
555bool Processor::processBlockInternal(AudioBuffer<T>& buffer, MidiBuffer& midiMessages, int& latencySamples) {
556 traceScope();
557
558 traceln(" processor: isClient=" << (int)m_isClient << ", multiMono=" << (int)(m_channels > 1)
559 << ", latency=" << m_lastKnownLatency);
560 traceln(" buffer: channels=" << buffer.getNumChannels() << ", samples=" << buffer.getNumSamples());
561
562 auto fn = [&](auto p, int ch, bool isPlugin) {
563 TimeTrace::addTracePoint("proc_got_backend");
564 traceln(" processing ch " << ch << ": suspended=" << (int)p->isSuspended());
565 if (ch == 0) {
566 latencySamples = p->getLatencySamples();
567 updateLatencyBuffers(latencySamples);
568 }
569 if (!p->isSuspended()) {
570 if (isPlugin && m_channels > 1) {
571 // multi-mono
572 ScopedNoDenormals noDenormals;
573 AudioBuffer<T> chBuffer(buffer.getArrayOfWritePointers() + ch, 1, buffer.getNumSamples());
574 p->processBlock(chBuffer, midiMessages);
575 } else {
576 ScopedNoDenormals noDenormals;
577 p->processBlock(buffer, midiMessages);
578 }
579 TimeTrace::addTracePoint("proc_process_" + String(ch));
580 } else {
581 if (m_lastKnownLatency > 0) {
582 if (isPlugin && m_channels > 1) {
583 // multi-mono
584 AudioBuffer<T> chBuffer(buffer.getArrayOfWritePointers() + ch, 1, buffer.getNumSamples());
585 processBlockBypassedMultiMono(chBuffer, ch);
586 } else {
587 processBlockBypassed(buffer);
588 }
589 TimeTrace::addTracePoint("proc_process_bp_" + String(ch));
590 }
591 }
592 };
593
594 if (m_isClient) {
595 if (auto c = getClient()) {
596 fn(c, 0, false);
597 } else {
598 TimeTrace::addTracePoint("proc_no_client");
599 return false;
600 }
601 } else {
602 for (int ch = 0; ch < m_channels; ch++) {
603 if (auto p = getPlugin(ch)) {
604 fn(p, ch, true);
605 } else {
606 TimeTrace::addTracePoint("proc_no_plugin");
607 return false;
608 }
609 }
610 }
611
612 return true;

Callers

nothing calls this directly

Calls 5

getNumSamplesMethod · 0.80
getNumChannelsMethod · 0.45
isSuspendedMethod · 0.45
getLatencySamplesMethod · 0.45
processBlockMethod · 0.45

Tested by

no test coverage detected