diff --git a/lib/audiodev/ALSA.cpp b/lib/audiodev/ALSA.cpp index 1c8bb3a..b22be5d 100644 --- a/lib/audiodev/ALSA.cpp +++ b/lib/audiodev/ALSA.cpp @@ -352,9 +352,7 @@ struct ALSAAudioVoiceEngine : LinuxMidi m_mixInfo.m_channelMap.m_channelCount = 2; m_mixInfo.m_channelMap.m_channels[0] = AudioChannel::FrontLeft; m_mixInfo.m_channelMap.m_channels[1] = AudioChannel::FrontRight; - if (m_finalFlt.size() < m_5msFrames * 2) - m_finalFlt.resize(m_5msFrames * 2); - _pumpAndMixVoices(m_5msFrames, m_finalFlt.data()); + _pumpAndMixVoices(m_5msFrames, (float*)nullptr); return; } diff --git a/lib/audiodev/AudioVoiceEngine.cpp b/lib/audiodev/AudioVoiceEngine.cpp index 6ddf842..47e7923 100644 --- a/lib/audiodev/AudioVoiceEngine.cpp +++ b/lib/audiodev/AudioVoiceEngine.cpp @@ -14,7 +14,9 @@ BaseAudioVoiceEngine::~BaseAudioVoiceEngine() template void BaseAudioVoiceEngine::_pumpAndMixVoices(size_t frames, T* dataOut) { - memset(dataOut, 0, sizeof(T) * frames * m_mixInfo.m_channelMap.m_channelCount); + if (dataOut) + memset(dataOut, 0, sizeof(T) * frames * m_mixInfo.m_channelMap.m_channelCount); + if (m_ltRtProcessing) { size_t sampleCount = m_5msFrames * 5; @@ -64,6 +66,10 @@ void BaseAudioVoiceEngine::_pumpAndMixVoices(size_t frames, T* dataOut) for (auto it = m_linearizedSubmixes.rbegin() ; it != m_linearizedSubmixes.rend() ; ++it) (*it)->_pumpAndMix(thisFrames); + remFrames -= thisFrames; + if (!dataOut) + continue; + if (m_ltRtProcessing) { m_ltRtProcessing->Process(_getLtRtIn().data(), dataOut, int(thisFrames)); @@ -74,7 +80,6 @@ void BaseAudioVoiceEngine::_pumpAndMixVoices(size_t frames, T* dataOut) for (size_t i=0 ; i_parseAudioChannelSet(&i->channel_map); } - std::vector m_finalFlt; - void pumpAndMixVoices() { if (!m_stream) @@ -302,9 +298,7 @@ struct PulseAudioVoiceEngine : LinuxMidi m_mixInfo.m_channelMap.m_channelCount = 2; m_mixInfo.m_channelMap.m_channels[0] = AudioChannel::FrontLeft; m_mixInfo.m_channelMap.m_channels[1] = AudioChannel::FrontRight; - if (m_finalFlt.size() < m_5msFrames * 2) - m_finalFlt.resize(m_5msFrames * 2); - _pumpAndMixVoices(m_5msFrames, m_finalFlt.data()); + _pumpAndMixVoices(m_5msFrames, (float*)nullptr); return; } @@ -334,8 +328,7 @@ struct PulseAudioVoiceEngine : LinuxMidi writablePeriods = nbytes / periodSz; size_t periodSamples = m_mixInfo.m_periodFrames * m_mixInfo.m_channelMap.m_channelCount; - for (int p=0 ; p(data) + p * periodSamples); + _pumpAndMixVoices(m_mixInfo.m_periodFrames * writablePeriods, reinterpret_cast(data)); if (pa_stream_write(m_stream, data, nbytes, nullptr, 0, PA_SEEK_RELATIVE)) Log.report(logvisor::Error, "Unable to pa_stream_write()"); diff --git a/logvisor b/logvisor index 073cf14..2352699 160000 --- a/logvisor +++ b/logvisor @@ -1 +1 @@ -Subproject commit 073cf1473bde254516f7637fcb787478aab47d6c +Subproject commit 2352699c6598866548b81c3886337b4a8bb91472