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

Method processBlockInternal

Server/Source/ProcessorClient.cpp:625–685  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

623
624template <typename T>
625void ProcessorClient::processBlockInternal(AudioBuffer<T>& buffer, MidiBuffer& midiMessages) {
626 traceScope();
627
628 AudioPlayHead::PositionInfo posInfo;
629 if (nullptr != m_playhead) {
630 if (auto optPosInfo = m_playhead->getPosition()) {
631 posInfo = *optPosInfo;
632 }
633 }
634
635 int sendBufChannels = m_activeChannels.getNumActiveChannelsCombined();
636 AudioBuffer<T>* sendBuffer;
637 std::unique_ptr<AudioBuffer<T>> tmpBuffer;
638
639 if (sendBufChannels != buffer.getNumChannels()) {
640 tmpBuffer = std::make_unique<AudioBuffer<T>>(sendBufChannels, buffer.getNumSamples());
641 sendBuffer = tmpBuffer.get();
642 } else {
643 sendBuffer = &buffer;
644 }
645
646 MessageHelper::Error e;
647 AudioMessage msg(this);
648
649 TimeTrace::addTracePoint("pc_prep_buffer");
650
651 m_channelMapper.map(&buffer, sendBuffer);
652 TimeTrace::addTracePoint("pc_ch_map");
653
654 {
655 std::lock_guard<std::mutex> lock(m_audioMtx);
656
657 if (nullptr != m_sockAudio) {
658 TimeTrace::addTracePoint("pc_lock");
659
660 if (!msg.sendToServer(m_sockAudio.get(), *sendBuffer, midiMessages, posInfo, sendBuffer->getNumChannels(),
661 sendBuffer->getNumSamples(), &e, *m_bytesOutMeter)) {
662 logln("error while sending audio message to sandbox: " << e.toString());
663 m_sockAudio->close();
664 return;
665 }
666
667 TimeTrace::addTracePoint("pc_send");
668
669 if (!msg.readFromServer(m_sockAudio.get(), *sendBuffer, midiMessages, &e, *m_bytesInMeter)) {
670 logln("error while reading audio message from sandbox: " << e.toString());
671 m_sockAudio->close();
672 return;
673 }
674
675 TimeTrace::addTracePoint("pc_read");
676 } else {
677 logln("error while sending audio message: no socket");
678 return;
679 }
680 }
681
682 m_channelMapper.mapReverse(sendBuffer, &buffer);

Callers

nothing calls this directly

Calls 11

getNumSamplesMethod · 0.80
mapMethod · 0.80
sendToServerMethod · 0.80
readFromServerMethod · 0.80
mapReverseMethod · 0.80
getPositionMethod · 0.45
getNumChannelsMethod · 0.45
getMethod · 0.45
toStringMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected