Audacity 3.2.0
Functions | Variables
anonymous_namespace{TransportMenus.cpp} Namespace Reference

Functions

bool MakeReadyToPlay (AudacityProject &project)
 
void DoMoveToLabel (AudacityProject &project, bool next)
 
bool IsLoopingEnabled (const AudacityProject &project)
 
void OnPlayOnceOrStop (const CommandContext &context)
 
void OnPlayStopSelect (const CommandContext &context)
 
void OnPlayDefaultOrStop (const CommandContext &context)
 
void OnPause (const CommandContext &context)
 
void OnRecord (const CommandContext &context)
 
void OnRecord2ndChoice (const CommandContext &context)
 
void OnPunchAndRoll (const CommandContext &context)
 
void OnTogglePlayRegion (const CommandContext &context)
 
void OnClearPlayRegion (const CommandContext &context)
 
void OnSetPlayRegionIn (const CommandContext &context)
 
void OnSetPlayRegionOut (const CommandContext &context)
 
void OnSetPlayRegionToSelection (const CommandContext &context)
 
void OnRescanDevices (const CommandContext &WXUNUSED(context))
 
void OnSoundActivated (const CommandContext &context)
 
void OnToggleSoundActivated (const CommandContext &WXUNUSED(context))
 
void OnTogglePlayRecording (const CommandContext &WXUNUSED(context))
 
void OnToggleSWPlaythrough (const CommandContext &WXUNUSED(context))
 
void OnStop (const CommandContext &context)
 
void OnPlayOneSecond (const CommandContext &context)
 
void OnPlayToSelection (const CommandContext &context)
 
void OnPlayBeforeSelectionStart (const CommandContext &context)
 
void OnPlayAfterSelectionStart (const CommandContext &context)
 
void OnPlayBeforeSelectionEnd (const CommandContext &context)
 
void OnPlayAfterSelectionEnd (const CommandContext &context)
 
void OnPlayBeforeAndAfterSelectionStart (const CommandContext &context)
 
void OnPlayBeforeAndAfterSelectionEnd (const CommandContext &context)
 
void OnPlayCutPreview (const CommandContext &context)
 
void OnMoveToPrevLabel (const CommandContext &context)
 
void OnMoveToNextLabel (const CommandContext &context)
 
auto TransportMenu ()
 
auto ExtraTransportMenu ()
 
auto ExtraSelectionItems ()
 

Variables

AttachedItem sAttachment1 { Indirect(TransportMenu()) }
 
AttachedItem sAttachment2
 
AttachedItem sAttachment4
 

Function Documentation

◆ DoMoveToLabel()

void anonymous_namespace{TransportMenus.cpp}::DoMoveToLabel ( AudacityProject project,
bool  next 
)

Definition at line 70 of file TransportMenus.cpp.

71{
72 auto &tracks = TrackList::Get( project );
73 auto &trackFocus = TrackFocus::Get( project );
74 auto &viewport = Viewport::Get(project);
75 auto &projectAudioManager = ProjectAudioManager::Get(project);
76
77 // Find the number of label tracks, and ptr to last track found
78 auto trackRange = tracks.Any<LabelTrack>();
79 auto lt = *trackRange.rbegin();
80 auto nLabelTrack = trackRange.size();
81
82 if (nLabelTrack == 0 ) {
83 trackFocus.MessageForScreenReader(XO("no label track"));
84 }
85 else if (nLabelTrack > 1) {
86 // find first label track, if any, starting at the focused track
87 lt =
88 *tracks.Find(trackFocus.Get()).Filter<LabelTrack>();
89 if (!lt)
90 trackFocus.MessageForScreenReader(
91 XO("no label track at or below focused track"));
92 }
93
94 // If there is a single label track, or there is a label track at or below
95 // the focused track
96 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
97 if (lt) {
98 int i;
99 if (next)
100 i = lt->FindNextLabel(selectedRegion);
101 else
102 i = lt->FindPrevLabel(selectedRegion);
103
104 if (i >= 0) {
105 const LabelStruct* label = lt->GetLabel(i);
106 bool newDefault = projectAudioManager.Looping();
107 if (ProjectAudioIO::Get( project ).IsAudioActive()) {
109 selectedRegion = label->selectedRegion;
110 viewport.Redraw();
112 }
113 else {
114 selectedRegion = label->selectedRegion;
115 viewport.ScrollIntoView(selectedRegion.t0());
116 viewport.Redraw();
117 }
118 /* i18n-hint:
119 String is replaced by the name of a label,
120 first number gives the position of that label in a sequence
121 of labels,
122 and the last number is the total number of labels in the sequence.
123 */
124 auto message = XO("%s %d of %d")
125 .Format( label->title, i + 1, lt->GetNumLabels() );
126 trackFocus.MessageForScreenReader(message);
127 }
128 else {
129 trackFocus.MessageForScreenReader(XO("no labels in label track"));
130 }
131 }
132}
XO("Cut/Copy/Paste")
TranslatableString label
Definition: TagsEditor.cpp:165
const auto tracks
const auto project
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:260
A LabelStruct holds information for ONE label in a LabelTrack.
Definition: LabelTrack.h:40
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98
int GetNumLabels() const
int FindPrevLabel(const SelectedRegion &currentSelection)
const LabelStruct * GetLabel(int index) const
int FindNextLabel(const SelectedRegion &currentSelection)
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectAudioManager & Get(AudacityProject &project)
Track * Get()
Definition: TrackFocus.cpp:156
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33
static bool DoStopPlaying(const CommandContext &context)
static void DoStartPlaying(const CommandContext &context, bool newDefault=false)

References TransportUtilities::DoStartPlaying(), TransportUtilities::DoStopPlaying(), LabelTrack::FindNextLabel(), LabelTrack::FindPrevLabel(), TrackFocus::Get(), ProjectAudioIO::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ProjectAudioManager::Get(), LabelTrack::GetLabel(), LabelTrack::GetNumLabels(), label, project, ViewInfo::selectedRegion, ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), tracks, and XO().

