From 0f86c8de20fbcd7ee79155f655b2e91981ba53f6 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 15 Dec 2020 15:31:49 -0500 Subject: [PATCH] cwAudioBuf.cpp : Fixed bug in report() that prevented all channels from being reported. --- cwAudioBuf.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cwAudioBuf.cpp b/cwAudioBuf.cpp index 8f4458c..d8fde8e 100644 --- a/cwAudioBuf.cpp +++ b/cwAudioBuf.cpp @@ -849,9 +849,15 @@ void cw::audio::buf::inputToOutput( handle_t h, unsigned iDevIdx, unsigned oDevI unsigned iChCnt = channelCount( h, iDevIdx, kInFl ); unsigned oChCnt = channelCount( h, oDevIdx, kOutFl ); unsigned chCnt = iChCnt < oChCnt ? iChCnt : oChCnt; - unsigned i; + if( chCnt == 0 ) + { + cwLogWarning("Both input and output devices must have a non-zero channel count in the call to audio::buf::inputToOutput()."); + return; + } + + sample_t* iBufPtrArray[ iChCnt ]; sample_t* oBufPtrArray[ oChCnt ]; @@ -905,7 +911,7 @@ void cw::audio::buf::report(handle_t h) sample_t m = 0; for(k=0; kchCnt; ++k) { - cmApCh* cp = ip->chArray + i; + cmApCh* cp = ip->chArray + k; ii += cp->ii; oi += cp->oi; fn += cp->fn;