1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-01 16:19:43 +02:00

added commands PlayBeforeAndAfterSelectionStart and PlayBeforeAndAfterSelectionEnd. Useful for checking the joins after pasting or aligning.

This commit is contained in:
David Bailes 2015-04-23 10:13:11 +01:00
parent 3ad53fff33
commit 90c2b503ea
3 changed files with 45 additions and 4 deletions

View File

@ -1114,6 +1114,8 @@ void AudacityProject::CreateMenusAndCommands()
c->AddCommand(wxT("PlayAfterSelectionStart"),_("Play After Selection Start"), FN(OnPlayAfterSelectionStart), wxT("Shift+F6"));
c->AddCommand(wxT("PlayBeforeSelectionEnd"),_("Play Before Selection End"), FN(OnPlayBeforeSelectionEnd), wxT("Shift+F7"));
c->AddCommand(wxT("PlayAfterSelectionEnd"),_("Play After Selection End"), FN(OnPlayAfterSelectionEnd), wxT("Shift+F8"));
c->AddCommand(wxT("PlayBeforeAndAfterSelectionStart"),_("Play Before and After Selection Start"), FN(OnPlayBeforeAndAfterSelectionStart), wxT("Ctrl+Shift+F5"));
c->AddCommand(wxT("PlayBeforeAndAfterSelectionEnd"),_("Play Before and After Selection End"), FN(OnPlayBeforeAndAfterSelectionEnd), wxT("Ctrl+Shift+F7"));
c->AddCommand(wxT("PlayCutPreview"), _("Play Cut Preview"), FN(OnPlayCutPreview), wxT("C"));
c->AddCommand(wxT("SelStart"), _("Selection to Start"), FN(OnSelToStart), wxT("Shift+Home"));
@ -2145,6 +2147,47 @@ void AudacityProject::OnPlayAfterSelectionEnd()
GetControlToolBar()->PlayPlayRegion(SelectedRegion(t1, t1 + afterLen), GetDefaultPlayOptions());
}
void AudacityProject::OnPlayBeforeAndAfterSelectionStart()
{
if (!MakeReadyToPlay())
return;
double t0 = mViewInfo.selectedRegion.t0();
double t1 = mViewInfo.selectedRegion.t1();
double beforeLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
double afterLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
if ( t1 - t0 > 0.0 && t1 - t0 < afterLen )
GetControlToolBar()->PlayPlayRegion(SelectedRegion(t0 - beforeLen, t1), GetDefaultPlayOptions());
else
GetControlToolBar()->PlayPlayRegion(SelectedRegion(t0 - beforeLen, t0 + afterLen), GetDefaultPlayOptions());
}
void AudacityProject::OnPlayBeforeAndAfterSelectionEnd()
{
if (!MakeReadyToPlay())
return;
double t0 = mViewInfo.selectedRegion.t0();
double t1 = mViewInfo.selectedRegion.t1();
double beforeLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewBeforeLen"), &beforeLen, 2.0);
double afterLen;
gPrefs->Read(wxT("/AudioIO/CutPreviewAfterLen"), &afterLen, 1.0);
mLastPlayMode = oneSecondPlay; // this disables auto scrolling, as in OnPlayToSelection()
if ( t1 - t0 > 0.0 && t1 - t0 < beforeLen )
GetControlToolBar()->PlayPlayRegion(SelectedRegion(t0, t1 + afterLen), GetDefaultPlayOptions());
else
GetControlToolBar()->PlayPlayRegion(SelectedRegion(t1 - beforeLen, t1 + afterLen), GetDefaultPlayOptions());
}
void AudacityProject::OnPlayLooped()
{
if( !MakeReadyToPlay(true) )

View File

@ -83,6 +83,8 @@ void OnPlayBeforeSelectionStart();
void OnPlayAfterSelectionStart();
void OnPlayBeforeSelectionEnd();
void OnPlayAfterSelectionEnd();
void OnPlayBeforeAndAfterSelectionStart();
void OnPlayBeforeAndAfterSelectionEnd();
void OnPlayLooped();
void OnPlayCutPreview();

View File

@ -1,4 +0,0 @@
resetPrefs.txt
The contents of this file are not used, but its existence is checked and if it exists, the prefs are reset.