Referenced by OnMoveToNextLabel(), and OnMoveToPrevLabel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExtraSelectionItems()

auto anonymous_namespace{TransportMenus.cpp}::ExtraSelectionItems ( )

Definition at line 896 of file TransportMenus.cpp.

897{
898 static auto items = std::shared_ptr{
899 Items(wxT("MoveToLabel"),
900 Command(wxT("MoveToPrevLabel"), XXO("Move to Pre&vious Label"),
902 CaptureNotBusyFlag() | TrackPanelHasFocus(), wxT("Alt+Left")),
903 Command(wxT("MoveToNextLabel"), XXO("Move to Ne&xt Label"),
905 CaptureNotBusyFlag() | TrackPanelHasFocus(), wxT("Alt+Right"))
906 ) };
907 return items;
908}
wxT("CloseDown"))
const ReservedCommandFlag & CaptureNotBusyFlag()
const ReservedCommandFlag & TrackPanelHasFocus()
XXO("&Cut/Copy/Paste Toolbar")
constexpr auto Items
Definition: MenuRegistry.h:427
constexpr auto Command
Definition: MenuRegistry.h:456
void OnMoveToNextLabel(const CommandContext &context)
void OnMoveToPrevLabel(const CommandContext &context)

References CaptureNotBusyFlag(), MenuRegistry::Command, MenuRegistry::Items, OnMoveToNextLabel(), OnMoveToPrevLabel(), TrackPanelHasFocus(), wxT(), and XXO().

Here is the call graph for this function:

◆ ExtraTransportMenu()

auto anonymous_namespace{TransportMenus.cpp}::ExtraTransportMenu ( )

Definition at line 849 of file TransportMenus.cpp.

