mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-14 17:14:07 +01:00
Implement 2347 and 2348, Loop Play with next/previous Label
2347: Loop Play starts now at cursor position even if no time selection present 2348: Mode is preserved when using Next/Previous Label during Loop Play
This commit is contained in:
committed by
James Crook
parent
668bcfc82e
commit
2d46db2c5f
@@ -1,4 +1,5 @@
|
||||
#include "../Audacity.h"
|
||||
|
||||
#include "../Experimental.h"
|
||||
|
||||
#include "../AdornedRulerPanel.h"
|
||||
@@ -83,7 +84,7 @@ enum {
|
||||
POST_TIMER_RECORD_SHUTDOWN
|
||||
};
|
||||
|
||||
void DoPlayStop(const CommandContext &context)
|
||||
void DoPlayStop(const CommandContext &context, bool looping = false )
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &projectAudioManager = ProjectAudioManager::Get( project );
|
||||
@@ -123,14 +124,14 @@ void DoPlayStop(const CommandContext &context)
|
||||
//Otherwise, start playing (assuming audio I/O isn't busy)
|
||||
|
||||
// Will automatically set mLastPlayMode
|
||||
projectAudioManager.PlayCurrentRegion(false);
|
||||
projectAudioManager.PlayCurrentRegion(looping);
|
||||
}
|
||||
}
|
||||
else if (!gAudioIO->IsBusy()) {
|
||||
//Otherwise, start playing (assuming audio I/O isn't busy)
|
||||
|
||||
// Will automatically set mLastPlayMode
|
||||
projectAudioManager.PlayCurrentRegion(false);
|
||||
projectAudioManager.PlayCurrentRegion(looping);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,6 +140,7 @@ void DoMoveToLabel(AudacityProject &project, bool next)
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &trackFocus = TrackFocus::Get( project );
|
||||
auto &window = ProjectWindow::Get( project );
|
||||
auto &projectAudioManager = ProjectAudioManager::Get(project);
|
||||
|
||||
// Find the number of label tracks, and ptr to last track found
|
||||
auto trackRange = tracks.Any<LabelTrack>();
|
||||
@@ -169,20 +171,20 @@ void DoMoveToLabel(AudacityProject &project, bool next)
|
||||
|
||||
if (i >= 0) {
|
||||
const LabelStruct* label = lt->GetLabel(i);
|
||||
bool looping = projectAudioManager.Looping();
|
||||
if (ProjectAudioIO::Get( project ).IsAudioActive()) {
|
||||
DoPlayStop(project); // stop
|
||||
selectedRegion = label->selectedRegion;
|
||||
window.RedrawProject();
|
||||
DoPlayStop(project); // play
|
||||
DoPlayStop(project, looping); // play
|
||||
}
|
||||
else {
|
||||
selectedRegion = label->selectedRegion;
|
||||
window.ScrollIntoView(selectedRegion.t0());
|
||||
window.RedrawProject();
|
||||
}
|
||||
|
||||
auto message = XO("%s %d of %d")
|
||||
.Format( label->title, i + 1, lt->GetNumLabels() );
|
||||
.Format( label->title, i + 1, lt->GetNumLabels() );
|
||||
trackFocus.MessageForScreenReader(message);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user