Audacity 3.2.0
Public Member Functions | Public Attributes | List of all members
anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription Struct Reference
Inheritance diagram for anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription:
Collaboration diagram for anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription:

Public Member Functions

 DropoutSubscription (AudacityProject &project)
- Public Member Functions inherited from ClientData::Base
virtual ~Base ()

Public Attributes

Observer::Subscription mSubscription

Detailed Description

Definition at line 24 of file DropoutDetector.cpp.

Constructor & Destructor Documentation

◆ DropoutSubscription()

anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription::DropoutSubscription ( AudacityProject project)

Definition at line 25 of file DropoutDetector.cpp.

26 {
28 [&project](const RecordingDropoutEvent &evt){
29 // Make a track with labels for recording errors
30 auto &tracks = TrackList::Get( project );
32 /* i18n-hint: A name given to a track, appearing as its menu button.
33 The translation should be short or else it will not display well.
34 At most, about 11 Latin characters.
35 Dropout is a loss of a short sequence of audio sample data from the
36 recording */
37 auto pTrack = LabelTrack::Create(tracks, tracks.MakeUniqueTrackName(_("Dropouts")));
38 long counter = 1;
39 for (auto &interval : evt.intervals)
40 pTrack->AddLabel(
41 SelectedRegion{ interval.first,
42 interval.first + interval.second },
43 wxString::Format(wxT("%ld"), counter++));
45 auto &history = ProjectHistory::Get( project );
46 history.ModifyState( true ); // this might fail and throw
48 // CallAfter so that we avoid any problems of yielding
49 // to the event loop while still inside the timer callback,
50 // entering StopStream() recursively
51 auto &window = GetProjectFrame( project );
52 wxTheApp->CallAfter( [&window] {
53 ShowWarningDialog(&window, wxT("DropoutDetected"), XO("\
54Recorded audio was lost at the labeled locations. Possible causes:\n\
56Other applications are competing with Audacity for processor time\n\
58You are saving directly to a slow external storage device\n\
60 ),
61 false,
62 XXO("Turn off dropout detection"));
63 });
64 });
65 }
XXO("&Cut/Copy/Paste Toolbar")
#define _(s)
Definition: Internat.h:73
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
const auto tracks
const auto project
int ShowWarningDialog(wxWindow *parent, const wxString &internalDialogName, const TranslatableString &message, bool showCancelButton, const TranslatableString &footer)
Definition: Warning.cpp:90
static LabelTrack * Create(TrackList &trackList, const wxString &name)
Create a new LabelTrack with specified name and append it to the trackList.
Definition: LabelTrack.cpp:76
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
static ProjectAudioManager & Get(AudacityProject &project)
static ProjectHistory & Get(AudacityProject &project)
Defines a selected portion of a project.
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:347
Notification, after recording has stopped, when dropouts have been detected.
const Intervals & intervals
Disjoint and sorted increasingly.

References _, LabelTrack::Create(), ProjectHistory::Get(), TrackList::Get(), ProjectAudioManager::Get(), GetProjectFrame(), RecordingDropoutEvent::intervals, project, ShowWarningDialog(), Observer::Publisher< Message, NotifyAll >::Subscribe(), tracks, wxT(), XO(), and XXO().

Here is the call graph for this function:

Member Data Documentation

◆ mSubscription

Observer::Subscription anonymous_namespace{DropoutDetector.cpp}::DropoutSubscription::mSubscription

Definition at line 66 of file DropoutDetector.cpp.

The documentation for this struct was generated from the following file: