diff --git a/src/WaveTrack.cpp b/src/WaveTrack.cpp index 075ddaf79..563bddb3d 100644 --- a/src/WaveTrack.cpp +++ b/src/WaveTrack.cpp @@ -254,8 +254,7 @@ bool WaveTrack::IsEmpty(double t0, double t1) { WaveClip *clip = it->GetData(); - if (clip->GetStartTime() < t1-(1.0/mRate) && - clip->GetEndTime()-(1.0/mRate) > t0) { + if (!clip->BeforeClip(t1) && !clip->AfterClip(t0)) { //printf("Overlapping clip: %.6f...%.6f\n", // clip->GetStartTime(), // clip->GetEndTime()); diff --git a/src/effects/Generator.cpp b/src/effects/Generator.cpp index ba3d7eaf2..fc10b6994 100644 --- a/src/effects/Generator.cpp +++ b/src/effects/Generator.cpp @@ -43,11 +43,13 @@ bool Generator::Process() bool editClipCanMove; gPrefs->Read(wxT("/GUI/EditClipCanMove"), &editClipCanMove, true); - //if we can't move clips, check if generation is done on an empty place with enough - //duration before actually generate anything. - if (!editClipCanMove && track->IsEmpty(mT0, mT0+1.0/track->GetRate()) && - !track->IsEmpty(mT0, mT0+mDuration-1.0/track->GetRate())) { - wxMessageBox( + //if we can't move clips, and we're generating into an empty space, + //make sure there's room. + if (!editClipCanMove && + track->IsEmpty(mT0, mT1+1.0/track->GetRate()) && + !track->IsEmpty(mT0, mT0+mDuration-(mT1-mT0)-1.0/track->GetRate())) + { + wxMessageBox( _("There is not enough room available to generate the audio"), _("Error"), wxICON_STOP); Failure(); @@ -67,7 +69,7 @@ bool Generator::Process() else { // Transfer the data from the temporary track to the actual one tmp->Flush(); - SetTimeWarper(new StepTimeWarper(mT1, mDuration-mT1)); + SetTimeWarper(new StepTimeWarper(mT0+mDuration, mDuration-(mT1-mT0))); bGoodResult = track->ClearAndPaste(mT0, mT1, tmp, true, false, GetTimeWarper()); delete tmp;