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

Enumerations

enum  {
  kAlignStartZero = 0 , kAlignStartSelStart , kAlignStartSelEnd , kAlignEndSelStart ,
  kAlignEndSelEnd , kAlignEndToEnd , kAlignTogether
}
 
enum  { kAudacitySortByTime = (1 << 1) , kAudacitySortByName = (1 << 2) }
 

Functions

void DoMixAndRender (AudacityProject &project, bool toNewTrack)
 
void DoPanTracks (AudacityProject &project, float PanValue)
 
static const std::vector< ComponentInterfaceSymbol > & alignLabels ()
 
const size_t kAlignLabelsCount ()
 
void DoAlign (AudacityProject &project, int index, bool moveSel)
 
void DoSortTracks (AudacityProject &project, int flags)
 
void SetTrackGain (AudacityProject &project, WaveTrack *wt, LWSlider *slider)
 
void SetTrackPan (AudacityProject &project, WaveTrack *wt, LWSlider *slider)
 
void OnStereoToMono (const CommandContext &context)
 
void OnMixAndRender (const CommandContext &context)
 
void OnMixAndRenderToNewTrack (const CommandContext &context)
 
void OnResample (const CommandContext &context)
 
void OnRemoveTracks (const CommandContext &context)
 
static void MuteTracks (const CommandContext &context, bool mute, bool selected)
 
void OnMuteAllTracks (const CommandContext &context)
 
void OnUnmuteAllTracks (const CommandContext &context)
 
void OnMuteSelectedTracks (const CommandContext &context)
 
void OnUnmuteSelectedTracks (const CommandContext &context)
 
void OnPanLeft (const CommandContext &context)
 
void OnPanRight (const CommandContext &context)
 
void OnPanCenter (const CommandContext &context)
 
void OnAlignNoSync (const CommandContext &context)
 
void OnAlign (const CommandContext &context)
 
void OnMoveSelectionWithTracks (const CommandContext &WXUNUSED(context))
 
void OnSortTime (const CommandContext &context)
 
void OnSortName (const CommandContext &context)
 
void OnSyncLock (const CommandContext &context)
 
void OnTrackPan (const CommandContext &context)
 
void OnTrackPanLeft (const CommandContext &context)
 
void OnTrackPanRight (const CommandContext &context)
 
void OnTrackGain (const CommandContext &context)
 
void OnTrackGainInc (const CommandContext &context)
 
void OnTrackGainDec (const CommandContext &context)
 
void OnTrackMenu (const CommandContext &context)
 
void OnTrackMute (const CommandContext &context)
 
void OnTrackSolo (const CommandContext &context)
 
void OnTrackClose (const CommandContext &context)
 
void OnTrackMoveUp (const CommandContext &context)
 
void OnTrackMoveDown (const CommandContext &context)
 
void OnTrackMoveTop (const CommandContext &context)
 
void OnTrackMoveBottom (const CommandContext &context)
 
auto TracksMenu ()
 
auto ExtraTrackMenu ()
 

Variables

AttachedItem sAttachment1 { Indirect(TracksMenu()) }
 
AttachedItem sAttachment2
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kAlignStartZero 
kAlignStartSelStart 
kAlignStartSelEnd 
kAlignEndSelStart 
kAlignEndSelEnd 
kAlignEndToEnd 
kAlignTogether 

Definition at line 147 of file TrackMenus.cpp.

◆ anonymous enum

anonymous enum
Enumerator
kAudacitySortByTime 
kAudacitySortByName 

Definition at line 456 of file TrackMenus.cpp.

Function Documentation

◆ alignLabels()

static const std::vector< ComponentInterfaceSymbol > & anonymous_namespace{TrackMenus.cpp}::alignLabels ( )
static

Definition at line 159 of file TrackMenus.cpp.

159 { static std::vector< ComponentInterfaceSymbol > symbols{
160 { wxT("StartToZero"), XXO("Start to &Zero") },
161 { wxT("StartToSelStart"), XXO("Start to &Cursor/Selection Start") },
162 { wxT("StartToSelEnd"), XXO("Start to Selection &End") },
163 { wxT("EndToSelStart"), XXO("End to Cu&rsor/Selection Start") },
164 { wxT("EndToSelEnd"), XXO("End to Selection En&d") },
165}; return symbols; }
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")

References wxT(), and XXO().

Referenced by kAlignLabelsCount(), and TracksMenu().

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

◆ DoAlign()

void anonymous_namespace{TrackMenus.cpp}::DoAlign ( AudacityProject project,
int  index,
bool  moveSel 
)

Definition at line 169 of file TrackMenus.cpp.

