// Gets the number of children. wxAccStatus TrackPanelAx::GetChildCount( int* childCount ) { TrackListIterator iter( mTrackPanel->mTracks ); Track *t = iter.First(); int cnt = 0; while( t != NULL ) { cnt++; if( t->GetLink() != NULL ) { t = iter.Next(); } t = iter.Next(); } *childCount = cnt; return wxACC_OK; }
void ControlToolBar::SetupCutPreviewTracks(double WXUNUSED(playStart), double cutStart, double cutEnd, double WXUNUSED(playEnd)) { ClearCutPreviewTracks(); AudacityProject *p = GetActiveProject(); if (p) { // Find first selected track (stereo or mono) and duplicate it Track *track1 = NULL, *track2 = NULL; TrackListIterator it(p->GetTracks()); for (Track *t = it.First(); t; t = it.Next()) { if (t->GetKind() == Track::Wave && t->GetSelected()) { track1 = t; track2 = t->GetLink(); break; } } if (track1) { // Duplicate and change tracks auto new1 = track1->Duplicate(); new1->Clear(cutStart, cutEnd); decltype(new1) new2{}; if (track2) { new2 = track2->Duplicate(); new2->Clear(cutStart, cutEnd); } mCutPreviewTracks = new TrackList(); mCutPreviewTracks->Add(std::move(new1)); if (track2) mCutPreviewTracks->Add(std::move(new2)); } } }
TrackPanelResizeHandle::TrackPanelResizeHandle ( const std::shared_ptr<Track> &track, int y, const AudacityProject *pProject ) : mpTrack{ track } , mMouseClickY( y ) { auto tracks = pProject->GetTracks(); Track *prev = tracks->GetPrev(track.get()); Track *next = tracks->GetNext(track.get()); //STM: Determine whether we should rescale one or two tracks if (prev && prev->GetLink() == track.get()) { // mpTrack is the lower track mInitialTrackHeight = track->GetHeight(); mInitialActualHeight = track->GetActualHeight(); mInitialMinimized = track->GetMinimized(); mInitialUpperTrackHeight = prev->GetHeight(); mInitialUpperActualHeight = prev->GetActualHeight(); mMode = IsResizingBelowLinkedTracks; } else if (next && track->GetLink() == next) { // mpTrack is the upper track mInitialTrackHeight = next->GetHeight(); mInitialActualHeight = next->GetActualHeight(); mInitialMinimized = next->GetMinimized(); mInitialUpperTrackHeight = track->GetHeight(); mInitialUpperActualHeight = track->GetActualHeight(); mMode = IsResizingBetweenLinkedTracks; } else { // DM: Save the initial mouse location and the initial height mInitialTrackHeight = track->GetHeight(); mInitialActualHeight = track->GetActualHeight(); mInitialMinimized = track->GetMinimized(); mMode = IsResizing; } }
bool EffectTruncSilence::ProcessIndependently() { unsigned nGroups = 0; const bool syncLock = ::GetActiveProject()->IsSyncLocked(); // Check if it's permissible { SelectedTrackListOfKindIterator iter(Track::Wave, mTracks); for (Track *track = iter.First(); track; track = iter.Next(true) // skip linked tracks ) { if (syncLock) { Track *const link = track->GetLink(); SyncLockedTracksIterator syncIter(mTracks); for (Track *track2 = syncIter.StartWith(track); track2; track2 = syncIter.Next()) { if (track2->GetKind() == Track::Wave && !(track2 == track || track2 == link) && track2->GetSelected()) { ::wxMessageBox(_("When truncating independently, there may only be one selected audio track in each sync-lock group.")); return false; } } } ++nGroups; } } if (nGroups == 0) // nothing to do return true; // Now do the work // Copy tracks CopyInputTracks(Track::All); double newT1 = 0.0; { unsigned iGroup = 0; SelectedTrackListOfKindIterator iter(Track::Wave, mOutputTracks); for (Track *track = iter.First(); track; ++iGroup, track = iter.Next(true) // skip linked tracks ) { Track *const link = track->GetLink(); Track *const last = link ? link : track; RegionList silences; if (!FindSilences(silences, track, last)) return false; // Treat tracks in the sync lock group only Track *groupFirst, *groupLast; if (syncLock) { SyncLockedTracksIterator syncIter(mOutputTracks); groupFirst = syncIter.StartWith(track); groupLast = syncIter.Last(); } else { groupFirst = track; groupLast = last; } double totalCutLen = 0.0; if (!DoRemoval(silences, iGroup, nGroups, groupFirst, groupLast, totalCutLen)) return false; newT1 = std::max(newT1, mT1 - totalCutLen); } } mT1 = newT1; return true; }