| 1189 | } |
| 1190 | |
| 1191 | bool EffectEqualization48x::ProcessOne8xThreaded(int count, WaveTrack * t, |
| 1192 | sampleCount start, sampleCount len) |
| 1193 | { |
| 1194 | sampleCount blockCount=len/mBlockSize; |
| 1195 | |
| 1196 | if(blockCount<16) // it's not worth 4x processing do a regular process |
| 1197 | return ProcessOne4x(count, t, start, len); |
| 1198 | if(mThreadCount<=0 || blockCount<256) // don't do it without cores or big data |
| 1199 | return ProcessOne4x(count, t, start, len); |
| 1200 | |
| 1201 | auto output = t->EmptyCopy(); |
| 1202 | t->ConvertToSampleFormat( floatSample ); |
| 1203 | |
| 1204 | auto trackBlockSize = t->GetMaxBlockSize(); |
| 1205 | mEffectEqualization->TrackProgress(count, 0.0); |
| 1206 | int bigRuns=len/(mSubBufferSize-mBlockSize); |
| 1207 | int trackBlocksPerBig=mSubBufferSize/trackBlockSize; |
| 1208 | int trackLeftovers=mSubBufferSize-trackBlocksPerBig*trackBlockSize; |
| 1209 | int singleProcessLength=(mFilterSize>>1)*bigRuns + len%(bigRuns*(mSubBufferSize-mBlockSize)); |
| 1210 | auto currentSample=start; |
| 1211 | |
| 1212 | int bigBlocksRead=mWorkerDataCount, bigBlocksWritten=0; |
| 1213 | |
| 1214 | // fill the first workerDataCount buffers we checked above and there is at least this data |
| 1215 | for(int i=0;i<mWorkerDataCount;i++) |
| 1216 | { |
| 1217 | // fill the buffer |
| 1218 | for(int j=0;j<trackBlocksPerBig;j++) { |
| 1219 | t->Get((samplePtr)&mBufferInfo[i].mBufferSouce[0][j*trackBlockSize], floatSample, currentSample, trackBlockSize); |
| 1220 | currentSample+=trackBlockSize; |
| 1221 | } |
| 1222 | if(trackLeftovers) { |
| 1223 | t->Get((samplePtr)&mBufferInfo[i].mBufferSouce[0][trackBlocksPerBig*trackBlockSize], floatSample, currentSample, trackLeftovers); |
| 1224 | currentSample+=trackLeftovers; |
| 1225 | } |
| 1226 | currentSample-=mBlockSize+(mFilterSize>>1); |
| 1227 | mBufferInfo[i].mBufferStatus=BufferReady; // free for grabbin |
| 1228 | } |
| 1229 | int currentIndex=0; |
| 1230 | bool bBreakLoop = false; |
| 1231 | while(bigBlocksWritten<bigRuns) { |
| 1232 | if (bBreakLoop=mEffectEqualization->TrackProgress(count, (double)(bigBlocksWritten)/(double)bigRuns)) |
| 1233 | { |
| 1234 | break; |
| 1235 | } |
| 1236 | wxMutexLocker locker( mDataMutex ); // Get in line for data |
| 1237 | // process as many blocks as we can |
| 1238 | while((mBufferInfo[currentIndex].mBufferStatus==BufferDone) && (bigBlocksWritten<bigRuns)) { // data is ours |
| 1239 | output->Append((samplePtr)&mBufferInfo[currentIndex].mBufferDest[0][(bigBlocksWritten?mBlockSize:0)+(mFilterSize>>1)], floatSample, mSubBufferSize-((bigBlocksWritten?mBlockSize:0)+(mFilterSize>>1))); |
| 1240 | bigBlocksWritten++; |
| 1241 | if(bigBlocksRead<bigRuns) { |
| 1242 | // fill the buffer |
| 1243 | for(int j=0;j<trackBlocksPerBig;j++) { |
| 1244 | t->Get((samplePtr)&mBufferInfo[currentIndex].mBufferSouce[0][j*trackBlockSize], floatSample, currentSample, trackBlockSize); |
| 1245 | currentSample+=trackBlockSize; |
| 1246 | } |
| 1247 | if(trackLeftovers) { |
| 1248 | t->Get((samplePtr)&mBufferInfo[currentIndex].mBufferSouce[0][trackBlocksPerBig*trackBlockSize], floatSample, currentSample, trackLeftovers); |
nothing calls this directly
no test coverage detected