170{
171 auto &tracks = TrackList::Get( project );
172 auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
173 auto &viewport = Viewport::Get(project);
174
175 TranslatableString action, shortAction;
176 double delta = 0.0;
177 double newPos = -1.0;
178
179 auto trackRange = tracks.Selected<AudioTrack>();
180
181 auto FindOffset =
182 [](const Track *pTrack) { return pTrack->GetStartTime(); };
183
184 auto firstTrackOffset = [&]{ return FindOffset( *trackRange.begin() ); };
185 auto minOffset = [&]{ return trackRange.min( FindOffset ); };
186 auto avgOffset = [&]{
187 return trackRange.sum( FindOffset ) /
188 std::max( size_t(1), trackRange.size() ); };
189
190 auto maxEndOffset = [&]{
191 return std::max(0.0, trackRange.max(&Track::GetEndTime)); };
192
193 switch(index) {
194 case kAlignStartZero:
195 delta = -minOffset();
196 action = moveSel
197 /* i18n-hint: In this and similar messages describing editing actions,
198 the starting or ending points of tracks are re-"aligned" to other
199 times, and the time selection may be "moved" too. The first
200 noun -- "start" in this example -- is the object of a verb (not of
201 an implied preposition "from"). */
202 ? XO("Aligned/Moved start to zero")
203 : XO("Aligned start to zero");
204 shortAction = moveSel
205 /* i18n-hint: This and similar messages give shorter descriptions of
206 the aligning and moving editing actions */
207 ? XO("Align/Move Start")
208 : XO("Align Start");
209 break;
211 delta = selectedRegion.t0() - minOffset();
212 action = moveSel
213 ? XO("Aligned/Moved start to cursor/selection start")
214 : XO("Aligned start to cursor/selection start");
215 shortAction = moveSel
216 ? XO("Align/Move Start")
217 : XO("Align Start");
218 break;
220 delta = selectedRegion.t1() - minOffset();
221 action = moveSel
222 ? XO("Aligned/Moved start to selection end")
223 : XO("Aligned start to selection end");
224 shortAction = moveSel
225 ? XO("Align/Move Start")
226 : XO("Align Start");
227 break;
229 delta = selectedRegion.t0() - maxEndOffset();
230 action = moveSel
231 ? XO("Aligned/Moved end to cursor/selection start")
232 : XO("Aligned end to cursor/selection start");
233 shortAction =
234 moveSel
235 ? XO("Align/Move End")
236 : XO("Align End");
237 break;
238 case kAlignEndSelEnd:
239 delta = selectedRegion.t1() - maxEndOffset();
240 action = moveSel
241 ? XO("Aligned/Moved end to selection end")
242 : XO("Aligned end to selection end");
243 shortAction =
244 moveSel
245 ? XO("Align/Move End")
246 : XO("Align End");
247 break;
248 // index set in alignLabelsNoSync
249 case kAlignEndToEnd:
250 newPos = firstTrackOffset();
251 action = moveSel
252 ? XO("Aligned/Moved end to end")
253 : XO("Aligned end to end");
254 shortAction =
255 moveSel
256 ? XO("Align/Move End to End")
257 : XO("Align End to End");
258 break;
259 case kAlignTogether:
260 newPos = avgOffset();
261 action = moveSel
262 ? XO("Aligned/Moved together")
263 : XO("Aligned together");
264 shortAction =
265 moveSel
266 ? XO("Align/Move Together")
267 : XO("Align Together");
268 }
269
270 if ((unsigned)index >= kAlignLabelsCount()) {
271 // This is an alignLabelsNoSync command.
272 for (auto t : tracks.Selected<AudioTrack>()) {
273 // This shifts different tracks in different ways, so no sync-lock
274 // move.
275 // Only align Wave and Note tracks end to end.
276 t->MoveTo(newPos);
277 if (index == kAlignEndToEnd)
278 newPos += (t->GetEndTime() - t->GetStartTime());
279 }
280 if (index == kAlignEndToEnd)
281 viewport.ZoomFitHorizontally();
282 }
283
284 if (delta != 0.0) {
285 // For a fixed-distance shift move sync-lock selected tracks also.
286 for (auto t : tracks.Any()
288 t->MoveTo(t->GetStartTime() + delta);
289 }
290
291 if (moveSel)
292 selectedRegion.move(delta);
293
294 ProjectHistory::Get( project ).PushState(action, shortAction);
295}
XO("Cut/Copy/Paste")
const auto tracks
const auto project
Track subclass holding data representing sound (as notes, or samples, or ...)
Definition: PlayableTrack.h:21
double GetEndTime() const
Get the maximum of End() values of intervals, or 0 when none.
Definition: Channel.cpp:61
double GetStartTime() const
Get the minimum of Start() values of intervals, or 0 when none.
Definition: Channel.cpp:50
void PushState(const TranslatableString &desc, const TranslatableString &shortDesc)
static ProjectHistory & Get(AudacityProject &project)
static bool IsSelectedOrSyncLockSelectedP(const Track *pTrack)
Definition: SyncLock.h:61
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:314
Holds a msgid for the translation catalog; may also bind format arguments.
NotifyingSelectedRegion selectedRegion
Definition: ViewInfo.h:216
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33

References ProjectHistory::Get(), ViewInfo::Get(), TrackList::Get(), Viewport::Get(), ChannelGroup::GetEndTime(), ChannelGroup::GetStartTime(), SyncLock::IsSelectedOrSyncLockSelectedP(), kAlignEndSelEnd, kAlignEndSelStart, kAlignEndToEnd, kAlignLabelsCount(), kAlignStartSelEnd, kAlignStartSelStart, kAlignStartZero, kAlignTogether, project, ProjectHistory::PushState(), ViewInfo::selectedRegion, tracks, and XO().

Referenced by OnAlign(), and OnAlignNoSync().

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

◆ DoMixAndRender()

void anonymous_namespace{TrackMenus.cpp}::DoMixAndRender ( AudacityProject project,
bool  toNewTrack 
)

Definition at line 48 of file TrackMenus.cpp.

49{
51 auto &trackFactory = WaveTrackFactory::Get(project);
52 auto rate = ProjectRate::Get(project).GetRate();
53 auto defaultFormat = QualitySettings::SampleFormatChoice();
54 auto &trackPanel = TrackPanel::Get(project);
55
56 auto trackRange = tracks.Selected<WaveTrack>();
57 auto newTrack = ::MixAndRender(trackRange.Filter<const WaveTrack>(),
58 Mixer::WarpOptions{ tracks.GetOwner() },
59 tracks.MakeUniqueTrackName(_("Mix")),
60 &trackFactory, rate, defaultFormat, 0.0, 0.0);
61
62 if (newTrack) {
63 // Remove originals, get stats on what tracks were mixed
64
65 // But before removing, determine the first track after the removal
66 auto last = *trackRange.rbegin();
67 auto insertionPoint = * ++ tracks.Find(last);
68
69 auto selectedCount = trackRange.size();
70 if (!toNewTrack) {
71 // Beware iterator invalidation!
72 while (!trackRange.empty())
73 tracks.Remove(**trackRange.first++);
74 }
75
76 // Add new tracks
77 const bool stereo = newTrack->NChannels() > 1;
78 const auto firstName = newTrack->GetName();
79 tracks.Add(newTrack);
80 const auto pNewTrack = *tracks.Any<WaveTrack>().rbegin();
81
82 // Bug 2218, remember more things...
83 if (selectedCount >= 1)
84 pNewTrack->SetSelected(!toNewTrack);
85
86 // Permute the tracks as needed
87 // The new track appears after the old tracks (or where the old tracks
88 // had been) so that they are in the same sync-lock group
89 if (insertionPoint) {
90 std::vector<Track *> arr;
91 arr.reserve(tracks.Size());
92 size_t iBegin = 0, ii = 0;
93 for (const auto pTrack : tracks) {
94 arr.push_back(pTrack);
95 if (pTrack == insertionPoint)
96 iBegin = ii;
97 ++ii;
98 }
99 const auto end = arr.end(),
100 mid = end - 1;
101 std::rotate(arr.begin() + iBegin, mid, end);
102 tracks.Permute(arr);
103 }
104
105 // Smart history/undo message
106 if (selectedCount == 1) {
107 auto msg = XO("Rendered all audio in track '%s'").Format(firstName);
108 /* i18n-hint: Convert the audio into a more usable form, so apply
109 * panning and amplification and write to some external file.*/
110 ProjectHistory::Get( project ).PushState(msg, XO("Render"));
111 }
112 else {
113 auto msg = (stereo
114 ? XO("Mixed and rendered %d tracks into one new stereo track")
115 : XO("Mixed and rendered %d tracks into one new mono track")
116 )
117 .Format((int)selectedCount);
118 ProjectHistory::Get(project).PushState(msg, XO("Mix and Render"));
119 }
120
121 trackPanel.SetFocus();
122 TrackFocus::Get(project).Set(pNewTrack);
123 Viewport::Get(project).ShowTrack(*pNewTrack);
124 }
125}
#define _(s)
Definition: Internat.h:73
Track::Holder MixAndRender(const TrackIterRange< const WaveTrack > &trackRange, const Mixer::WarpOptions &warpOptions, const wxString &newTrackName, WaveTrackFactory *trackFactory, double rate, sampleFormat format, double startTime, double endTime)
Mixes together all input tracks, applying any envelopes, per-track real-time effects,...
Abstract base class used in importing a file.
static ProjectRate & Get(AudacityProject &project)
Definition: ProjectRate.cpp:28
double GetRate() const
Definition: ProjectRate.cpp:53
Track * Get()
Definition: TrackFocus.cpp:156
const wxString & GetName() const
Name is always the same for all channels of a group.
Definition: Track.cpp:64
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234
void ShowTrack(const Track &track)
Definition: Viewport.cpp:460
static WaveTrackFactory & Get(AudacityProject &project)
Definition: WaveTrack.cpp:3376
A Track that contains audio waveform data.
Definition: WaveTrack.h:203
size_t NChannels() const override
A constant property.
Definition: WaveTrack.cpp:530
PROJECT_RATE_API sampleFormat SampleFormatChoice()
const char * end(const char *str) noexcept
Definition: StringUtils.h:106
void rotate(const float *oldPhase, const float *newPhase, std::complex< float > *dst, int32_t n)
Definition: VectorOps.h:140
Immutable structure is an argument to Mixer's constructor.
Definition: MixerOptions.h:56

References _, details::end(), TrackFocus::Get(), ProjectHistory::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), WaveTrackFactory::Get(), TrackPanel::Get(), Track::GetName(), ProjectRate::GetRate(), MixAndRender(), WaveTrack::NChannels(), project, ProjectHistory::PushState(), staffpad::vo::rotate(), QualitySettings::SampleFormatChoice(), Viewport::ShowTrack(), tracks, and XO().

