mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-14 07:20:35 +02:00
some reindentation
This commit is contained in:
parent
26c4d65bd4
commit
30e67bcb8e
@ -663,9 +663,6 @@ void Envelope::Paste(double t0, const Envelope *e)
|
|||||||
// get values to perform framing of the insertion
|
// get values to perform framing of the insertion
|
||||||
double splitval = GetValue(t0 + mOffset);
|
double splitval = GetValue(t0 + mOffset);
|
||||||
|
|
||||||
if(len != 0) { // Not case 10: there are point/s in the envelope
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Old analysis of cases:
|
Old analysis of cases:
|
||||||
(see discussions on audacity-devel around 19/8/7 - 23/8/7 and beyond, "Envelopes and 'Join'")
|
(see discussions on audacity-devel around 19/8/7 - 23/8/7 and beyond, "Envelopes and 'Join'")
|
||||||
@ -691,7 +688,7 @@ Old analysis of cases:
|
|||||||
// In pasting in a clip we choose to preserve the envelope so that the loudness of the
|
// In pasting in a clip we choose to preserve the envelope so that the loudness of the
|
||||||
// parts is unchanged.
|
// parts is unchanged.
|
||||||
//
|
//
|
||||||
// 1) This may introduce a discontnuity in the envelope at a boundary between the
|
// 1) This may introduce a discontinuity in the envelope at a boundary between the
|
||||||
// old and NEW clips. In that case we must ensure there are envelope points
|
// old and NEW clips. In that case we must ensure there are envelope points
|
||||||
// at sample positions immediately before and immediately after the boundary.
|
// at sample positions immediately before and immediately after the boundary.
|
||||||
// 2) If the points have the same value we only need one of them.
|
// 2) If the points have the same value we only need one of them.
|
||||||
@ -704,6 +701,8 @@ Old analysis of cases:
|
|||||||
// RemoveUnneededPoints() (provided that function behaves correctly).
|
// RemoveUnneededPoints() (provided that function behaves correctly).
|
||||||
|
|
||||||
// See if existing points need shifting to the right, and what Case we are in
|
// See if existing points need shifting to the right, and what Case we are in
|
||||||
|
if(len != 0) {
|
||||||
|
// Not case 10: there are point/s in the envelope
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (mEnv[i].GetT() > t0)
|
if (mEnv[i].GetT() > t0)
|
||||||
someToShift = true;
|
someToShift = true;
|
||||||
@ -720,59 +719,68 @@ Old analysis of cases:
|
|||||||
if( (mTrackLen - t0) < mTrackEpsilon )
|
if( (mTrackLen - t0) < mTrackEpsilon )
|
||||||
atEnd = true;
|
atEnd = true;
|
||||||
if(0 > t0)
|
if(0 > t0)
|
||||||
beforeStart = true; // Case 13
|
// Case 13
|
||||||
|
beforeStart = true;
|
||||||
if(mTrackLen < t0)
|
if(mTrackLen < t0)
|
||||||
afterEnd = true; // Case 12
|
// Case 12
|
||||||
|
afterEnd = true;
|
||||||
|
|
||||||
// Now test for the various Cases, and try to do the right thing
|
// Now test for the various Cases, and try to do the right thing
|
||||||
if(atStart) { // insertion at the beginning
|
if(atStart) {
|
||||||
if(onPoint) { // first env point is at LH end
|
// insertion at the beginning
|
||||||
mEnv[0].SetT(mEnv[0].GetT() + mTrackEpsilon); // Case 1: move it R slightly to avoid duplicate point
|
if(onPoint) {
|
||||||
|
// Case 1: move it R slightly to avoid duplicate point
|
||||||
|
// first env point is at LH end
|
||||||
|
mEnv[0].SetT(mEnv[0].GetT() + mTrackEpsilon);
|
||||||
someToShift = true; // there is now, even if there wasn't before
|
someToShift = true; // there is now, even if there wasn't before
|
||||||
//wxLogDebug(wxT("Case 1"));
|
//wxLogDebug(wxT("Case 1"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval); // Case 3: insert a point to maintain the envelope
|
// Case 3: insert a point to maintain the envelope
|
||||||
|
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval);
|
||||||
someToShift = true;
|
someToShift = true;
|
||||||
//wxLogDebug(wxT("Case 3"));
|
//wxLogDebug(wxT("Case 3"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(atEnd) { // insertion at the end
|
if(atEnd) {
|
||||||
if(onPoint) { // last env point is at RH end, Case 2:
|
// insertion at the end
|
||||||
mEnv[0].SetT(mEnv[0].GetT() - mTrackEpsilon); // move it L slightly to avoid duplicate point
|
if(onPoint) {
|
||||||
|
// last env point is at RH end, Case 2:
|
||||||
|
// move it L slightly to avoid duplicate point
|
||||||
|
mEnv[0].SetT(mEnv[0].GetT() - mTrackEpsilon);
|
||||||
//wxLogDebug(wxT("Case 2"));
|
//wxLogDebug(wxT("Case 2"));
|
||||||
}
|
}
|
||||||
else { // Case 4:
|
else {
|
||||||
InsertOrReplaceRelative(t0 - mTrackEpsilon, splitval); // insert a point to maintain the envelope
|
// Case 4:
|
||||||
|
// insert a point to maintain the envelope
|
||||||
|
InsertOrReplaceRelative(t0 - mTrackEpsilon, splitval);
|
||||||
//wxLogDebug(wxT("Case 4"));
|
//wxLogDebug(wxT("Case 4"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if(onPoint) {
|
||||||
if(onPoint) { // Case 7: move the point L and insert a NEW one to the R
|
// Case 7: move the point L and insert a NEW one to the R
|
||||||
mEnv[pos].SetT(mEnv[pos].GetT() - mTrackEpsilon);
|
mEnv[pos].SetT(mEnv[pos].GetT() - mTrackEpsilon);
|
||||||
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval);
|
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval);
|
||||||
someToShift = true;
|
someToShift = true;
|
||||||
//wxLogDebug(wxT("Case 7"));
|
//wxLogDebug(wxT("Case 7"));
|
||||||
}
|
}
|
||||||
else {
|
else if( !beforeStart && !afterEnd ) {
|
||||||
if( !beforeStart && !afterEnd ) {// Case 5: Insert points to L and R
|
// Case 5: Insert points to L and R
|
||||||
InsertOrReplaceRelative(t0 - mTrackEpsilon, splitval);
|
InsertOrReplaceRelative(t0 - mTrackEpsilon, splitval);
|
||||||
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval);
|
InsertOrReplaceRelative(t0 + mTrackEpsilon, splitval);
|
||||||
someToShift = true;
|
someToShift = true;
|
||||||
//wxLogDebug(wxT("Case 5"));
|
//wxLogDebug(wxT("Case 5"));
|
||||||
}
|
}
|
||||||
else {
|
else if( beforeStart ) {
|
||||||
if( beforeStart ) { // Case 13:
|
// Case 13:
|
||||||
//wxLogDebug(wxT("Case 13"));
|
//wxLogDebug(wxT("Case 13"));
|
||||||
}
|
}
|
||||||
else { // Case 12:
|
else {
|
||||||
|
// Case 12:
|
||||||
//wxLogDebug(wxT("Case 12"));
|
//wxLogDebug(wxT("Case 12"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now shift existing points to the right, if required
|
// Now shift existing points to the right, if required
|
||||||
if(someToShift) {
|
if(someToShift) {
|
||||||
@ -783,7 +791,8 @@ Old analysis of cases:
|
|||||||
}
|
}
|
||||||
mTrackLen += deltat;
|
mTrackLen += deltat;
|
||||||
}
|
}
|
||||||
else { // Case 10:
|
else {
|
||||||
|
// Case 10:
|
||||||
if( mTrackLen == 0 ) // creating a NEW envelope
|
if( mTrackLen == 0 ) // creating a NEW envelope
|
||||||
{
|
{
|
||||||
mTrackLen = e->mTrackLen;
|
mTrackLen = e->mTrackLen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user