src/ProjectAudioManager.cpp
// This is called after recording has stopped and all tracks have flushed.
This is called after recording has stopped and all tracks have flushed.
This is called after recording has stopped and all tracks have flushed .
void ProjectAudioManager::OnAudioIOStopRecording()
{
   auto &project = mProject;
   auto &projectAudioIO = ProjectAudioIO::Get( project );
   auto &projectFileIO = ProjectFileIO::Get( project );
   auto &window = GetProjectFrame( project );
   if (projectAudioIO.GetAudioIOToken() > 0)
   {
      auto &history = ProjectHistory::Get( project );
      if (IsTimerRecordCancelled()) {
         history.RollbackState();
         ResetTimerRecordCancelled();
      }
      else {
         history.PushState(XO("Recorded Audio"), XO("Record"),
            UndoPush::NOAUTOSAVE);
         auto &tracks = TrackList::Get( project );
         auto gAudioIO = AudioIO::Get();
         auto &intervals = gAudioIO->LostCaptureIntervals();
         if (intervals.size()) {
            auto uTrack = std::make_shared<LabelTrack>();
            auto pTrack = uTrack.get();
            tracks.Add( uTrack );
            pTrack->SetName(_("Dropouts"));
            long counter = 1;
            for (auto &interval : intervals)
               pTrack->AddLabel(
                  SelectedRegion{ interval.first,
                     interval.first + interval.second },
                  wxString::Format(wxT("%ld"), counter++));
            history.ModifyState( true ); 
            wxTheApp->CallAfter( [&] {
               ShowWarningDialog(&window, wxT("DropoutDetected"), XO("\
Recorded audio was lost at the labeled locations. Possible causes:\n\
\n\
Other applications are competing with Audacity for processor time\n\
\n\
You are saving directly to a slow external storage device\n\
"
                  ),
                  false,
                  XXO("Turn off dropout detection"));
            });
         }
      }
   }
}
void ProjectAudioManager :: OnAudioIOStopRecording ( ) { auto & project = mProject ; auto & projectAudioIO = ProjectAudioIO :: Get ( project ) ; auto & projectFileIO = ProjectFileIO :: Get ( project ) ; auto & window = GetProjectFrame ( project ) ; if ( projectAudioIO . GetAudioIOToken ( ) > 0 ) { auto & history = ProjectHistory :: Get ( project ) ; if ( IsTimerRecordCancelled ( ) ) { history . RollbackState ( ) ; ResetTimerRecordCancelled ( ) ; } else { history . PushState ( XO ( " " ) , XO ( " " ) , UndoPush :: NOAUTOSAVE ) ; auto & tracks = TrackList :: Get ( project ) ; auto gAudioIO = AudioIO :: Get ( ) ; auto & intervals = gAudioIO -> LostCaptureIntervals ( ) ; if ( intervals . size ( ) ) { auto uTrack = std :: make_shared < LabelTrack > ( ) ; auto pTrack = uTrack . get ( ) ; tracks . Add ( uTrack ) ; pTrack -> SetName ( _ ( " " ) ) ; long counter = 1 ; for ( auto & interval : intervals ) pTrack -> AddLabel ( SelectedRegion { interval . first , interval . first + interval . second } , wxString :: Format ( wxT ( " " ) , counter ++ ) ) ; history . ModifyState ( true ) ; wxTheApp -> CallAfter ( [ & ] { ShowWarningDialog ( & window , wxT ( " " ) , XO ( " \
 \n \
\n \
 \n \
\n \
 \n \
 " ) , false , XXO ( " " ) ) ; } ) ; } } } }
This is called after recording has stopped and all tracks have flushed.
This is called after recording has stopped and all tracks have flushed .
// Only push state if we were capturing and not monitoring // discard recording // Reset timer record // Add to history // We want this to have No-fail-guarantee if we get here from exception // handling of recording, and that means we rely on the last autosave // successfully committed to the database, not risking a failure // Now, we may add a label track to give information about // dropouts.  We allow failure of this. // Make a track with labels for recording errors /* i18n-hint:  A name given to a track, appearing as its menu button.
             The translation should be short or else it will not display well.
             At most, about 11 Latin characters.
             Dropout is a loss of a short sequence of audio sample data from the
             recording */ // this might fail and throw // CallAfter so that we avoid any problems of yielding // to the event loop while still inside the timer callback, // entering StopStream() recursively