850{
851 static auto menu = std::shared_ptr{
852 Menu( wxT("Transport"), XXO("T&ransport"),
853 // PlayStop is already in the menus.
854 /* i18n-hint: (verb) Start playing audio*/
855 Command( wxT("Play"), XXO("Pl&ay Once"), OnPlayOnceOrStop,
857 /* i18n-hint: (verb) Stop playing audio*/
858 Command( wxT("Stop"), XXO("Sto&p"), OnStop,
860 Command( wxT("PlayOneSec"), XXO("Play &One Second"), OnPlayOneSecond,
861 CaptureNotBusyFlag(), wxT("1") ),
862 Command( wxT("PlayToSelection"), XXO("Play to &Selection"),
864 CaptureNotBusyFlag(), wxT("B") ),
865 Command( wxT("PlayBeforeSelectionStart"),
866 XXO("Play &Before Selection Start"), OnPlayBeforeSelectionStart,
867 CaptureNotBusyFlag(), wxT("Shift+F5") ),
868 Command( wxT("PlayAfterSelectionStart"),
869 XXO("Play Af&ter Selection Start"), OnPlayAfterSelectionStart,
870 CaptureNotBusyFlag(), wxT("Shift+F6") ),
871 Command( wxT("PlayBeforeSelectionEnd"),
872 XXO("Play Be&fore Selection End"), OnPlayBeforeSelectionEnd,
873 CaptureNotBusyFlag(), wxT("Shift+F7") ),
874 Command( wxT("PlayAfterSelectionEnd"),
875 XXO("Play Aft&er Selection End"), OnPlayAfterSelectionEnd,
876 CaptureNotBusyFlag(), wxT("Shift+F8") ),
877 Command( wxT("PlayBeforeAndAfterSelectionStart"),
878 XXO("Play Before a&nd After Selection Start"),
880 wxT("Ctrl+Shift+F5") ),
881 Command( wxT("PlayBeforeAndAfterSelectionEnd"),
882 XXO("Play Before an&d After Selection End"),
884 wxT("Ctrl+Shift+F7") ),
885 Command( wxT("PlayCutPreview"), XXO("Play C&ut Preview"),
887 CaptureNotBusyFlag(), wxT("C") )
888 ) };
889 return menu;
890}
const ReservedCommandFlag & AudioIOBusyFlag()
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & WaveTracksExistFlag()
const ReservedCommandFlag & CanStopAudioStreamFlag()
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition: MenuRegistry.h:445
void OnPlayToSelection(const CommandContext &context)
void OnPlayBeforeAndAfterSelectionEnd(const CommandContext &context)
void OnPlayAfterSelectionStart(const CommandContext &context)
void OnPlayBeforeSelectionEnd(const CommandContext &context)
void OnPlayAfterSelectionEnd(const CommandContext &context)
void OnPlayBeforeAndAfterSelectionStart(const CommandContext &context)
void OnPlayCutPreview(const CommandContext &context)
void OnStop(const CommandContext &context)
void OnPlayOneSecond(const CommandContext &context)
void OnPlayOnceOrStop(const CommandContext &context)
void OnPlayBeforeSelectionStart(const CommandContext &context)

References AudioIOBusyFlag(), AudioIONotBusyFlag(), CanStopAudioStreamFlag(), CaptureNotBusyFlag(), MenuRegistry::Command, MenuRegistry::Menu, OnPlayAfterSelectionEnd(), OnPlayAfterSelectionStart(), OnPlayBeforeAndAfterSelectionEnd(), OnPlayBeforeAndAfterSelectionStart(), OnPlayBeforeSelectionEnd(), OnPlayBeforeSelectionStart(), OnPlayCutPreview(), OnPlayOnceOrStop(), OnPlayOneSecond(), OnPlayToSelection(), OnStop(), WaveTracksExistFlag(), wxT(), and XXO().

Here is the call graph for this function:

◆ IsLoopingEnabled()

bool anonymous_namespace{TransportMenus.cpp}::IsLoopingEnabled ( const AudacityProject project)

Definition at line 134 of file TransportMenus.cpp.

135{
136 auto &playRegion = ViewInfo::Get(project).playRegion;
137 return playRegion.Active();
138}
bool Active() const
Definition: ViewInfo.h:125
PlayRegion playRegion
Definition: ViewInfo.h:217

References PlayRegion::Active(), ViewInfo::Get(), ViewInfo::playRegion, and project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MakeReadyToPlay()

bool anonymous_namespace{TransportMenus.cpp}::MakeReadyToPlay ( AudacityProject project)

MakeReadyToPlay stops whatever is currently playing and pops the play button up. Then, if nothing is now playing, it pushes the play button down and enables the stop button.

Definition at line 43 of file TransportMenus.cpp.

44{
45 auto &toolbar = ControlToolBar::Get( project );
46 wxCommandEvent evt;
47
48 // If this project is playing, stop playing
49 auto gAudioIO = AudioIOBase::Get();
50 if (gAudioIO->IsStreamActive(
52 )) {
53 // Make momentary changes of button appearances
54 toolbar.SetPlay(false); //Pops
55 toolbar.SetStop(); //Pushes stop down
56 toolbar.OnStop(evt);
57
58 using namespace std::chrono;
59 std::this_thread::sleep_for(100ms);
60 }
61
62 // If it didn't stop playing quickly, or if some other
63 // project is playing, return
64 if (gAudioIO->IsBusy())
65 return false;
66
67 return true;
68}
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:94
static ControlToolBar & Get(AudacityProject &project)
int GetAudioIOToken() const

References AudioIOBase::Get(), ProjectAudioIO::Get(), ControlToolBar::Get(), ProjectAudioIO::GetAudioIOToken(), and project.

Referenced by OnPlayAfterSelectionEnd(), OnPlayAfterSelectionStart(), OnPlayBeforeAndAfterSelectionEnd(), OnPlayBeforeAndAfterSelectionStart(), OnPlayBeforeSelectionEnd(), OnPlayBeforeSelectionStart(), OnPlayCutPreview(), OnPlayDefaultOrStop(), OnPlayOneSecond(), and OnPlayToSelection().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnClearPlayRegion()

void anonymous_namespace{TransportMenus.cpp}::OnClearPlayRegion ( const CommandContext context)

Definition at line 369 of file TransportMenus.cpp.

370{
372}
AudacityProject & project
void ClearPlayRegion(AudacityProject &project)

References SelectUtilities::ClearPlayRegion(), and CommandContext::project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMoveToNextLabel()

void anonymous_namespace{TransportMenus.cpp}::OnMoveToNextLabel ( const CommandContext context)

Definition at line 698 of file TransportMenus.cpp.

699{
700 auto &project = context.project;
701 DoMoveToLabel(project, true);
702}
void DoMoveToLabel(AudacityProject &project, bool next)

References DoMoveToLabel(), CommandContext::project, and project.

Referenced by ExtraSelectionItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnMoveToPrevLabel()

void anonymous_namespace{TransportMenus.cpp}::OnMoveToPrevLabel ( const CommandContext context)

Definition at line 692 of file TransportMenus.cpp.

693{
694 auto &project = context.project;
695 DoMoveToLabel(project, false);
696}

References DoMoveToLabel(), CommandContext::project, and project.

Referenced by ExtraSelectionItems().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPause()

void anonymous_namespace{TransportMenus.cpp}::OnPause ( const CommandContext context)

Definition at line 182 of file TransportMenus.cpp.

References ProjectAudioManager::Get(), ProjectAudioManager::OnPause(), and CommandContext::project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayAfterSelectionEnd()

void anonymous_namespace{TransportMenus.cpp}::OnPlayAfterSelectionEnd ( const CommandContext context)

Definition at line 600 of file TransportMenus.cpp.

601{
602 auto &project = context.project;
603
605 return;
606
607 auto &viewInfo = ViewInfo::Get( project );
608 const auto &selectedRegion = viewInfo.selectedRegion;
609
610 double t1 = selectedRegion.t1();
611 double afterLen;
612 gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
613
614 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
615
617 context, SelectedRegion(t1, t1 + afterLen),
618 playOptions, PlayMode::oneSecondPlay);
619}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
static AudioIOStartStreamOptions GetDefaultOptions(AudacityProject &project, bool newDefaults=false)
Invoke the global hook, supplying a default argument.
Defines a selected portion of a project.
virtual bool Read(const wxString &key, bool *value) const =0
bool MakeReadyToPlay(AudacityProject &project)
static void PlayPlayRegionAndWait(const CommandContext &context, const SelectedRegion &selectedRegion, const AudioIOStartStreamOptions &options, PlayMode mode)

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayAfterSelectionStart()

void anonymous_namespace{TransportMenus.cpp}::OnPlayAfterSelectionStart ( const CommandContext context)

Definition at line 546 of file TransportMenus.cpp.

547{
548 auto &project = context.project;
549
551 return;
552
553 auto &viewInfo = ViewInfo::Get( project );
554 const auto &selectedRegion = viewInfo.selectedRegion;
555
556 double t0 = selectedRegion.t0();
557 double t1 = selectedRegion.t1();
558 double afterLen;
559 gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
560
561 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
562
563 if ( t1 - t0 > 0.0 && t1 - t0 < afterLen )
565 context, SelectedRegion(t0, t1),
566 playOptions, PlayMode::oneSecondPlay);
567 else
569 context, SelectedRegion(t0, t0 + afterLen),
570 playOptions, PlayMode::oneSecondPlay);
571}

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayBeforeAndAfterSelectionEnd()

void anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeAndAfterSelectionEnd ( const CommandContext context)

Definition at line 651 of file TransportMenus.cpp.

653{
654 auto &project = context.project;
655
657 return;
658
659 auto &viewInfo = ViewInfo::Get( project );
660 const auto &selectedRegion = viewInfo.selectedRegion;
661
662 double t0 = selectedRegion.t0();
663 double t1 = selectedRegion.t1();
664 double beforeLen;
665 gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
666 double afterLen;
667 gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
668
669 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
670
671 if ( t1 - t0 > 0.0 && t1 - t0 < beforeLen )
673 context, SelectedRegion(t0, t1 + afterLen),
674 playOptions, PlayMode::oneSecondPlay);
675 else
677 context, SelectedRegion(t1 - beforeLen, t1 + afterLen),
678 playOptions, PlayMode::oneSecondPlay);
679}

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayBeforeAndAfterSelectionStart()

void anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeAndAfterSelectionStart ( const CommandContext context)

Definition at line 621 of file TransportMenus.cpp.

623{
624 auto &project = context.project;
625
627 return;
628
629 auto &viewInfo = ViewInfo::Get( project );
630 const auto &selectedRegion = viewInfo.selectedRegion;
631
632 double t0 = selectedRegion.t0();
633 double t1 = selectedRegion.t1();
634 double beforeLen;
635 gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
636 double afterLen;
637 gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
638
639 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
640
641 if ( t1 - t0 > 0.0 && t1 - t0 < afterLen )
643 context, SelectedRegion(t0 - beforeLen, t1),
644 playOptions, PlayMode::oneSecondPlay);
645 else
647 context, SelectedRegion(t0 - beforeLen, t0 + afterLen),
648 playOptions, PlayMode::oneSecondPlay);
649}

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayBeforeSelectionEnd()

void anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeSelectionEnd ( const CommandContext context)

Definition at line 573 of file TransportMenus.cpp.

574{
575 auto &project = context.project;
576
578 return;
579
580 auto &viewInfo = ViewInfo::Get( project );
581 const auto &selectedRegion = viewInfo.selectedRegion;
582
583 double t0 = selectedRegion.t0();
584 double t1 = selectedRegion.t1();
585 double beforeLen;
586 gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
587
588 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
589
590 if ( t1 - t0 > 0.0 && t1 - t0 < beforeLen )
592 context, SelectedRegion(t0, t1),
593 playOptions, PlayMode::oneSecondPlay);
594 else
596 context, SelectedRegion(t1 - beforeLen, t1),
597 playOptions, PlayMode::oneSecondPlay);
598}

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayBeforeSelectionStart()

void anonymous_namespace{TransportMenus.cpp}::OnPlayBeforeSelectionStart ( const CommandContext context)

Definition at line 525 of file TransportMenus.cpp.

526{
527 auto &project = context.project;
528
530 return;
531
532 auto &viewInfo = ViewInfo::Get( project );
533 const auto &selectedRegion = viewInfo.selectedRegion;
534
535 double t0 = selectedRegion.t0();
536 double beforeLen;
537 gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
538
539 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
540
542 context, SelectedRegion(t0 - beforeLen, t0),
543 playOptions, PlayMode::oneSecondPlay);
544}

References ViewInfo::Get(), ProjectAudioIO::GetDefaultOptions(), gPrefs, MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayCutPreview()

void anonymous_namespace{TransportMenus.cpp}::OnPlayCutPreview ( const CommandContext context)

Definition at line 681 of file TransportMenus.cpp.

682{
683 auto &project = context.project;
684
685 if ( !MakeReadyToPlay(project) )
686 return;
687
688 // Play with cut preview
690}
static void PlayCurrentRegionAndWait(const CommandContext &context, bool newDefault=false, bool cutpreview=false)

References MakeReadyToPlay(), TransportUtilities::PlayCurrentRegionAndWait(), CommandContext::project, and project.

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayDefaultOrStop()

void anonymous_namespace{TransportMenus.cpp}::OnPlayDefaultOrStop ( const CommandContext context)

Definition at line 168 of file TransportMenus.cpp.

169{
170 auto &project = context.project;
172 return;
173
175 return;
176
177 // Now play in a loop
178 // Will automatically set mLastPlayMode
180}

References TransportUtilities::DoStopPlaying(), MakeReadyToPlay(), TransportUtilities::PlayCurrentRegionAndWait(), CommandContext::project, and project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayOnceOrStop()

void anonymous_namespace{TransportMenus.cpp}::OnPlayOnceOrStop ( const CommandContext context)

Definition at line 154 of file TransportMenus.cpp.

155{
157 return;
159}

References TransportUtilities::DoStartPlaying(), TransportUtilities::DoStopPlaying(), and CommandContext::project.

Referenced by ExtraTransportMenu(), and TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayOneSecond()

void anonymous_namespace{TransportMenus.cpp}::OnPlayOneSecond ( const CommandContext context)

Definition at line 456 of file TransportMenus.cpp.

457{
458 auto &project = context.project;
460 return;
461
462 auto &trackPanel = TrackPanel::Get( project );
464
465 double pos = trackPanel.GetMostRecentXPos();
467 context, SelectedRegion(pos - 0.5, pos + 0.5),
468 options, PlayMode::oneSecondPlay);
469}
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234

References TrackPanel::Get(), ProjectAudioIO::GetDefaultOptions(), MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, and project.

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayStopSelect()

void anonymous_namespace{TransportMenus.cpp}::OnPlayStopSelect ( const CommandContext context)

Definition at line 161 of file TransportMenus.cpp.

162{
164}
bool DoPlayStopSelect(bool click, bool shift)

References ProjectAudioManager::DoPlayStopSelect(), ProjectAudioManager::Get(), and CommandContext::project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPlayToSelection()

void anonymous_namespace{TransportMenus.cpp}::OnPlayToSelection ( const CommandContext context)

The idea for this function (and first implementation) was from Juhana Sadeharju. The function plays the sound between the current mouse position and the nearest selection boundary. This gives four possible play regions depending on where the current mouse position is relative to the left and right boundaries of the selection region.

Definition at line 478 of file TransportMenus.cpp.

479{
480 auto &project = context.project;
481
483 return;
484
485 auto &trackPanel = TrackPanel::Get( project );
486 auto &viewInfo = ViewInfo::Get( project );
487 const auto &selectedRegion = viewInfo.selectedRegion;
488
489 double pos = trackPanel.GetMostRecentXPos();
490
491 double t0,t1;
492 // check region between pointer and the nearest selection edge
493 if (fabs(pos - selectedRegion.t0()) <
494 fabs(pos - selectedRegion.t1())) {
495 t0 = t1 = selectedRegion.t0();
496 } else {
497 t0 = t1 = selectedRegion.t1();
498 }
499 if( pos < t1)
500 t0=pos;
501 else
502 t1=pos;
503
504 // JKC: oneSecondPlay mode disables auto scrolling
505 // On balance I think we should always do this in this function
506 // since you are typically interested in the sound EXACTLY
507 // where the cursor is.
508 // TODO: have 'playing attributes' such as 'with_autoscroll'
509 // rather than modes, since that's how we're now using the modes.
510
511 // An alternative, commented out below, is to disable autoscroll
512 // only when playing a short region, less than or equal to a second.
513// mLastPlayMode = ((t1-t0) > 1.0) ? normalPlay : oneSecondPlay;
514
515 auto playOptions = ProjectAudioIO::GetDefaultOptions(project);
516
518 context, SelectedRegion(t0, t1),
519 playOptions, PlayMode::oneSecondPlay);
520}

References ViewInfo::Get(), TrackPanel::Get(), ProjectAudioIO::GetDefaultOptions(), MakeReadyToPlay(), oneSecondPlay, TransportUtilities::PlayPlayRegionAndWait(), CommandContext::project, and project.

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnPunchAndRoll()

void anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll ( const CommandContext context)

Definition at line 199 of file TransportMenus.cpp.

200{
202 auto &viewInfo = ViewInfo::Get( project );
203
204 static const auto url =
205 wxT("Punch_and_Roll_Record#Using_Punch_and_Roll_Record");
206
207 auto gAudioIO = AudioIO::Get();
208 if (gAudioIO->IsBusy())
209 return;
210
211 // Ignore all but left edge of the selection.
212 viewInfo.selectedRegion.collapseToT0();
213 double t1 = std::max(0.0, viewInfo.selectedRegion.t1());
214
215 // Checking the selected tracks: making sure they all have the same rate
216 const auto selectedTracks{ GetPropertiesOfSelected(project) };
217 const int rateOfSelected{ selectedTracks.rateOfSelected };
218 const bool allSameRate{ selectedTracks.allSameRate };
219
220 if (!allSameRate) {
221 AudacityMessageBox(XO("The tracks selected "
222 "for recording must all have the same sampling rate"),
223 XO("Mismatched Sampling Rates"),
224 wxICON_ERROR | wxCENTRE);
225
226 return;
227 }
228
229 // Decide which tracks to record in.
230 auto tracks =
232 if (tracks.empty()) {
233 auto recordingChannels =
234 std::max(0, AudioIORecordChannels.Read());
235 auto message =
236 (recordingChannels == 1)
237 ? XO("Please select in a mono track.")
238 : (recordingChannels == 2)
239 ? XO("Please select in a stereo track or two mono tracks.")
240 : XO("Please select at least %d channels.").Format( recordingChannels );
242 XO("Error"), message, url);
243 return;
244 }
245
246 // Delete the portion of the target tracks right of the selection, but first,
247 // remember a part of the deletion for crossfading with the new recording.
248 // We may also adjust the starting point leftward if it is too close to the
249 // end of the track, so that at least some nonzero crossfade data can be
250 // taken.
251 PRCrossfadeData crossfadeData;
252 const double crossFadeDuration = std::max(0.0,
254 / 1000.0
255 );
256
257 // The test for t1 == 0.0 stops punch and roll deleting everything where the
258 // selection is at zero. There wouldn't be any cued audio to play in
259 // that case, so a normal record, not a punch and roll, is called for.
260 bool error = (t1 == 0.0);
261
262 double newt1 = t1;
263 for (const auto &wt : tracks) {
264 auto rate = wt->GetRate();
265 sampleCount testSample(floor(t1 * rate));
266 const auto &intervals = as_const(*wt).Intervals();
267 auto pred = [rate](sampleCount testSample){ return
268 [rate, testSample](const auto &pInterval){
269 auto start = floor(pInterval->Start() * rate + 0.5);
270 auto end = floor(pInterval->End() * rate + 0.5);
271 auto ts = testSample.as_double();
272 return ts >= start && ts < end;
273 };
274 };
275 auto begin = intervals.begin(), end = intervals.end(),
276 iter = std::find_if(begin, end, pred(testSample));
277 if (iter == end)
278 // Bug 1890 (an enhancement request)
279 // Try again, a little to the left.
280 // Subtract 10 to allow a selection exactly at or slightly after the
281 // end time
282 iter = std::find_if(begin, end, pred(testSample - 10));
283 if (iter == end)
284 error = true;
285 else {
286 // May adjust t1 left
287 // Let's ignore the possibility of a clip even shorter than the
288 // crossfade duration!
289 newt1 = std::min(newt1, (*iter).get()->End() - crossFadeDuration);
290 }
291 }
292
293 if (error) {
294 auto message = XO("Please select a time within a clip.");
296 *ProjectFramePlacement(&project), XO("Error"), message, url);
297 return;
298 }
299
300 t1 = newt1;
301 for (const auto &wt : tracks) {
302 const auto endTime = wt->GetEndTime();
303 const auto duration =
304 std::max(0.0, std::min(crossFadeDuration, endTime - t1));
305 const size_t getLen = floor(duration * wt->GetRate());
306 if (getLen > 0) {
307 // TODO more-than-two-channels
308 const auto nChannels = std::min<size_t>(2, wt->NChannels());
309 crossfadeData.resize(nChannels);
310 float *buffers[2]{};
311 for (size_t ii = 0; ii < nChannels; ++ii) {
312 auto &data = crossfadeData[ii];
313 data.resize(getLen);
314 buffers[ii] = data.data();
315 }
316 const sampleCount pos = wt->TimeToLongSamples(t1);
317 if (!wt->GetFloats(0, nChannels, buffers, pos, getLen))
318 // TODO error message
319 return;
320 }
321 }
322
323 // Change tracks only after passing the error checks above
324 for (const auto &wt : tracks)
325 wt->Clear(t1, wt->GetEndTime());
326
327 // Choose the tracks for playback.
328 TransportSequences transportTracks;
329 const auto duplex = ProjectAudioManager::UseDuplex();
330 if (duplex)
331 // play all
332 transportTracks = MakeTransportTracks(
333 TrackList::Get( project ), false, true);
334 else
335 // play recording tracks only
336 for (auto &pTrack : tracks)
337 transportTracks.playbackSequences.push_back(pTrack);
338
339 // Unlike with the usual recording, a track may be chosen both for playback
340 // and recording.
341 std::copy(tracks.begin(), tracks.end(),
342 back_inserter(transportTracks.captureSequences));
343
344 // Try to start recording
346 options.rate = rateOfSelected;
347 options.preRoll = std::max(0.0,
349 options.pCrossfadeData = &crossfadeData;
351 transportTracks,
352 t1, DBL_MAX,
353 false, // altAppearance
354 options);
355
356 if (success)
357 // Undo state will get pushed elsewhere, when record finishes
358 ;
359 else
360 // Roll back the deletions
362}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
IntSetting AudioIORecordChannels
std::vector< std::vector< float > > PRCrossfadeData
Definition: AudioIOBase.h:38
int min(int a, int b)
std::unique_ptr< const BasicUI::WindowPlacement > ProjectFramePlacement(AudacityProject *project)
Make a WindowPlacement object suitable for project (which may be null)
Definition: Project.cpp:129
PropertiesOfSelected GetPropertiesOfSelected(const AudacityProject &proj)
#define AUDIO_PRE_ROLL_KEY
#define DEFAULT_PRE_ROLL_SECONDS
#define DEFAULT_ROLL_CROSSFADE_MS
#define AUDIO_ROLL_CROSSFADE_KEY
TransportSequences MakeTransportTracks(TrackList &trackList, bool selectedOnly, bool nonWaveToo)
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static AudioIO * Get()
Definition: AudioIO.cpp:126
static WritableSampleTrackArray ChooseExistingRecordingTracks(AudacityProject &proj, bool selectedOnly, double targetRate=RATE_NOT_SELECTED)
Find suitable tracks to record into, or return an empty array.
bool DoRecord(AudacityProject &project, const TransportSequences &transportSequences, double t0, double t1, bool altAppearance, const AudioIOStartStreamOptions &options)
static ProjectHistory & Get(AudacityProject &project)
bool Read(T *pVar) const
overload of Read returning a boolean that is true if the value was previously defined *‍/
Definition: Prefs.h:207
Positions or offsets within audio files need a wide type.
Definition: SampleCount.h:19
void ShowErrorDialog(const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
Show an error dialog with a link to the manual for further help.
Definition: BasicUI.h:272
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
const char * begin(const char *str) noexcept
Definition: StringUtils.h:101
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40
RecordableSequences captureSequences
Definition: AudioIO.h:73
ConstPlayableSequences playbackSequences
Definition: AudioIO.h:72

References sampleCount::as_double(), AudacityMessageBox(), AUDIO_PRE_ROLL_KEY, AUDIO_ROLL_CROSSFADE_KEY, AudioIORecordChannels, details::begin(), TransportSequences::captureSequences, ProjectAudioManager::ChooseExistingRecordingTracks(), staffpad::vo::copy(), DEFAULT_PRE_ROLL_SECONDS, DEFAULT_ROLL_CROSSFADE_MS, ProjectAudioManager::DoRecord(), details::end(), AudioIO::Get(), ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), ProjectAudioManager::Get(), ProjectAudioIO::GetDefaultOptions(), GetPropertiesOfSelected(), gPrefs, MakeTransportTracks(), min(), TransportSequences::playbackSequences, CommandContext::project, project, ProjectFramePlacement(), PropertiesOfSelected::rateOfSelected, audacity::BasicSettings::Read(), Setting< T >::Read(), ProjectHistory::RollbackState(), BasicUI::ShowErrorDialog(), tracks, ProjectAudioManager::UseDuplex(), wxT(), and XO().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRecord()