Referenced by OnMixAndRender(), and OnMixAndRenderToNewTrack().

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

◆ DoPanTracks()

void anonymous_namespace{TrackMenus.cpp}::DoPanTracks ( AudacityProject project,
float  PanValue 
)

Definition at line 127 of file TrackMenus.cpp.

128{
129 auto &tracks = TrackList::Get( project );
130
131 // count selected wave tracks
132 const auto range = tracks.Any< WaveTrack >();
133 const auto selectedRange = range + &Track::IsSelected;
134 auto count = selectedRange.size();
135
136 // iter through them, all if none selected.
137 for (auto left : count == 0 ? range : selectedRange )
138 left->SetPan( PanValue );
139
140 auto flags = UndoPush::NONE;
142 /*i18n-hint: One or more audio tracks have been panned*/
143 .PushState(XO("Panned audio track(s)"), XO("Pan Track"), flags);
144 flags = flags | UndoPush::CONSOLIDATE;
145}
size_t size() const
How many attachment pointers are in the Site.
Definition: ClientData.h:260
bool IsSelected() const
Definition: Track.cpp:258

References CONSOLIDATE, ProjectHistory::Get(), TrackList::Get(), Track::IsSelected(), NONE, project, ProjectHistory::PushState(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::size(), tracks, and XO().

Referenced by OnPanCenter(), OnPanLeft(), and OnPanRight().

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

◆ DoSortTracks()

void anonymous_namespace{TrackMenus.cpp}::DoSortTracks ( AudacityProject project,
int  flags 
)

Definition at line 461 of file TrackMenus.cpp.

462{
463 auto GetTime = [](const Track &t) {
464 return t.TypeSwitch<double>(
465 [&](const WaveTrack &w) {
466 auto stime = w.GetEndTime();
467
468 int ndx;
469 for (ndx = 0; ndx < w.GetNumClips(); ndx++) {
470 const auto c = w.GetClip(ndx);
471 if (c->GetVisibleSampleCount() == 0)
472 continue;
473 stime = std::min(stime, c->GetPlayStartTime());
474 }
475 return stime;
476 },
477 [&](const LabelTrack& l) {
478 return l.GetStartTime();
479 }
480 );
481 };
482
483 std::vector<Track *> arr;
485 arr.reserve(tracks.Size());
486
487 // First find the permutation.
488 for (const auto pTrack : tracks) {
489 auto &track = *pTrack;
490 const auto size = arr.size();
491 size_t ndx = 0;
492 for (; ndx < size; ++ndx) {
493 Track &arrTrack = *arr[ndx];
494 if (flags & kAudacitySortByName) {
495 //do case insensitive sort - cmpNoCase returns less than zero if
496 // the string is 'less than' its argument
497 //also if we have case insensitive equality, then we need to sort
498 // by case as well
499 //We sort 'b' before 'B' accordingly. We uncharacteristically
500 // use greater than for the case sensitive
501 //compare because 'b' is greater than 'B' in ascii.
502 auto cmpValue = track.GetName().CmpNoCase(arrTrack.GetName());
503 if (cmpValue < 0 ||
504 (0 == cmpValue &&
505 track.GetName().CompareTo(arrTrack.GetName()) > 0))
506 break;
507 }
508 //sort by time otherwise
509 else if (flags & kAudacitySortByTime)
510 if (GetTime(track) < GetTime(arrTrack))
511 break;
512 }
513 arr.insert(arr.begin() + ndx, &track);
514 }
515
516 // Now apply the permutation
517 tracks.Permute(arr);
518}
int min(int a, int b)
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:98

References TrackList::Get(), Track::GetName(), kAudacitySortByName, kAudacitySortByTime, min(), project, size, and tracks.

Referenced by OnSortName(), and OnSortTime().

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

◆ ExtraTrackMenu()

auto anonymous_namespace{TrackMenus.cpp}::ExtraTrackMenu ( )

Definition at line 1269 of file TrackMenus.cpp.

1270{
1271 static auto menu = std::shared_ptr{
1272 Menu( wxT("Track"), XXO("&Track"),
1273 Command( wxT("TrackPan"), XXO("Change P&an on Focused Track..."),
1274 OnTrackPan,
1275 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+P") ),
1276 Command( wxT("TrackPanLeft"), XXO("Pan &Left on Focused Track"),
1278 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Left") ),
1279 Command( wxT("TrackPanRight"), XXO("Pan &Right on Focused Track"),
1281 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Right") ),
1282 Command( wxT("TrackGain"), XXO("Change Gai&n on Focused Track..."),
1284 TrackPanelHasFocus() | TracksExistFlag(), wxT("Shift+G") ),
1285 Command( wxT("TrackGainInc"), XXO("&Increase Gain on Focused Track"),
1287 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Up") ),
1288 Command( wxT("TrackGainDec"), XXO("&Decrease Gain on Focused Track"),
1290 TrackPanelHasFocus() | TracksExistFlag(), wxT("Alt+Shift+Down") ),
1291 Command( wxT("TrackMenu"), XXO("Op&en Menu on Focused Track..."),
1294 Options{ wxT("Shift+M") }.SkipKeyDown() ),
1295 Command( wxT("TrackMute"), XXO("M&ute/Unmute Focused Track"),
1297 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+U") ),
1298 Command( wxT("TrackSolo"), XXO("&Solo/Unsolo Focused Track"),
1300 TracksExistFlag() | TrackPanelHasFocus(), wxT("Shift+S") ),
1301 Command( wxT("TrackClose"), XXO("Delete Fo&cused Track"),
1304 wxT("Shift+C") ),
1305 Command( wxT("TrackMoveUp"), XXO("Move Focused Track U&p"),
1308 Command( wxT("TrackMoveDown"), XXO("Move Focused Track Do&wn"),
1311 Command( wxT("TrackMoveTop"), XXO("Move Focused Track to T&op"),
1314 Command( wxT("TrackMoveBottom"), XXO("Move Focused Track to &Bottom"),
1317 ) };
1318 return menu;
1319}
const ReservedCommandFlag & AudioIONotBusyFlag()
const ReservedCommandFlag & TracksExistFlag()
const ReservedCommandFlag & TrackPanelHasFocus()
constexpr auto Command
Definition: MenuRegistry.h:456
constexpr auto Menu
Items will appear in a main toolbar menu or in a sub-menu.
Definition: MenuRegistry.h:445
void OnTrackMoveBottom(const CommandContext &context)
void OnTrackPan(const CommandContext &context)
Definition: TrackMenus.cpp:930
void OnTrackMoveTop(const CommandContext &context)
void OnTrackPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:956
void OnTrackMoveDown(const CommandContext &context)
void OnTrackGain(const CommandContext &context)
Definition: TrackMenus.cpp:969
void OnTrackMute(const CommandContext &context)
void OnTrackMenu(const CommandContext &context)
void OnTrackSolo(const CommandContext &context)
void OnTrackGainDec(const CommandContext &context)
Definition: TrackMenus.cpp:996
void OnTrackGainInc(const CommandContext &context)
Definition: TrackMenus.cpp:983
void OnTrackMoveUp(const CommandContext &context)
void OnTrackClose(const CommandContext &context)
void OnTrackPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:943

References AudioIONotBusyFlag(), MenuRegistry::Command, MenuRegistry::Menu, OnTrackClose(), OnTrackGain(), OnTrackGainDec(), OnTrackGainInc(), OnTrackMenu(), OnTrackMoveBottom(), OnTrackMoveDown(), OnTrackMoveTop(), OnTrackMoveUp(), OnTrackMute(), OnTrackPan(), OnTrackPanLeft(), OnTrackPanRight(), OnTrackSolo(), TrackPanelHasFocus(), TracksExistFlag(), wxT(), and XXO().

Here is the call graph for this function:

◆ kAlignLabelsCount()

const size_t anonymous_namespace{TrackMenus.cpp}::kAlignLabelsCount ( )

Definition at line 167 of file TrackMenus.cpp.

167{ return alignLabels().size(); }
static const std::vector< ComponentInterfaceSymbol > & alignLabels()
Definition: TrackMenus.cpp:159

References alignLabels().

Referenced by DoAlign(), and OnAlignNoSync().

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

◆ MuteTracks()

static void anonymous_namespace{TrackMenus.cpp}::MuteTracks ( const CommandContext context,
bool  mute,
bool  selected 
)
static

Definition at line 679 of file TrackMenus.cpp.

680{
681 auto &project = context.project;
682 const auto &settings = ProjectSettings::Get( project );
683 auto &tracks = TrackList::Get( project );
684
685 const auto solo = TracksBehaviorsSolo.ReadEnum();
686 const auto soloSimple = (solo == SoloBehaviorSimple);
687
688 auto iter = selected ? tracks.Selected<PlayableTrack>() : tracks.Any<PlayableTrack>();
689 for (auto pt : iter) {
690 pt->SetMute(mute);
691 if (soloSimple)
692 pt->SetSolo(false);
693 }
694
696}
EnumSetting< SoloBehavior > TracksBehaviorsSolo
@ SoloBehaviorSimple
Definition: PlayableTrack.h:70
static Settings & settings()
Definition: TrackInfo.cpp:51
AudacityProject & project
AudioTrack subclass that can also be audibly replayed by the program.
Definition: PlayableTrack.h:40
void SetMute(bool m)
void ModifyState(bool bWantsAutoSave)
static ProjectSettings & Get(AudacityProject &project)

References ProjectHistory::Get(), TrackList::Get(), ProjectSettings::Get(), ProjectHistory::ModifyState(), CommandContext::project, project, PlayableTrack::SetMute(), settings(), SoloBehaviorSimple, tracks, and TracksBehaviorsSolo.

Referenced by OnMuteAllTracks(), OnMuteSelectedTracks(), OnUnmuteAllTracks(), and OnUnmuteSelectedTracks().

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

◆ OnAlign()

void anonymous_namespace{TrackMenus.cpp}::OnAlign ( const CommandContext context)

Definition at line 744 of file TrackMenus.cpp.

745{
746 auto &project = context.project;
747
748 bool bMoveWith;
749 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
750 DoAlign(project, context.index, bMoveWith);
751}
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Read(const wxString &key, bool *value) const =0
void DoAlign(AudacityProject &project, int index, bool moveSel)
Definition: TrackMenus.cpp:169

References DoAlign(), gPrefs, CommandContext::index, CommandContext::project, project, audacity::BasicSettings::Read(), and wxT().

Referenced by TracksMenu().

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

◆ OnAlignNoSync()

void anonymous_namespace{TrackMenus.cpp}::OnAlignNoSync ( const CommandContext context)

Definition at line 736 of file TrackMenus.cpp.

737{
738 auto &project = context.project;
739
741 context.index + kAlignLabelsCount(), false);
742}

References DoAlign(), CommandContext::index, kAlignLabelsCount(), CommandContext::project, and project.

Referenced by TracksMenu().

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

◆ OnMixAndRender()

void anonymous_namespace{TrackMenus.cpp}::OnMixAndRender ( const CommandContext context)

Definition at line 559 of file TrackMenus.cpp.

560{
561 auto &project = context.project;
562 DoMixAndRender(project, false);
563}
void DoMixAndRender(AudacityProject &project, bool toNewTrack)
Definition: TrackMenus.cpp:48

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

Referenced by TracksMenu().

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

◆ OnMixAndRenderToNewTrack()

void anonymous_namespace{TrackMenus.cpp}::OnMixAndRenderToNewTrack ( const CommandContext context)

Definition at line 565 of file TrackMenus.cpp.

566{
567 auto &project = context.project;
568 DoMixAndRender(project, true);
569}

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

Referenced by TracksMenu().

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

◆ OnMoveSelectionWithTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMoveSelectionWithTracks ( const CommandContext WXUNUSEDcontext)

Definition at line 761 of file TrackMenus.cpp.

762{
763 bool bMoveWith;
764 gPrefs->Read(wxT("/GUI/MoveSelectionWithTracks"), &bMoveWith, false);
765 gPrefs->Write(wxT("/GUI/MoveSelectionWithTracks"), !bMoveWith);
766 gPrefs->Flush();
767
768}
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0

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

Referenced by TracksMenu().

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

◆ OnMuteAllTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMuteAllTracks ( const CommandContext context)

Definition at line 698 of file TrackMenus.cpp.

699{
700 MuteTracks(context, true, false);
701}
static void MuteTracks(const CommandContext &context, bool mute, bool selected)
Definition: TrackMenus.cpp:679

References MuteTracks().

Referenced by TracksMenu().

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

◆ OnMuteSelectedTracks()

void anonymous_namespace{TrackMenus.cpp}::OnMuteSelectedTracks ( const CommandContext context)

Definition at line 708 of file TrackMenus.cpp.

709{
710 MuteTracks(context, true, true);
711}

References MuteTracks().

Referenced by TracksMenu().

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

◆ OnPanCenter()

void anonymous_namespace{TrackMenus.cpp}::OnPanCenter ( const CommandContext context)

Definition at line 730 of file TrackMenus.cpp.

731{
732 auto &project = context.project;
733 DoPanTracks( project, 0.0);
734}
void DoPanTracks(AudacityProject &project, float PanValue)
Definition: TrackMenus.cpp:127

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

Referenced by TracksMenu().

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

◆ OnPanLeft()

void anonymous_namespace{TrackMenus.cpp}::OnPanLeft ( const CommandContext context)

Definition at line 718 of file TrackMenus.cpp.

719{
720 auto &project = context.project;
721 DoPanTracks( project, -1.0);
722}

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

Referenced by TracksMenu().

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

◆ OnPanRight()

void anonymous_namespace{TrackMenus.cpp}::OnPanRight ( const CommandContext context)

Definition at line 724 of file TrackMenus.cpp.

725{
726 auto &project = context.project;
727 DoPanTracks( project, 1.0);
728}

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

Referenced by TracksMenu().

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

◆ OnRemoveTracks()

void anonymous_namespace{TrackMenus.cpp}::OnRemoveTracks ( const CommandContext context)

Definition at line 674 of file TrackMenus.cpp.

675{
677}
AUDACITY_DLL_API void DoRemoveTracks(AudacityProject &)

References TrackUtilities::DoRemoveTracks(), and CommandContext::project.

Referenced by TracksMenu().

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

◆ OnResample()

void anonymous_namespace{TrackMenus.cpp}::OnResample ( const CommandContext context)

Definition at line 571 of file TrackMenus.cpp.

572{
573 auto &project = context.project;
574 auto projectRate = ProjectRate::Get(project).GetRate();
576 auto &undoManager = UndoManager::Get(project);
577 auto &viewport = Viewport::Get(project);
578 auto &window = GetProjectFrame(project);
579
580 int newRate;
581
582 while (true) {
583 wxDialogWrapper dlg(&window, wxID_ANY, XO("Resample"));
584 ShuttleGui S(&dlg, eIsCreating);
585 wxString rate;
586 wxComboBox *cb;
587
588 rate.Printf(wxT("%ld"), lrint(projectRate));
589
590 wxArrayStringEx rates{
591 wxT("8000") ,
592 wxT("11025") ,
593 wxT("16000") ,
594 wxT("22050") ,
595 wxT("32000") ,
596 wxT("44100") ,
597 wxT("48000") ,
598 wxT("88200") ,
599 wxT("96000") ,
600 wxT("176400") ,
601 wxT("192000") ,
602 wxT("352800") ,
603 wxT("384000") ,
604 };
605
606 S.StartVerticalLay(true);
607 {
608 S.AddSpace(-1, 15);
609
610 S.StartHorizontalLay(wxCENTER, false);
611 {
612 cb = S.AddCombo(XXO("New sample rate (Hz):"),
613 rate,
614 rates);
615 }
616 S.EndHorizontalLay();
617
618 S.AddSpace(-1, 15);
619
620 S.AddStandardButtons();
621 }
622 S.EndVerticalLay();
623
624 dlg.Layout();
625 dlg.Fit();
626 dlg.Center();
627
628 if (dlg.ShowModal() != wxID_OK)
629 return; // user cancelled dialog
630
631 long lrate;
632 if (cb->GetValue().ToLong(&lrate) && lrate >= 1 && lrate <= 1000000) {
633 newRate = (int)lrate;
634 break;
635 }
636
638 XO("The entered value is invalid"),
639 XO("Error"),
640 wxICON_ERROR,
641 &window);
642 }
643
644 int ndx = 0;
645 auto flags = UndoPush::NONE;
646 for (auto wt : tracks.Selected<WaveTrack>()) {
647 auto msg = XO("Resampling track %d").Format(++ndx);
648
649 using namespace BasicUI;
650 auto progress = MakeProgress(XO("Resample"), msg);
651
652 // The resampling of a track may be stopped by the user. This might
653 // leave a track with multiple clips in a partially resampled state.
654 // But the thrown exception will cause rollback in the application
655 // level handler.
656
657 wt->Resample(newRate, progress.get());
658
659 // Each time a track is successfully, completely resampled,
660 // commit that to the undo stack. The second and later times,
661 // consolidate.
662
664 XO("Resampled audio track(s)"), XO("Resample Track"), flags);
665 flags = flags | UndoPush::CONSOLIDATE;
666 }
667
668 undoManager.StopConsolidating();
669
670 // Need to reset
671 viewport.DoScroll();
672}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
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 ...
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:71
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
#define lrint(dbl)
Definition: float_cast.h:169
std::unique_ptr< ProgressDialog > MakeProgress(const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
Create and display a progress dialog.
Definition: BasicUI.h:302

References AudacityMessageBox(), CONSOLIDATE, eIsCreating, ProjectHistory::Get(), UndoManager::Get(), ProjectRate::Get(), TrackList::Get(), Viewport::Get(), GetProjectFrame(), ProjectRate::GetRate(), lrint, BasicUI::MakeProgress(), NONE, CommandContext::project, project, ProjectHistory::PushState(), S, tracks, wxT(), XO(), and XXO().

Referenced by TracksMenu().

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

◆ OnSortName()

void anonymous_namespace{TrackMenus.cpp}::OnSortName ( const CommandContext context)

Definition at line 905 of file TrackMenus.cpp.

906{
907 auto &project = context.project;
909
911 .PushState(XO("Tracks sorted by name"), XO("Sort by Name"));
912}
void DoSortTracks(AudacityProject &project, int flags)
Definition: TrackMenus.cpp:461

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByName, CommandContext::project, project, ProjectHistory::PushState(), and XO().

Referenced by TracksMenu().

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

◆ OnSortTime()

void anonymous_namespace{TrackMenus.cpp}::OnSortTime ( const CommandContext context)

Definition at line 896 of file TrackMenus.cpp.

897{
898 auto &project = context.project;
900
902 .PushState(XO("Tracks sorted by time"), XO("Sort by Time"));
903}

References DoSortTracks(), ProjectHistory::Get(), kAudacitySortByTime, CommandContext::project, project, ProjectHistory::PushState(), and XO().

Referenced by TracksMenu().

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

◆ OnStereoToMono()

void anonymous_namespace{TrackMenus.cpp}::OnStereoToMono ( const CommandContext context)

Definition at line 552 of file TrackMenus.cpp.

553{
555 PluginManager::Get().GetByCommandIdentifier(wxT("StereoToMono")),
557}
static PluginManager & Get()
bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags)
Definition: DoEffect.cpp:30

References EffectUI::DoEffect(), PluginManager::Get(), EffectManager::kConfigured, CommandContext::project, and wxT().

Referenced by TracksMenu().

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

◆ OnSyncLock()

void anonymous_namespace{TrackMenus.cpp}::OnSyncLock ( const CommandContext context)

Definition at line 914 of file TrackMenus.cpp.

915{
916 auto &project = context.project;
917 auto &trackPanel = TrackPanel::Get( project );
918
920 gPrefs->Flush();
921
922 // Toolbar, project sync-lock handled within
924
925 trackPanel.Refresh(false);
926}
BoolSetting SyncLockTracks
Definition: SyncLock.cpp:163
bool Toggle()
Write the negation of the previous value, and return true if successful.
Definition: Prefs.cpp:555
static void ModifyAllProjectToolbarMenus()

References audacity::BasicSettings::Flush(), TrackPanel::Get(), gPrefs, ToolManager::ModifyAllProjectToolbarMenus(), CommandContext::project, project, SyncLockTracks, and BoolSetting::Toggle().

Referenced by TracksMenu().

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

◆ OnTrackClose()

void anonymous_namespace{TrackMenus.cpp}::OnTrackClose ( const CommandContext context)

Definition at line 1041 of file TrackMenus.cpp.

1042{
1043 auto &project = context.project;
1044 auto &trackPanel = TrackPanel::Get( project );
1045
1046 const auto t = TrackFocus::Get( project ).Get();
1047 if (!t)
1048 return;
1049
1050 auto isAudioActive = ProjectAudioIO::Get( project ).IsAudioActive();
1051
1052 if (isAudioActive)
1053 {
1055 XO("Can't delete track with active audio"));
1056 wxBell();
1057 return;
1058 }
1059
1061
1062 trackPanel.UpdateViewIfNoTracks();
1063 trackPanel.Refresh(false);
1064}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:318
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static ProjectStatus & Get(AudacityProject &project)
void Set(const TranslatableString &msg, StatusBarField field=MainStatusBarField())
AUDACITY_DLL_API void DoRemoveTrack(AudacityProject &project, Track &toRemove)

References TrackUtilities::DoRemoveTrack(), TrackFocus::Get(), ProjectAudioIO::Get(), ProjectStatus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), ProjectAudioIO::IsAudioActive(), CommandContext::project, project, ProjectStatus::Set(), and XO().

Referenced by ExtraTrackMenu().

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

◆ OnTrackGain()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGain ( const CommandContext context)

This will pop up the track gain dialog for specified track

Definition at line 969 of file TrackMenus.cpp.

970{
971 auto &project = context.project;
972 auto &trackPanel = TrackPanel::Get( project );
973
975 const auto track = TrackFocus::Get( project ).Get();
976 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
977 LWSlider *slider = WaveTrackControls::VolumeSlider( trackPanel, wt );
978 if (slider->ShowDialog())
979 SetTrackGain(project, &wt, slider);
980 });
981}
Lightweight version of ASlider. In other words it does not have a window permanently associated with ...
Definition: ASlider.h:64
bool ShowDialog()
Definition: ASlider.cpp:1120
static LWSlider * VolumeSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackGain(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:520

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, project, SetTrackGain(), LWSlider::ShowDialog(), and WaveTrackControls::VolumeSlider().

Referenced by ExtraTrackMenu().

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

◆ OnTrackGainDec()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGainDec ( const CommandContext context)

Definition at line 996 of file TrackMenus.cpp.

997{
998 auto &project = context.project;
999 auto &trackPanel = TrackPanel::Get( project );
1000
1001 const auto track = TrackFocus::Get( project ).Get();
1002 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
1003 LWSlider *slider = WaveTrackControls::VolumeSlider( trackPanel, wt );
1004 slider->Decrease(1);
1005 SetTrackGain(project, &wt, slider);
1006 });
1007}
void Decrease(float steps)
Definition: ASlider.cpp:1617

References LWSlider::Decrease(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, project, SetTrackGain(), and WaveTrackControls::VolumeSlider().

Referenced by ExtraTrackMenu().

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

◆ OnTrackGainInc()

void anonymous_namespace{TrackMenus.cpp}::OnTrackGainInc ( const CommandContext context)

Definition at line 983 of file TrackMenus.cpp.

984{
985 auto &project = context.project;
986 auto &trackPanel = TrackPanel::Get( project );
987
988 const auto track = TrackFocus::Get( project ).Get();
989 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
990 LWSlider *slider = WaveTrackControls::VolumeSlider( trackPanel, wt );
991 slider->Increase(1);
992 SetTrackGain(project, &wt, slider);
993 });
994}
void Increase(float steps)
Definition: ASlider.cpp:1594

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), CommandContext::project, project, SetTrackGain(), and WaveTrackControls::VolumeSlider().

