improve wave::copyChunk with loop support