From dd5f42270fe6e8218a6c0f120c0c86302a79ed91 Mon Sep 17 00:00:00 2001 From: Roy Macdonald Date: Sun, 12 Nov 2023 20:18:47 +0400 Subject: [PATCH] avoiding division by zero --- src/ofxSoundObject.cpp | 2 +- src/ofxSoundUtils.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ofxSoundObject.cpp b/src/ofxSoundObject.cpp index 3409c64..b122550 100644 --- a/src/ofxSoundObject.cpp +++ b/src/ofxSoundObject.cpp @@ -28,7 +28,7 @@ ofxSoundObject::ofxSoundObject(const ofxSoundObject& a): _bBypass(a._bBypass.loa ofxSoundObject::ofxSoundObject() :_bBypass(false) { - ofLogWarning("ofxSoundObject::ofxSoundObject()", "the ofxSoundObjects' no args constructor should not be called. "); + ofLogWarning("ofxSoundObject::ofxSoundObject()") << "the ofxSoundObjects' no args constructor should not be called. "; } ofxSoundObject::ofxSoundObject(ofxSoundObjectsType t) :_bBypass(false) diff --git a/src/ofxSoundUtils.h b/src/ofxSoundUtils.h index bd1fdf6..0ce6486 100644 --- a/src/ofxSoundUtils.h +++ b/src/ofxSoundUtils.h @@ -50,9 +50,10 @@ class ofxCircularSoundBuffer: public ofSoundBuffer{ if(size() == 0 || getNumChannels() == 0 || bNeedsAllocation.load()){//} || getNumFrames() != buffer.getNumFrames() * numBuffers){ allocate(srcSizePerChannel* numBuffers, numChannels); setSampleRate(sampleRate); - + if( getBuffer().size()){ bNeedsAllocation = false; pushIndex %= getBuffer().size(); + } } if(getBuffer().size() > 0){