Referenced by ExtraTrackMenu().

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

◆ OnTrackMenu()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMenu ( const CommandContext context)

Definition at line 1009 of file TrackMenus.cpp.

1010{
1011 auto &project = context.project;
1012 auto &trackPanel = TrackPanel::Get( project );
1013
1014 trackPanel.OnTrackMenu();
1015}

References TrackPanel::Get(), CommandContext::project, and project.

Referenced by ExtraTrackMenu().

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

◆ OnTrackMoveBottom()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveBottom ( const CommandContext context)

Definition at line 1105 of file TrackMenus.cpp.

1106{
1107 auto &project = context.project;
1108 auto &trackPanel = TrackPanel::Get( project );
1109 auto &tracks = TrackList::Get( project );
1110
1111 const auto focusedTrack = TrackFocus::Get( project ).Get();
1112 if (focusedTrack && tracks.CanMoveDown(*focusedTrack)) {
1114 trackPanel.Refresh(false);
1115 }
1116}
AUDACITY_DLL_API void DoMoveTrack(AudacityProject &project, Track &target, MoveChoice choice)
Move a track up, down, to top or to bottom.

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveBottomID, CommandContext::project, project, and tracks.

Referenced by ExtraTrackMenu().

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

◆ OnTrackMoveDown()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveDown ( const CommandContext context)

