limit number of render pool threads to chip count

This commit is contained in:
tildearrow 2023-09-07 01:16:27 -05:00
parent 157f3be253
commit a3cd0fa6ba
2 changed files with 8 additions and 1 deletions

View file

@ -3282,6 +3282,10 @@ void DivEngine::quitDispatch() {
for (int i=0; i<DIV_MAX_CHANS; i++) {
isMuted[i]=0;
}
if (renderPool!=NULL) {
delete renderPool;
renderPool=NULL;
}
BUSY_END;
}

View file

@ -1797,7 +1797,10 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
std::chrono::steady_clock::time_point ts_processBegin=std::chrono::steady_clock::now();
if (renderPool==NULL) {
renderPool=new DivWorkPool(renderPoolThreads);
unsigned int howManyThreads=song.systemLen;
if (howManyThreads<2) howManyThreads=0;
if (howManyThreads>renderPoolThreads) howManyThreads=renderPoolThreads;
renderPool=new DivWorkPool(howManyThreads);
}
// process MIDI events (TODO: everything)