| 539 | } |
| 540 | |
| 541 | void EqualizationBandSliders::Invert() // Inverts any curve |
| 542 | { |
| 543 | auto ¶meters = mCurvesList.mParameters; |
| 544 | auto &linEnvelope = parameters.mLinEnvelope; |
| 545 | auto &logEnvelope = parameters.mLogEnvelope; |
| 546 | |
| 547 | if (!parameters.mDrawMode) // Graphic (Slider) mode. Invert the sliders. |
| 548 | { |
| 549 | for (size_t i = 0; i < mBandsInUse; i++) |
| 550 | { |
| 551 | mEQVals[i] = -mEQVals[i]; |
| 552 | int newPosn = (int)mEQVals[i]; |
| 553 | mSliders[i]->SetValue( newPosn ); |
| 554 | mSlidersOld[i] = newPosn; |
| 555 | |
| 556 | wxString tip; |
| 557 | if( kThirdOct[i] < 1000.) |
| 558 | tip.Printf( wxT("%dHz\n%.1fdB"), (int)kThirdOct[i], mEQVals[i] ); |
| 559 | else |
| 560 | tip.Printf( wxT("%gkHz\n%.1fdB"), kThirdOct[i]/1000., mEQVals[i] ); |
| 561 | mSliders[i]->SetToolTip(tip); |
| 562 | } |
| 563 | GraphicEQ(logEnvelope); |
| 564 | } |
| 565 | else // Draw mode. Invert the points. |
| 566 | { |
| 567 | bool lin = parameters.IsLinear(); // refers to the 'log' or 'lin' of the frequency scale, not the amplitude |
| 568 | size_t numPoints; // number of points in the curve/envelope |
| 569 | |
| 570 | // determine if log or lin curve is the current one |
| 571 | // and find out how many points are in the curve |
| 572 | if(lin) // lin freq scale and so envelope |
| 573 | { |
| 574 | numPoints = linEnvelope.GetNumberOfPoints(); |
| 575 | } |
| 576 | else |
| 577 | { |
| 578 | numPoints = logEnvelope.GetNumberOfPoints(); |
| 579 | } |
| 580 | |
| 581 | if( numPoints == 0 ) |
| 582 | return; |
| 583 | |
| 584 | Doubles when{ numPoints }; |
| 585 | Doubles value{ numPoints }; |
| 586 | |
| 587 | if(lin) |
| 588 | linEnvelope.GetPoints( when.get(), value.get(), numPoints ); |
| 589 | else |
| 590 | logEnvelope.GetPoints( when.get(), value.get(), numPoints ); |
| 591 | |
| 592 | // invert the curve |
| 593 | for (size_t i = 0; i < numPoints; i++) |
| 594 | { |
| 595 | if(lin) |
| 596 | linEnvelope.Reassign(when[i] , -value[i]); |
| 597 | else |
| 598 | logEnvelope.Reassign(when[i] , -value[i]); |
no test coverage detected