1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 17:30:17 +01:00

Use TypeSwitch and track_cast

This commit is contained in:
Paul Licameli
2017-04-11 18:16:03 -04:00
parent fd10ed26cd
commit 51842fc78b
13 changed files with 806 additions and 872 deletions

View File

@@ -119,13 +119,16 @@ void TimeTrack::Clear(double t0, double t1)
void TimeTrack::Paste(double t, const Track * src)
{
if (src->GetKind() != Track::Time)
// THROW_INCONSISTENCY_EXCEPTION; // ?
return;
bool bOk = src && src->TypeSwitch< bool >( [&] (const TimeTrack *tt) {
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
mEnvelope->PasteEnvelope
(t, tt->mEnvelope.get(), sampleTime);
return true;
} );
auto sampleTime = 1.0 / GetActiveProject()->GetRate();
mEnvelope->PasteEnvelope
(t, static_cast<const TimeTrack*>(src)->mEnvelope.get(), sampleTime);
if (! bOk )
// THROW_INCONSISTENCY_EXCEPTION // ?
;
}
void TimeTrack::Silence(double WXUNUSED(t0), double WXUNUSED(t1))