Nice idea.
Haven't looked at that code in a while, but I originally wrote it for
effects that affected only wave tracks, so your idea seems good. The
majority of effects don't need non-wave tracks, I think, so maybe keep
the currrent structure, rename it mOutputTracks, and have an enum for
what it contains, wavetracks, label tracks only (e.g., for global string
substitution in labels), all tracks, etc. Maybe use the current
TrackKindEnum, and Track::None if it contains all types of track. The
effect subclass sets the flag before it calls CopyInputWaveTracks (which
should be renamed CopyInputTracks), so filtering is done in setting up
for processing, rather than actual processing, so there's no need for
type checking in the actual processing, if it's affecting only one type
of track.
- V
André Pinto wrote:
> As some effects need information about all the tracks of the project
> and not only wave tracks (iterators over groups needs Label tracks),
> I'm thinking about changing the content of mOutputWaveTracks to allow
> all the tracks of a project. The possible filters need would be
> applied on mOutputWaveTracks just when needed. what do you think about
> this change? It will need some rewroting that's why I'm asking.
>
> On Sat, Apr 18, 2009 at 2:34 AM, André Pinto <estadoalpha@gmail.com
> <mailto:estadoalpha@gmail.com>> wrote:
>
> Excellent!
>
> Thanks for your great explanation, and thanks for the "new"
> TrackList iterators too, that TrackGroupIterator is just what we
> need and will make the code much cleaner :)
>
> I understood everything you said, I just haven't look at
> HandleGroupPaste() but I think that I already know what to do with
> the other ones. I'll try to do the patch "tomorrow", because it's
> already 2:30 AM here and I still have some university work to do
> till Monday.
>
> But thanks again for your email.
>
> Respect! :)
>
> André.
>
>
> On Fri, Apr 17, 2009 at 6:01 AM, Leland <leland@audacityteam.org
> <mailto:audacity-devel@lists.sourceforge.net>> <mailto:leland@audacityteam.org>> wrote:
>
> 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
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San
> Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> _______________________________________________
> audacity-devel mailing list
> audacity-devel@lists.sourceforge.net
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Stay on top of everything new and different, both inside and
> around Java (TM) technology - register by April 22, and save
> $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
> 300 plus technical and hands-on sessions. Register today.
> Use priority code J9JMT32. http://p.sf.net/sfu/p
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> audacity-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
audacity-devel mailing list
audacity-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/audacity-devel