| 623 | |
| 624 | template <typename T> |
| 625 | void 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); |
nothing calls this directly
no test coverage detected