1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-26 01:18:06 +02:00

Bug829: Only the clips that really moved vertically should change their rate

This commit is contained in:
Paul Licameli 2015-08-08 18:16:48 -04:00
parent 17e3bf7b09
commit 17bfd6cfde
2 changed files with 19 additions and 18 deletions

View File

@ -30,8 +30,9 @@ class ZoomInfo;
class TrackClip class TrackClip
{ {
public: public:
TrackClip(Track *t, WaveClip *c) { track = t; clip = c; } TrackClip(Track *t, WaveClip *c) { track = origTrack = t; clip = c; }
Track *track; Track *track;
Track *origTrack;
WaveClip *clip; WaveClip *clip;
}; };

View File

@ -3836,23 +3836,23 @@ void TrackPanel::HandleSlide(wxMouseEvent & event)
DoSlide(event); DoSlide(event);
if (event.LeftUp()) { if (event.LeftUp()) {
if (mDidSlideVertically && mCapturedTrack) for (size_t i = 0; i < mCapturedClipArray.size(); i++)
// Now that user has dropped the clip into a different track, {
// make sure the sample rate matches the destination track (mCapturedTrack). TrackClip &trackClip = mCapturedClipArray[i];
for (size_t i = 0; i < mCapturedClipArray.size(); i++) WaveClip* pWaveClip = trackClip.clip;
if (mCapturedTrack->GetKind() == Track::Wave) // Should always be true here, but make sure. // Note that per TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1),
{ // in the non-WaveTrack case, the code adds a NULL clip to mCapturedClipArray,
WaveClip* pWaveClip = mCapturedClipArray[i].clip; // so we have to check for that any time we're going to deref it.
// Note that per TrackPanel::AddClipsToCaptured(Track *t, double t0, double t1), // Previous code did not check it here, and that caused bug 367 crash.
// in the non-WaveTrack case, the code adds a NULL clip to mCapturedClipArray, if (pWaveClip &&
// so we have to check for that any time we're going to deref it. trackClip.track != trackClip.origTrack)
// Previous code did not check it here, and that caused bug 367 crash. {
if (pWaveClip) // Now that user has dropped the clip into a different track,
{ // make sure the sample rate matches the destination track (mCapturedTrack).
pWaveClip->Resample(((WaveTrack*)mCapturedTrack)->GetRate()); pWaveClip->Resample(static_cast<WaveTrack*>(trackClip.track)->GetRate());
pWaveClip->MarkChanged(); pWaveClip->MarkChanged();
} }
} }
SetCapturedTrack( NULL ); SetCapturedTrack( NULL );