Definition at line 1079 of file TrackMenus.cpp.

1080{
1081 auto &project = context.project;
1082 auto &trackPanel = TrackPanel::Get( project );
1083 auto &tracks = TrackList::Get( project );
1084
1085 const auto focusedTrack = TrackFocus::Get( project ).Get();
1086 if (focusedTrack && tracks.CanMoveDown(*focusedTrack)) {
1088 trackPanel.Refresh(false);
1089 }
1090}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveDownID, CommandContext::project, project, and tracks.

Referenced by ExtraTrackMenu().

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

◆ OnTrackMoveTop()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveTop ( const CommandContext context)

Definition at line 1092 of file TrackMenus.cpp.

1093{
1094 auto &project = context.project;
1095 auto &trackPanel = TrackPanel::Get( project );
1096 auto &tracks = TrackList::Get( project );
1097
1098 const auto focusedTrack = TrackFocus::Get( project ).Get();
1099 if (focusedTrack && tracks.CanMoveUp(*focusedTrack)) {
1101 trackPanel.Refresh(false);
1102 }
1103}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveTopID, CommandContext::project, project, and tracks.

Referenced by ExtraTrackMenu().

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

◆ OnTrackMoveUp()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMoveUp ( const CommandContext context)

Definition at line 1066 of file TrackMenus.cpp.

