| 53 | // Effect implementation |
| 54 | |
| 55 | bool Reverse::Process(EffectInstance&, EffectSettings&) |
| 56 | { |
| 57 | // all needed because Reverse should move the labels too |
| 58 | EffectOutputTracks outputs { |
| 59 | *mTracks, GetType(), { { mT0, mT1 } }, true, true |
| 60 | }; |
| 61 | bool bGoodResult = true; |
| 62 | int count = 0; |
| 63 | |
| 64 | auto trackRange = |
| 65 | outputs.Get().Any() + &SyncLock::IsSelectedOrSyncLockSelectedP; |
| 66 | trackRange.VisitWhile( |
| 67 | bGoodResult, |
| 68 | [&](WaveTrack& track) { |
| 69 | const auto progress = [&](double fraction) { |
| 70 | return !TrackProgress(count, fraction); |
| 71 | }; |
| 72 | if (mT1 > mT0) |
| 73 | { |
| 74 | auto start = track.TimeToLongSamples(mT0); |
| 75 | auto end = track.TimeToLongSamples(mT1); |
| 76 | auto len = end - start; |
| 77 | |
| 78 | if (!WaveTrackUtilities::Reverse(track, start, len, progress)) |
| 79 | bGoodResult = false; |
| 80 | } |
| 81 | count += track.NChannels(); |
| 82 | }, |
| 83 | [&](LabelTrack& track) { |
| 84 | track.ChangeLabelsOnReverse(mT0, mT1); |
| 85 | count++; |
| 86 | }); |
| 87 | |
| 88 | if (bGoodResult) |
| 89 | outputs.Commit(); |
| 90 | |
| 91 | return bGoodResult; |
| 92 | } |
nothing calls this directly
no test coverage detected