void anonymous_namespace{TransportMenus.cpp}::OnRecord ( const CommandContext context)

Definition at line 187 of file TransportMenus.cpp.

188{
189 TransportUtilities::RecordAndWait(context, false);
190}
static void RecordAndWait(const CommandContext &context, bool altAppearance)

References TransportUtilities::RecordAndWait().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRecord2ndChoice()

void anonymous_namespace{TransportMenus.cpp}::OnRecord2ndChoice ( const CommandContext context)

Definition at line 194 of file TransportMenus.cpp.

195{
197}

References TransportUtilities::RecordAndWait().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnRescanDevices()

void anonymous_namespace{TransportMenus.cpp}::OnRescanDevices ( const CommandContext WXUNUSEDcontext)

Definition at line 400 of file TransportMenus.cpp.

401{
403}
static DeviceManager * Instance()
Gets the singleton instance.

References DeviceManager::Instance(), and DeviceManager::Rescan().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSetPlayRegionIn()

void anonymous_namespace{TransportMenus.cpp}::OnSetPlayRegionIn ( const CommandContext context)

Definition at line 374 of file TransportMenus.cpp.

375{
376 auto &project = context.project;
377 auto &playRegion = ViewInfo::Get(project).playRegion;
378 if (!playRegion.Active())
381 true, false, SetLoopInTitle.Stripped());
382}
static const auto SetLoopInTitle
void ActivatePlayRegion(AudacityProject &project)
void OnSetRegion(AudacityProject &project, bool left, bool selection, const TranslatableString &dialogTitle)
Adjust left or right of selection or play region.

References SelectUtilities::ActivatePlayRegion(), ViewInfo::Get(), SelectUtilities::OnSetRegion(), ViewInfo::playRegion, CommandContext::project, project, and SetLoopInTitle.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSetPlayRegionOut()

