Re: [Audacity-devel] casting
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Dominic M. <do...@mi...> - 2002-08-10 21:19:14
|
Right now you can use: if (track->GetKind() == Track::Wave) { WaveTrack *waveTrack = (WaveTrack *)track; ... } else wxASSERT(0) I admit that this isn't ideal. This is something that I'm planning to rewrite (with everyone's suggestions) before too long. But for now you can use the code, above. It would probably be more clear if mTracks were renamed mWaveTracks, since there will never be any other type of track there...you're welcome to make that change if you want. - Dominic Vince Busam wrote: > I'll remove the dynamic_cast from src/effects/SimplePairedTwoTrack.h and > replace them with old-fashioned casts. > > I used dynamic_cast because I didn't feel there was a guarantee that > > TrackListIterator iter(mTracks); // mTracks from class Effect > WaveTrack *left = (WaveTrack*)(iter.First()); > > would ALWAYS be a WaveTrack! If it is always a WaveTrack, why isn't the > type of iter.First() WaveTrack? I consider this type of casting dangerous. > A method in class effect that would convert the Track* to WaveTrack* would > give me more confidence. (It would return null if the case doesn't work.) > > e.g. > > class Track .... > { > WaveTrack* GetWaveTrack(); > ... > } > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Audacity-devel mailing list > Aud...@li... > https://lists.sourceforge.net/lists/listinfo/audacity-devel |