1067{
1068 auto &project = context.project;
1069 auto &trackPanel = TrackPanel::Get( project );
1070 auto &tracks = TrackList::Get( project );
1071
1072 const auto focusedTrack = TrackFocus::Get( project ).Get();
1073 if (focusedTrack && tracks.CanMoveUp(*focusedTrack)) {
1075 trackPanel.Refresh(false);
1076 }
1077}

References TrackUtilities::DoMoveTrack(), TrackFocus::Get(), TrackList::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), TrackUtilities::OnMoveUpID, CommandContext::project, project, and tracks.

Referenced by ExtraTrackMenu().

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

◆ OnTrackMute()

void anonymous_namespace{TrackMenus.cpp}::OnTrackMute ( const CommandContext context)

Definition at line 1017 of file TrackMenus.cpp.

1018{
1019 auto &project = context.project;
1020
1021 // Use the temporary selection if it is specified, else the track focus
1022 auto track = context.temporarySelection.pTrack;
1023 if (!track)
1024 track = TrackFocus::Get( project ).Get();
1025
1026 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1028 });
1029}
TemporarySelection temporarySelection
AUDACITY_DLL_API void DoTrackMute(AudacityProject &project, Track &track, bool exclusive)
"exclusive" mute means mute the chosen track and unmute all others.