void anonymous_namespace{TransportMenus.cpp}::OnSetPlayRegionOut ( const CommandContext context)

Definition at line 385 of file TransportMenus.cpp.

386{
387 auto &project = context.project;
388 auto &playRegion = ViewInfo::Get(project).playRegion;
389 if (!playRegion.Active())
392 false, false, SetLoopOutTitle.Stripped());
393}
static const auto SetLoopOutTitle

References SelectUtilities::ActivatePlayRegion(), ViewInfo::Get(), SelectUtilities::OnSetRegion(), ViewInfo::playRegion, CommandContext::project, project, and SetLoopOutTitle.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSetPlayRegionToSelection()

void anonymous_namespace{TransportMenus.cpp}::OnSetPlayRegionToSelection ( const CommandContext context)

Definition at line 395 of file TransportMenus.cpp.

396{
398}
void SetPlayRegionToSelection(AudacityProject &project)

References CommandContext::project, and SelectUtilities::SetPlayRegionToSelection().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnSoundActivated()

void anonymous_namespace{TransportMenus.cpp}::OnSoundActivated ( const CommandContext context)

Definition at line 405 of file TransportMenus.cpp.

406{
408
409 SoundActivatedRecordDialog dialog( &GetProjectFrame( project ) /* parent */ );
410 dialog.ShowModal();
411}
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 ...
Configures sound activated recording.

References GetProjectFrame(), CommandContext::project, and project.

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnStop()

void anonymous_namespace{TransportMenus.cpp}::OnStop ( const CommandContext context)

Definition at line 451 of file TransportMenus.cpp.

452{
454}
void Stop(bool stopStream=true)

References ProjectAudioManager::Get(), CommandContext::project, and ProjectAudioManager::Stop().

Referenced by ExtraTransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTogglePlayRecording()

void anonymous_namespace{TransportMenus.cpp}::OnTogglePlayRecording ( const CommandContext WXUNUSEDcontext)

Definition at line 420 of file TransportMenus.cpp.

421{
422 bool Duplex;
423 gPrefs->Read(wxT("/AudioIO/Duplex"), &Duplex, true);
424 gPrefs->Write(wxT("/AudioIO/Duplex"), !Duplex);
425 gPrefs->Flush();
427}
static void ModifyAllProjectToolbarMenus()
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

References audacity::BasicSettings::Flush(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), audacity::BasicSettings::Read(), audacity::BasicSettings::Write(), and wxT().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnTogglePlayRegion()

void anonymous_namespace{TransportMenus.cpp}::OnTogglePlayRegion ( const CommandContext context)

Definition at line 364 of file TransportMenus.cpp.

365{
367}
void TogglePlayRegion(AudacityProject &project)

References CommandContext::project, and SelectUtilities::TogglePlayRegion().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnToggleSoundActivated()

void anonymous_namespace{TransportMenus.cpp}::OnToggleSoundActivated ( const CommandContext WXUNUSEDcontext)

Definition at line 413 of file TransportMenus.cpp.

414{
416 gPrefs->Flush();
418}
BoolSetting SoundActivatedRecord
Definition: AudioIO.cpp:3370
bool Toggle()
Write the negation of the previous value, and return true if successful.
Definition: Prefs.cpp:555

References audacity::BasicSettings::Flush(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), SoundActivatedRecord, and BoolSetting::Toggle().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnToggleSWPlaythrough()

void anonymous_namespace{TransportMenus.cpp}::OnToggleSWPlaythrough ( const CommandContext WXUNUSEDcontext)

Definition at line 429 of file TransportMenus.cpp.

430{
431 bool SWPlaythrough;
432 gPrefs->Read(wxT("/AudioIO/SWPlaythrough"), &SWPlaythrough, false);
433 gPrefs->Write(wxT("/AudioIO/SWPlaythrough"), !SWPlaythrough);
434 gPrefs->Flush();
436}

References audacity::BasicSettings::Flush(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), audacity::BasicSettings::Read(), audacity::BasicSettings::Write(), and wxT().

Referenced by TransportMenu().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransportMenu()

auto anonymous_namespace{TransportMenus.cpp}::TransportMenu ( )

Definition at line 726 of file TransportMenus.cpp.

