| 517 | } |
| 518 | |
| 519 | void MixerTrackCluster::UpdateMeter(const double t0, const double t1) |
| 520 | { |
| 521 | // NoteTracks do not (currently) register on meters. It would probably be |
| 522 | // a good idea to display 16 channel "active" lights rather than a meter |
| 523 | if (!GetWave()) |
| 524 | return; |
| 525 | |
| 526 | if ((t0 < 0.0) || (t1 < 0.0) || (t0 >= t1) || // bad time value or nothing to show |
| 527 | ((mMixerBoard->HasSolo() || mTrack->GetMute()) && !mTrack->GetSolo()) |
| 528 | ) |
| 529 | { |
| 530 | //v Vaughan, 2011-02-25: Moved the update back to TrackPanel::OnTimer() as it helps with |
| 531 | // playback issues reported by Bill and noted on Bug 258, so no assert. |
| 532 | // Vaughan, 2011-02-04: Now that we're updating all meters from audacityAudioCallback, |
| 533 | // this causes an assert if you click Mute while playing, because ResetMeter() resets |
| 534 | // the timer, and wxTimerbase says that can only be done from main thread -- |
| 535 | // but it seems to work fine. |
| 536 | this->ResetMeter(false); |
| 537 | return; |
| 538 | } |
| 539 | |
| 540 | // Vaughan, 2010-11-27: |
| 541 | // This commented out code is flawed. Mistaken understanding of "frame" vs "window". |
| 542 | // Caused me to override MeterPanel::UpdateDisplay(). |
| 543 | // But I think it's got a good idea, of calling WaveTracks' GetMinMax and GetRMS |
| 544 | // instead of passing in all the data and asking the meter to derive peak and rms. |
| 545 | // May be worth revisiting as I think it should perform better, because it uses the min/max/rms |
| 546 | // stored in sample blocks, rather than calculating them, but for now, changing it to use the |
| 547 | // original MeterPanel::UpdateDisplay(). New code is below the previous (now commented out). |
| 548 | // |
| 549 | //const size_t kFramesPerBuffer = 4; |
| 550 | //float min; // dummy, since it's not shown in meters |
| 551 | //Floats maxLeft{kFramesPerBuffer}; |
| 552 | //Floats rmsLeft{kFramesPerBuffer}; |
| 553 | //Floats maxRight{kFramesPerBuffer}; |
| 554 | //Floats rmsRight{kFramesPerBuffer}; |
| 555 | // |
| 556 | // bool bSuccess = (GetWave() != nullptr); |
| 557 | |
| 558 | //const double dFrameInterval = (t1 - t0) / (double)kFramesPerBuffer; |
| 559 | //double dFrameT0 = t0; |
| 560 | //double dFrameT1 = t0 + dFrameInterval; |
| 561 | //int i = 0; |
| 562 | //while (bSuccess && (i < kFramesPerBuffer)) |
| 563 | //{ |
| 564 | // bSuccess &= |
| 565 | // mTrack->GetMinMax(&min, &(maxLeft[i]), dFrameT0, dFrameT1) && |
| 566 | // mTrack->GetRMS(&(rmsLeft[i]), dFrameT0, dFrameT1); |
| 567 | // if (bSuccess && mRightTrack) |
| 568 | // bSuccess &= |
| 569 | // mRightTrack->GetMinMax(&min, &(maxRight[i]), dFrameT0, dFrameT1) && |
| 570 | // mRightTrack->GetRMS(&(rmsRight[i]), dFrameT0, dFrameT1); |
| 571 | // else |
| 572 | // { |
| 573 | // // Mono: Start with raw values same as left. |
| 574 | // // To be modified by bWantPostFadeValues and channel pan/gain. |
| 575 | // maxRight[i] = maxLeft[i]; |
| 576 | // rmsRight[i] = rmsLeft[i]; |
no test coverage detected