References TrackUtilities::DoTrackMute(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, project, TemporarySelection::pTrack, and CommandContext::temporarySelection.

Referenced by ExtraTrackMenu().

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

◆ OnTrackPan()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPan ( const CommandContext context)

The following methods operate controls on specified tracks, This will pop up the track panning dialog for specified track

Definition at line 930 of file TrackMenus.cpp.

931{
932 auto &project = context.project;
933 auto &trackPanel = TrackPanel::Get( project );
934
935 const auto track = TrackFocus::Get( project ).Get();
936 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
937 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
938 if (slider->ShowDialog())
939 SetTrackPan(project, &wt, slider);
940 });
941}
static LWSlider * PanSlider(CellularPanel &panel, const WaveTrack &wt)
void SetTrackPan(AudacityProject &project, WaveTrack *wt, LWSlider *slider)
Definition: TrackMenus.cpp:533

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, project, SetTrackPan(), and LWSlider::ShowDialog().

Referenced by ExtraTrackMenu().

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

◆ OnTrackPanLeft()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPanLeft ( const CommandContext context)

Definition at line 943 of file TrackMenus.cpp.

944{
945 auto &project = context.project;
946 auto &trackPanel = TrackPanel::Get( project );
947
948 const auto track = TrackFocus::Get( project ).Get();
949 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
950 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
951 slider->Decrease(1);
952 SetTrackPan(project, &wt, slider);
953 });
954}

References LWSlider::Decrease(), TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), WaveTrackControls::PanSlider(), CommandContext::project, project, and SetTrackPan().

Referenced by ExtraTrackMenu().

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

◆ OnTrackPanRight()

void anonymous_namespace{TrackMenus.cpp}::OnTrackPanRight ( const CommandContext context)

Definition at line 956 of file TrackMenus.cpp.

957{
958 auto &project = context.project;
959 auto &trackPanel = TrackPanel::Get( project );
960
961 const auto track = TrackFocus::Get( project ).Get();
962 if (track) track->TypeSwitch( [&](WaveTrack &wt) {
963 LWSlider *slider = WaveTrackControls::PanSlider( trackPanel, wt );
964 slider->Increase(1);
965 SetTrackPan(project, &wt, slider);
966 });
967}

References TrackFocus::Get(), TrackPanel::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), LWSlider::Increase(), WaveTrackControls::PanSlider(), CommandContext::project, project, and SetTrackPan().

Referenced by ExtraTrackMenu().

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

◆ OnTrackSolo()

void anonymous_namespace{TrackMenus.cpp}::OnTrackSolo ( const CommandContext context)

Definition at line 1031 of file TrackMenus.cpp.

1032{
1033 auto &project = context.project;
1034
1035 const auto track = TrackFocus::Get( project ).Get();
1036 if (track) track->TypeSwitch( [&](PlayableTrack &t) {
1038 });
1039}
AUDACITY_DLL_API void DoTrackSolo(AudacityProject &project, Track &track, bool exclusive)

References TrackUtilities::DoTrackSolo(), TrackFocus::Get(), ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), CommandContext::project, and project.

Referenced by ExtraTrackMenu().

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

◆ OnUnmuteAllTracks()

void anonymous_namespace{TrackMenus.cpp}::OnUnmuteAllTracks ( const CommandContext context)

Definition at line 703 of file TrackMenus.cpp.

704{
705 MuteTracks(context, false, false);
706}

References MuteTracks().

Referenced by TracksMenu().

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

◆ OnUnmuteSelectedTracks()

void anonymous_namespace{TrackMenus.cpp}::OnUnmuteSelectedTracks ( const CommandContext context)

Definition at line 713 of file TrackMenus.cpp.

714{
715 MuteTracks(context, false, true);
716}

References MuteTracks().

Referenced by TracksMenu().

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

◆ SetTrackGain()

void anonymous_namespace{TrackMenus.cpp}::SetTrackGain ( AudacityProject project,
WaveTrack wt,
LWSlider slider 
)

Definition at line 520 of file TrackMenus.cpp.

521{
522 wxASSERT(wt);
523 float newValue = slider->Get();
524
525 wt->SetVolume(newValue);
526
528 .PushState(XO("Adjusted gain"), XO("Gain"), UndoPush::CONSOLIDATE);
529
531}
float Get(bool convert=true)
Definition: ASlider.cpp:1569
void RefreshTrack(Track *trk, bool refreshbacking=true)
Definition: TrackPanel.cpp:768
void SetVolume(float newVolume)
Definition: WaveTrack.cpp:852

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), project, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetVolume(), and XO().

Referenced by OnTrackGain(), OnTrackGainDec(), and OnTrackGainInc().

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

◆ SetTrackPan()

void anonymous_namespace{TrackMenus.cpp}::SetTrackPan ( AudacityProject project,
WaveTrack wt,
LWSlider slider 
)

Definition at line 533 of file TrackMenus.cpp.

534{
535 wxASSERT(wt);
536 float newValue = slider->Get();
537
538 wt->SetPan(newValue);
539
541 .PushState(XO("Adjusted Pan"), XO("Pan"), UndoPush::CONSOLIDATE);
542
544}
void SetPan(float newPan)
Definition: WaveTrack.cpp:870

References CONSOLIDATE, ProjectHistory::Get(), TrackPanel::Get(), LWSlider::Get(), project, ProjectHistory::PushState(), TrackPanel::RefreshTrack(), WaveTrack::SetPan(), and XO().

Referenced by OnTrackPan(), OnTrackPanLeft(), and OnTrackPanRight().

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

◆ TracksMenu()

auto anonymous_namespace{TrackMenus.cpp}::TracksMenu ( )

Definition at line 1122 of file TrackMenus.cpp.

