diff --git a/cwAudioBuf.cpp b/cwAudioBuf.cpp index 45ebdb7..e8dfdee 100644 --- a/cwAudioBuf.cpp +++ b/cwAudioBuf.cpp @@ -657,7 +657,25 @@ cw::audio::buf::sample_t cw::audio::buf::meter(handle_t h, unsigned devIdx, unsi unsigned idx = flags & kInFl ? kInApIdx : kOutApIdx; const cmApCh* cp = p->devArray[devIdx].ioArray[idx].chArray + chIdx; return _cmApMeterValue(cp); -} +} + +void cw::audio::buf::meter(handle_t h, unsigned devIdx, unsigned flags, sample_t* meterA, unsigned meterN ) +{ + if( devIdx == kInvalidIdx ) + return; + + audioBuf_t* p = _handleToPtr(h); + unsigned idx = flags & kInFl ? kInApIdx : kOutApIdx; + unsigned n = std::min(meterN,channelCount(h,devIdx,flags)); + + for(unsigned i=0; idevArray[devIdx].ioArray[idx].chArray + i; + meterA[i] = _cmApMeterValue(cp); + } + +} + void cw::audio::buf::setGain( handle_t h, unsigned devIdx, unsigned chIdx, unsigned flags, double gain ) { diff --git a/cwAudioBuf.h b/cwAudioBuf.h index e66e557..59778f0 100644 --- a/cwAudioBuf.h +++ b/cwAudioBuf.h @@ -170,6 +170,7 @@ namespace cw // Return the meter value for the requested channel. // Set flags to kInFl | kOutFl. sample_t meter(handle_t h, unsigned devIdx, unsigned chIdx, unsigned flags ); + void meter(handle_t h, unsigned devIdx, unsigned flags, sample_t* meterA, unsigned meterN ); // Set chIdx to -1 to apply the gain to all channels on the specified device. void setGain( handle_t h, unsigned devIdx, unsigned chIdx, unsigned flags, double gain );