1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-25 08:58: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
{
public:
TrackClip(Track *t, WaveClip *c) { track = t; clip = c; }
TrackClip(Track *t, WaveClip *c) { track = origTrack = t; clip = c; }
Track *track;
Track *origTrack;
WaveClip *clip;
};

View File

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