727{
728 static const auto CanStopFlags =
730 static auto menu = std::shared_ptr{
731 /* i18n-hint: 'Transport' is the name given to the set of controls that
732 play, record, pause etc. */
733 Menu( wxT("Transport"), XXO("Tra&nsport"),
734 Section( "Basic",
735 Menu( wxT("Play"), XXO("Pl&aying"),
736 /* i18n-hint: (verb) Start or Stop audio playback*/
737 Command( wxT("DefaultPlayStop"), XXO("Pl&ay/Stop"), OnPlayDefaultOrStop,
738 CanStopAudioStreamFlag(), wxT("Space") ),
739 Command( wxT("PlayStopSelect"), XXO("Play/Stop and &Set Cursor"),
741 Command( wxT("OncePlayStop"), XXO("Play &Once/Stop"), OnPlayOnceOrStop,
742 CanStopAudioStreamFlag(), wxT("Shift+Space") ),
743 Command( wxT("Pause"), XXO("&Pause"), OnPause,
745 ),
746
747 Menu( wxT("Record"), XXO("&Recording"),
748 /* i18n-hint: (verb)*/
749 Command( wxT("Record1stChoice"), XXO("&Record"), OnRecord,
750 CanStopFlags, wxT("R") ),
751
752 // The OnRecord2ndChoice function is: if normal record records beside,
753 // it records below, if normal record records below, it records beside.
754 // TODO: Do 'the right thing' with other options like TimerRecord.
755 // Delayed evaluation in case gPrefs is not yet defined
756 [](const AudacityProject&)
757 { return Command( wxT("Record2ndChoice"),
758 // Our first choice is bound to R (by default)
759 // and gets the prime position.
760 // We supply the name for the 'other one' here.
761 // It should be bound to Shift+R
762 (gPrefs->ReadBool("/GUI/PreferNewTrackRecord", false)
763 ? XXO("&Append Record") : XXO("Record &New Track")),
765 wxT("Shift+R")
766 ); },
767
768 Command( wxT("PunchAndRoll"), XXO("Punch and Rol&l Record"),
770 WaveTracksExistFlag() | AudioIONotBusyFlag(), wxT("Shift+D") ),
771
772 // JKC: I decided to duplicate this between play and record,
773 // rather than put it at the top level.
774 // CommandManger::AddItem can now cope with simple duplicated items.
775 // PRL: caution, this is a duplicated command name!
776 Command( wxT("Pause"), XXO("&Pause"), OnPause,
778 )
779 ),
780
781 Section( "Other",
782 Section( "",
783 Menu( wxT("PlayRegion"), XXO("&Looping"),
784 Command( wxT("TogglePlayRegion"), LoopToggleText,
786 Options(L"L").CheckTest([](const AudacityProject& project){
788 } )),
789 Command( wxT("ClearPlayRegion"), XXO("&Clear Loop"),
790 OnClearPlayRegion, AlwaysEnabledFlag, L"Shift+Alt+L" ),
791 Command( wxT("SetPlayRegionToSelection"),
792 XXO("&Set Loop to Selection"),
794 L"Shift+L" ),
795 Command( wxT("SetPlayRegionIn"),
798 Command( wxT("SetPlayRegionOut"),
801 )
802 ),
803
804 Command( wxT("RescanDevices"), XXO("R&escan Audio Devices"),
806
807 Menu( wxT("Options"), XXO("Transport &Options"),
808 Section( "Part1",
809 // Sound Activated recording options
810 Command( wxT("SoundActivationLevel"),
811 XXO("Set sound activation le&vel..."), OnSoundActivated,
813 Command( wxT("SoundActivation"),
814 XXO("Enable sound a&ctivated recording"),
818 ),
819
820 Section( "Part2",
821 Command( wxT("Overdub"), XXO("Hear &other tracks during recording"),
824 Options{}.CheckTest( wxT("/AudioIO/Duplex"), true) ),
825 Command( wxT("SWPlaythrough"), XXO("Enable audible input &monitoring"),
828 Options{}.CheckTest( wxT("/AudioIO/SWPlaythrough"), false ) )
829
830
831 #ifdef EXPERIMENTAL_AUTOMATED_INPUT_LEVEL_ADJUSTMENT
832 ,
833 Command( wxT("AutomatedInputLevelAdjustmentOnOff"),
834 XXO("A&utomated Recording Level Adjustment (on/off)"),
835 OnToggleAutomatedInputLevelAdjustment,
838 wxT("/AudioIO/AutomatedInputLevelAdjustment"), false ) )
839 #endif
840 )
841 )
842 )
843 ) };
844 return menu;
845}
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
const TranslatableString LoopToggleText
Definition: ViewInfo.cpp:227
bool ReadBool(const wxString &key, bool defaultValue) const
constexpr auto Section
Definition: MenuRegistry.h:436
void OnSetPlayRegionToSelection(const CommandContext &context)
void OnTogglePlayRecording(const CommandContext &WXUNUSED(context))
void OnSetPlayRegionIn(const CommandContext &context)
void OnToggleSWPlaythrough(const CommandContext &WXUNUSED(context))
void OnSoundActivated(const CommandContext &context)
void OnToggleSoundActivated(const CommandContext &WXUNUSED(context))
void OnSetPlayRegionOut(const CommandContext &context)
void OnRecord(const CommandContext &context)
void OnRecord2ndChoice(const CommandContext &context)
void OnPause(const CommandContext &context)
void OnPunchAndRoll(const CommandContext &context)
void OnPlayDefaultOrStop(const CommandContext &context)
void OnRescanDevices(const CommandContext &WXUNUSED(context))
void OnPlayStopSelect(const CommandContext &context)
void OnTogglePlayRegion(const CommandContext &context)
void OnClearPlayRegion(const CommandContext &context)
bool IsLoopingEnabled(const AudacityProject &project)
Options && CheckTest(const CheckFn &fn) &&
Definition: MenuRegistry.h:74

References AlwaysEnabledFlag, AudioIONotBusyFlag(), CanStopAudioStreamFlag(), anonymous_namespace{TimerRecordDialog.cpp}::CanStopFlags, MenuRegistry::Options::CheckTest(), MenuRegistry::Command, gPrefs, IsLoopingEnabled(), LoopToggleText, MenuRegistry::Menu, OnClearPlayRegion(), OnPause(), OnPlayDefaultOrStop(), OnPlayOnceOrStop(), OnPlayStopSelect(), OnPunchAndRoll(), OnRecord(), OnRecord2ndChoice(), OnRescanDevices(), OnSetPlayRegionIn(), OnSetPlayRegionOut(), OnSetPlayRegionToSelection(), OnSoundActivated(), OnTogglePlayRecording(), OnTogglePlayRegion(), OnToggleSoundActivated(), OnToggleSWPlaythrough(), project, audacity::BasicSettings::ReadBool(), MenuRegistry::Section, SetLoopInTitle, SetLoopOutTitle, SoundActivatedRecord, WaveTracksExistFlag(), wxT(), and XXO().

Here is the call graph for this function:

Variable Documentation

◆ sAttachment1

AttachedItem anonymous_namespace{TransportMenus.cpp}::sAttachment1 { Indirect(TransportMenu()) }

Definition at line 847 of file TransportMenus.cpp.

◆ sAttachment2

AttachedItem anonymous_namespace{TransportMenus.cpp}::sAttachment2
Initial value:
wxT("Optional/Extra/Part1")
}
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.
Definition: Registry.h:175

Definition at line 892 of file TransportMenus.cpp.

◆ sAttachment4

AttachedItem anonymous_namespace{TransportMenus.cpp}::sAttachment4
Initial value:
{ wxT("Optional/Extra/Part1/Select"), { OrderingHint::End, {} } }
}

Definition at line 910 of file TransportMenus.cpp.