1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 08:39:46 +02:00

In WaveTrack.*:

* Fix P2 bug described by Bill Wharrie in "Problem dragging clips between tracks with different sample rates" thread on audacity-quality. Made sure the clips get resampled to the destination WaveTrack rate, and marked changed.

* Comment out unused override of WaveTrack::MoveClipToTrack().

* Added an ANSWER-ME about what appears to be a useless declaration and assignment.


In WaveClip.cpp, remove wxASSERT that Michael was trying to convince me to do yesterday. In debugging this, found a case when it's not a bad call. Thanks, Michael! :-)

In TrackPanel.cpp, removed some cruft.
This commit is contained in:
v.audacity 2012-03-03 01:34:14 +00:00
parent 157af61555
commit 111278c61b
4 changed files with 13 additions and 17 deletions

View File

@ -7668,8 +7668,6 @@ bool TrackPanel::MoveClipToTrack(WaveClip *clip, WaveTrack* dst)
src2->MoveClipToTrack(clip2, dst2);
// update the captured clip array.
bool did1, did2;
did1 = did2 = false;
for (i = 0; i < mCapturedClipArray.GetCount(); i++) {
if (clip && mCapturedClipArray[i].clip == clip) {
mCapturedClipArray[i].track = dst;

View File

@ -1242,14 +1242,9 @@ bool WaveClip::Paste(double t0, WaveClip* other)
sampleCount s0;
TimeToSamplesClip(t0, &s0);
// Check whether sample formats match.
// Force sample formats to match.
if (pastedClip->mSequence->GetSampleFormat() != mSequence->GetSampleFormat())
{
// In debug mode, fail because that's probably a bad call to this method.
// In release, adjust the source to match the destination, so we don't do a bad paste.
wxASSERT(false);
pastedClip->ConvertToSampleFormat(mSequence->GetSampleFormat());
}
bool result = false;
if (mSequence->Paste(s0, pastedClip->mSequence))

View File

@ -1839,21 +1839,24 @@ int WaveTrack::GetNumClips() const
return mClips.GetCount();
}
void WaveTrack::MoveClipToTrack(int clipIndex, WaveTrack* dest)
{
WaveClipList::compatibility_iterator node = mClips.Item(clipIndex);
WaveClip* clip = node->GetData();
mClips.DeleteNode(node);
dest->mClips.Append(clip);
}
// unused
//void WaveTrack::MoveClipToTrack(int clipIndex, WaveTrack* dest)
//{
// WaveClipList::compatibility_iterator node = mClips.Item(clipIndex);
// WaveClip* clip = node->GetData();
// mClips.DeleteNode(node);
// dest->mClips.Append(clip);
//}
void WaveTrack::MoveClipToTrack(WaveClip *clip, WaveTrack* dest)
{
for (WaveClipList::compatibility_iterator it=GetClipIterator(); it; it=it->GetNext()) {
if (it->GetData() == clip) {
WaveClip* clip = it->GetData();
WaveClip* clip = it->GetData(); // ANSWER-ME: Why declare and assign this to another variable, when we just verified the 'clip' parameter is the right value?!
mClips.DeleteNode(it);
dest->mClips.Append(clip);
clip->Resample(dest->GetRate());
clip->MarkChanged();
return; // JKC iterator is now 'defunct' so better return straight away.
}
}

View File

@ -317,7 +317,7 @@ class AUDACITY_DLL_API WaveTrack: public Track {
// Move a clip into a new track. This will remove the clip
// in this cliplist and add it to the cliplist of the
// other clip. No fancy additional stuff is done.
void MoveClipToTrack(int clipIndex, WaveTrack* dest);
// unused void MoveClipToTrack(int clipIndex, WaveTrack* dest);
void MoveClipToTrack(WaveClip *clip, WaveTrack* dest);
// Remove the clip from the track and return a pointer to it.