1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-04-01 03:54:47 +02: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:
Robert Hänggi
2020-03-07 05:35:21 +01:00
committed by James Crook
parent 668bcfc82e
commit 2d46db2c5f
2 changed files with 19 additions and 9 deletions

View File

@@ -158,6 +158,7 @@ int ProjectAudioManager::PlayPlayRegion(const SelectedRegion &selectedRegion,
#if defined(EXPERIMENTAL_SEEK_BEHIND_CURSOR)
double init_seek = 0.0;
#endif
double loop_offset = 0.0;
if (t1 == t0) {
if (looped) {
@@ -172,6 +173,8 @@ int ProjectAudioManager::PlayPlayRegion(const SelectedRegion &selectedRegion,
}
else {
// loop the entire project
// Bug2347, loop playback from cursor position instead of project start
loop_offset = t0;
t0 = tracks.GetStartTime();
t1 = tracks.GetEndTime();
}
@@ -239,8 +242,12 @@ int ProjectAudioManager::PlayPlayRegion(const SelectedRegion &selectedRegion,
}
if (token != 0) {
success = true;
ProjectAudioIO::Get( *p ).SetAudioIOToken(token);
#if defined(EXPERIMENTAL_SEEK_BEHIND_CURSOR)
ProjectAudioIO::Get(*p).SetAudioIOToken(token);
if (loop_offset != t0) {
// Bug 2347
gAudioIO->SeekStream(loop_offset);
}
#if defined(EXPERIMENTAL_SEEK_BEHIND_CURSOR )
//AC: If init_seek was set, now's the time to make it happen.
gAudioIO->SeekStream(init_seek);
#endif
@@ -1011,7 +1018,8 @@ TransportTracks ProjectAudioManager::GetAllPlaybackTracks(
}
// Stop playing or recording, if paused.
void ProjectAudioManager::StopIfPaused()
void ProjectAudioManager::StopIfPaused
()
{
if( AudioIOBase::Get()->IsPaused() )
Stop();