MCPcopy Create free account
hub / github.com/audacity/audacity / adjust

Method adjust

lib-src/libsbsms/src/sms.cpp:488–591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488void SMS :: adjust(GrainBuf *trialGrainBuf,
489 queue<float*> *magQueue,
490 int minCutSep,
491 float **_mag1,
492 float **_dmag1,
493 audio **x1,
494 const TimeType &time,
495 Slice **slices)
496{
497 grain *g = trialGrainBuf->read(trialGrainBuf->readPos);
498 g->analyze();
499 for(int c=0; c<channels; c++) {
500 Slice *slice = slices[c];
501 TrackPoint *p = slice->bottom;
502 if(c == 0) {
503 c2even(g->x, x1[0], N);
504 } else {
505 c2odd(g->x, x1[1], N);
506 }
507 float *mag1 = _mag1[c];
508 calcmags(mag1, x1[c]);
509#ifdef MULTITHREADED
510 pthread_mutex_lock(&magMutex[c]);
511#endif
512 float *mag0 = magQueue[c].front(); magQueue[c].pop();
513#ifdef MULTITHREADED
514 pthread_mutex_unlock(&magMutex[c]);
515#endif
516 if(p) {
517 float *dmag = _dmag1[c];
518 list<int> cuts;
519 int k3 = min(Nover2,maxK+2);
520 dmag[0] = mag1[0];
521 for(int k=max(1,minK-2); k<k3; k++) {
522 dmag[k] = mag1[k] - mag1[k-1];
523 }
524 int k = minK;
525 while(true) {
526 k = findCut(dmag,k+1,maxK);
527 if(k >= maxK) {
528 break;
529 } else {
530 cuts.push_back(k);
531 }
532 }
533 bool bDone = false;
534 while(!bDone) {
535 bDone = true;
536 for(list<int>::iterator i = cuts.begin();
537 i != cuts.end();
538 ++i) {
539 int k0 = *i;
540 list<int>::iterator ibad = cuts.end();
541 list<int>::iterator i2 = i;
542 ++i2;
543 float maxY = 0.0f;
544 for(;
545 i2 != cuts.end();

Callers

nothing calls this directly

Calls 12

c2evenFunction · 0.85
c2oddFunction · 0.85
maxFunction · 0.85
freeFunction · 0.85
minFunction · 0.50
sqrtFunction · 0.50
readMethod · 0.45
popMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
advanceMethod · 0.45

Tested by

no test coverage detected