1123{
1124 // Tracks Menu (formerly Project Menu)
1125 static auto menu = std::shared_ptr{
1126 Menu( wxT("Tracks"), XXO("&Tracks"),
1127 Section( "Add",
1128 Menu( wxT("Add"), XXO("Add &New") )
1129 ),
1130
1132
1133 Section( "",
1134 Menu( wxT("Mix"), XXO("Mi&x"),
1135 // Delayed evaluation
1136 // Stereo to Mono is an oddball command that is also subject to control
1137 // by the plug-in manager, as if an effect. Decide whether to show or
1138 // hide it.
1139 [](AudacityProject&) -> std::unique_ptr<CommandItem> {
1140 const PluginID ID =
1142 const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
1143 if (plug && plug->IsEnabled())
1144 return Command( wxT("Stereo to Mono"),
1145 XXO("Mix Stereo Down to &Mono"), OnStereoToMono,
1148 else
1149 return {};
1150 },
1151 Command( wxT("MixAndRender"), XXO("Mi&x and Render"),
1154 Command( wxT("MixAndRenderToNewTrack"),
1155 XXO("Mix and Render to Ne&w Track"),
1157 AudioIONotBusyFlag() | WaveTracksSelectedFlag(), wxT("Ctrl+Shift+M") )
1158 ),
1159
1160 Command( wxT("Resample"), XXO("&Resample..."), OnResample,
1162 ),
1163
1164 Section( "",
1165 Command( wxT("RemoveTracks"), XXO("Remo&ve Tracks"), OnRemoveTracks,
1167 ),
1168
1169 Section( "",
1170 Menu( wxT("Mute"), XXO("M&ute/Unmute"),
1171 Command( wxT("MuteAllTracks"), XXO("&Mute All Tracks"),
1172 OnMuteAllTracks, TracksExistFlag(), wxT("Ctrl+U") ),
1173 Command( wxT("UnmuteAllTracks"), XXO("&Unmute All Tracks"),
1174 OnUnmuteAllTracks, TracksExistFlag(), wxT("Ctrl+Shift+U") ),
1175 Command( wxT("MuteTracks"), XXO("Mut&e Tracks"),
1177 Command( wxT("UnmuteTracks"), XXO("U&nmute Tracks"),
1178 OnUnmuteSelectedTracks, EditableTracksSelectedFlag(), wxT("Ctrl+Alt+Shift+U") )
1179 ),
1180
1181 Menu( wxT("Pan"), XXO("&Pan"),
1182 // As Pan changes are not saved on Undo stack,
1183 // pan settings for all tracks
1184 // in the project could very easily be lost unless we
1185 // require the tracks to be selected.
1186 Command( wxT("PanLeft"), XXO("&Left"), OnPanLeft,
1188 Options{}.LongName( XO("Pan Left") ) ),
1189 Command( wxT("PanRight"), XXO("&Right"), OnPanRight,
1191 Options{}.LongName( XO("Pan Right") ) ),
1192 Command( wxT("PanCenter"), XXO("&Center"), OnPanCenter,
1194 Options{}.LongName( XO("Pan Center") ) )
1195 )
1196 ),
1197
1198 Section( "",
1199 Menu( wxT("Align"), XXO("&Align Tracks"), // XO("Just Move Tracks"),
1200 Section( "",
1201 // Mutual alignment of tracks independent of selection or zero
1202 CommandGroup(wxT("Align"),
1203 {
1204 { wxT("EndToEnd"), XXO("&Align End to End") },
1205 { wxT("Together"), XXO("Align &Together") },
1206 },
1208 ),
1209
1210 Section( "",
1211 // Alignment commands using selection or zero
1212 CommandGroup(wxT("Align"),
1213 alignLabels(),
1215 ),
1216
1217 Section( "",
1218 Command( wxT("MoveSelectionWithTracks"),
1219 XXO("&Move Selection with Tracks"),
1222 Options{}.CheckTest( wxT("/GUI/MoveSelectionWithTracks"), false ) )
1223 )
1224 ),
1225
1226 #if 0
1227 // TODO: Can these labels be made clearer?
1228 // Do we need this sub-menu at all?
1229 Menu( wxT("MoveSelectionAndTracks"), XO("Move Sele&ction and Tracks"), {
1230 CommandGroup(wxT("AlignMove"), alignLabels(),
1231 OnAlignMoveSel, AudioIONotBusyFlag() | EditableTracksSelectedFlag()),
1232 } ),
1233 #endif
1234
1236
1237 #ifdef EXPERIMENTAL_SCOREALIGN
1238 Command( wxT("ScoreAlign"), XXO("Synchronize MIDI with Audio"),
1239 OnScoreAlign,
1240 AudioIONotBusyFlag() | NoteTracksSelectedFlag() | WaveTracksSelectedFlag() ),
1241 #endif // EXPERIMENTAL_SCOREALIGN
1242
1244
1245 Menu( wxT("Sort"), XXO("S&ort Tracks"),
1246 Command( wxT("SortByTime"), XXO("By &Start Time"), OnSortTime,
1248 Options{}.LongName( XO("Sort by Time") ) ),
1249 Command( wxT("SortByName"), XXO("By &Name"), OnSortName,
1251 Options{}.LongName( XO("Sort by Name") ) )
1252 )
1253
1255 ),
1256
1257 Section( "",
1258 Command( wxT("SyncLock"), XXO("Keep tracks synchronized (Sync-&Lock)"),
1261 )
1262
1263 ) };
1264 return menu;
1265}
wxString PluginID
constexpr CommandFlag AlwaysEnabledFlag
Definition: CommandFlag.h:34
const ReservedCommandFlag & StereoRequiredFlag()
const ReservedCommandFlag & EditableTracksSelectedFlag()
const ReservedCommandFlag & AnyTracksSelectedFlag()
const ReservedCommandFlag & WaveTracksSelectedFlag()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
bool IsEnabled() const
const PluginDescriptor * GetPlugin(const PluginID &ID) const
const PluginID & GetByCommandIdentifier(const CommandID &strTarget)
constexpr auto Section
Definition: MenuRegistry.h:436
constexpr auto CommandGroup
Definition: MenuRegistry.h:458
void OnPanCenter(const CommandContext &context)
Definition: TrackMenus.cpp:730
void OnUnmuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:713
void OnResample(const CommandContext &context)
Definition: TrackMenus.cpp:571
void OnMixAndRenderToNewTrack(const CommandContext &context)
Definition: TrackMenus.cpp:565
void OnSortName(const CommandContext &context)
Definition: TrackMenus.cpp:905
void OnPanRight(const CommandContext &context)
Definition: TrackMenus.cpp:724
void OnMixAndRender(const CommandContext &context)
Definition: TrackMenus.cpp:559
void OnMuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:698
void OnUnmuteAllTracks(const CommandContext &context)
Definition: TrackMenus.cpp:703
void OnRemoveTracks(const CommandContext &context)
Definition: TrackMenus.cpp:674
void OnPanLeft(const CommandContext &context)
Definition: TrackMenus.cpp:718
void OnMuteSelectedTracks(const CommandContext &context)
Definition: TrackMenus.cpp:708
void OnMoveSelectionWithTracks(const CommandContext &WXUNUSED(context))
Definition: TrackMenus.cpp:761
void OnSyncLock(const CommandContext &context)
Definition: TrackMenus.cpp:914
void OnAlignNoSync(const CommandContext &context)
Definition: TrackMenus.cpp:736
void OnAlign(const CommandContext &context)
Definition: TrackMenus.cpp:744
void OnStereoToMono(const CommandContext &context)
Definition: TrackMenus.cpp:552
void OnSortTime(const CommandContext &context)
Definition: TrackMenus.cpp:896
Options && CheckTest(const CheckFn &fn) &&
Definition: MenuRegistry.h:74
Options && LongName(const TranslatableString &value) &&
Definition: MenuRegistry.h:54

References alignLabels(), AlwaysEnabledFlag, AnyTracksSelectedFlag(), AudioIONotBusyFlag(), MenuRegistry::Options::CheckTest(), MenuRegistry::Command, MenuRegistry::CommandGroup, EditableTracksSelectedFlag(), PluginManager::Get(), PluginManager::GetByCommandIdentifier(), PluginManager::GetPlugin(), PluginDescriptor::IsEnabled(), MenuRegistry::Options::LongName(), MenuRegistry::Menu, OnAlign(), OnAlignNoSync(), OnMixAndRender(), OnMixAndRenderToNewTrack(), OnMoveSelectionWithTracks(), OnMuteAllTracks(), OnMuteSelectedTracks(), OnPanCenter(), OnPanLeft(), OnPanRight(), OnRemoveTracks(), OnResample(), OnSortName(), OnSortTime(), OnStereoToMono(), OnSyncLock(), OnUnmuteAllTracks(), OnUnmuteSelectedTracks(), MenuRegistry::Section, StereoRequiredFlag(), SyncLockTracks, TracksExistFlag(), WaveTracksSelectedFlag(), wxT(), XO(), and XXO().

Here is the call graph for this function:

Variable Documentation

◆ sAttachment1

AttachedItem anonymous_namespace{TrackMenus.cpp}::sAttachment1 { Indirect(TracksMenu()) }

Definition at line 1267 of file TrackMenus.cpp.

◆ sAttachment2

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

Definition at line 1321 of file TrackMenus.cpp.