1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 15:49:36 +02:00

Fix problem generating over beginning of clips with "editClipsCanMove" mode

off; make WaveTrack::IsEmpty() use the clip boundary routines; hopefully make
warping more correct.
This commit is contained in:
BusinessmanProgrammerSteve 2010-04-15 21:01:50 +00:00
parent 830db47f50
commit fad5cd7f96
2 changed files with 9 additions and 8 deletions

View File

@ -254,8 +254,7 @@ bool WaveTrack::IsEmpty(double t0, double t1)
{ {
WaveClip *clip = it->GetData(); WaveClip *clip = it->GetData();
if (clip->GetStartTime() < t1-(1.0/mRate) && if (!clip->BeforeClip(t1) && !clip->AfterClip(t0)) {
clip->GetEndTime()-(1.0/mRate) > t0) {
//printf("Overlapping clip: %.6f...%.6f\n", //printf("Overlapping clip: %.6f...%.6f\n",
// clip->GetStartTime(), // clip->GetStartTime(),
// clip->GetEndTime()); // clip->GetEndTime());

View File

@ -43,11 +43,13 @@ bool Generator::Process()
bool editClipCanMove; bool editClipCanMove;
gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove, true); gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove, true);
//if we can't move clips, check if generation is done on an empty place with enough //if we can't move clips, and we're generating into an empty space,
//duration before actually generate anything. //make sure there's room.
if (!editClipCanMove && track->IsEmpty(mT0, mT0+1.0/track->GetRate()) && if (!editClipCanMove &&
!track->IsEmpty(mT0, mT0+mDuration-1.0/track->GetRate())) { track->IsEmpty(mT0, mT1+1.0/track->GetRate()) &&
wxMessageBox( !track->IsEmpty(mT0, mT0+mDuration-(mT1-mT0)-1.0/track->GetRate()))
{
wxMessageBox(
_("There is not enough room available to generate the audio"), _("There is not enough room available to generate the audio"),
_("Error"), wxICON_STOP); _("Error"), wxICON_STOP);
Failure(); Failure();
@ -67,7 +69,7 @@ bool Generator::Process()
else { else {
// Transfer the data from the temporary track to the actual one // Transfer the data from the temporary track to the actual one
tmp->Flush(); tmp->Flush();
SetTimeWarper(new StepTimeWarper(mT1, mDuration-mT1)); SetTimeWarper(new StepTimeWarper(mT0+mDuration, mDuration-(mT1-mT0)));
bGoodResult = track->ClearAndPaste(mT0, mT1, tmp, true, bGoodResult = track->ClearAndPaste(mT0, mT1, tmp, true,
false, GetTimeWarper()); false, GetTimeWarper());
delete tmp; delete tmp;