Re: [Audacity-devel] Bug in Truncate Silence
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Leland <le...@au...> - 2009-04-17 05:01:42
|
André Pinto wrote: > Effects work with temporary copys of tracks. > When they need to clear parts of the tracks they call the "global" Clear > function. > The problem is that when there are linked layers (labels) the Clear > function applys the "clear" directly to the project tracks, that is not > what the Effects need it to do. > So, I had to rewrote some of the Clear methods to fix this bug, but I > tried to keep it compatible with all the old calls. Check the attached > patch for details. > Hi André, Good sleuthing and you've uncovered more than you may have realized. When reviewing your patch, I realized that there's a couple of flaws in the original code (not your patch) that need to be addressed. Here's an example: 1) Start with a clean project 2) Generate a tone 3) Add a label track 4) Add a time track 5) Select a bit of audio in the wave track 6) Select Edit -> Delete Nothing gets deleted and this illustrates the first problem of HandleGroupClear(). The second issue is a bit less evident. If you take a look at AudacityProject::Clear(), you'll see that the tracks are iterated and the selected portions are cleared. Easy enough, but dig a little deeper and you'll realize that the tracks that have not yet been iterated could be cleared by HandleGroupClear() before they're iterated. Looks like this was supposed to be handled by the code that causes the first issue above. So, there's a basic flaw in how groups are being handled. I understand why it was done this way (to keep the upper layers of code from having to know about track groups) but I don't believe WaveTrack should be iterating the tracklist themselves as it doesn't know the intentions of the upper layers of code. So, if you're willing, you could take your patch even further, but be warned, it's gonna get rather longish. :-) I'm thinking that the HandleGroupClear() method should be removed entirely and the methods that call WaveTrack::Clear and WaveTrack::ClearAndAddCutLine() and WaveTrack::CutAndAddCutLine() (and maybe others) should be changed to use the new TrackGroupIterator class instead. This would solve both of the above problems as well as the original problem with Truncate Silence. And, if you're feeling really ambitious, you could take the same approach with the HandleGroupPaste() and his callers. Holler if you need more explanation (sometimes my fingers don't type what my brain is thinking ;-)). Leland |