Routine.run({
inPath.postln;
fileArray = Cocoa.getPathsInDirectory(inPath);
fileArray=fileArray.reject(_.contains("DS_"));
//fileArray.postln;
fA=fileArray.size;
if (fA > limit ,{loadSize=limit},{loadSize = fA});
//loadSize.do({|i|
// fileArray[i].postln;
// });
("number of buffers =" ++ loadSize) . postln;
bufArray=Array.series(loadSize,0,1);
bufnumArray = Array.series(loadSize,bufSet,1).postln;
//x=bufSet;
bufArray.do({|x|var file,frames;
file=fileArray[x];
pause = Condition.new;
Routine.run({
bufArray[x] = Buffer.read(s, inPath ++ file, bufnum:x+bufSet,startFrame:startFrame,numFrames:numFrames);
s.sync(pause)});
batchArray=batchArray.add(file);
});
s.sync(mainPause);
}, clock: AppClock);