virtual IAudioBuffer *get(unsigned long pos, unsigned int length) noexcept{ sptr<IAudioInfo> info(getInfo()); AudioBuffer *ret = new AudioBuffer(info->getChannels(), length, pos, info->getSamplerate()); unsigned int validInputs = 0; if(NumInputs() > 0){ for(int i = 0; i < NumInputs(); i++){ if(!InputOk(i)) continue; validInputs++; auto tmp = getFromSlot(i, pos, length); for(unsigned int j = 0; j < length; j++){ sptr<ISample> smp1(ret->get(j)); auto smp2 = getSampleFromBuffer(j, tmp); *smp1 += *smp2; ret->set(*smp1, j); } } for(unsigned int j = 0; j < length; j++){ sptr<ISample> smp(ret->get(j)); if(validInputs > 0) *smp /= (float)validInputs; ret->set(*smp, j); } } return ret; };