1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-16 16:20:50 +02:00

Modified version of Paul L's patch to correct play button state up/down looped/unlooped.

This commit is contained in:
james.k.crook@gmail.com 2014-08-17 10:23:31 +00:00
parent c0b3859249
commit 0ff4403911
3 changed files with 10 additions and 11 deletions

View File

@ -1865,7 +1865,7 @@ void AudacityProject::OnPlayStop()
//update the playing area //update the playing area
TP_DisplaySelection(); TP_DisplaySelection();
//Otherwise, start playing (assuming audio I/O isn't busy) //Otherwise, start playing (assuming audio I/O isn't busy)
toolbar->SetPlay(true); //toolbar->SetPlay(true); // Not needed as done in PlayPlayRegion.
toolbar->SetStop(false); toolbar->SetStop(false);
// Will automatically set mLastPlayMode // Will automatically set mLastPlayMode
@ -1874,7 +1874,7 @@ void AudacityProject::OnPlayStop()
} }
else if (!gAudioIO->IsBusy()) { else if (!gAudioIO->IsBusy()) {
//Otherwise, start playing (assuming audio I/O isn't busy) //Otherwise, start playing (assuming audio I/O isn't busy)
toolbar->SetPlay(true); //toolbar->SetPlay(true); // Not needed as done in PlayPlayRegion.
toolbar->SetStop(false); toolbar->SetStop(false);
// Will automatically set mLastPlayMode // Will automatically set mLastPlayMode
@ -1932,7 +1932,7 @@ void AudacityProject::OnPlayStopSelect()
} }
else if (!gAudioIO->IsBusy()) { else if (!gAudioIO->IsBusy()) {
//Otherwise, start playing (assuming audio I/O isn't busy) //Otherwise, start playing (assuming audio I/O isn't busy)
toolbar->SetPlay(true); //toolbar->SetPlay(true); // Not needed as set in PlayPlayRegion()
toolbar->SetStop(false); toolbar->SetStop(false);
// Will automatically set mLastPlayMode // Will automatically set mLastPlayMode

View File

@ -406,11 +406,12 @@ void ControlToolBar::EnableDisableButtons()
mPause->SetEnabled(true); mPause->SetEnabled(true);
} }
void ControlToolBar::SetPlay(bool down) void ControlToolBar::SetPlay(bool down, bool looped)
{ {
if (down) if (down) {
mPlay->SetAlternate(looped);
mPlay->PushDown(); mPlay->PushDown();
else { } else {
mPlay->PopUp(); mPlay->PopUp();
mPlay->SetAlternate(false); mPlay->SetAlternate(false);
} }
@ -449,7 +450,7 @@ void ControlToolBar::PlayPlayRegion(double t0, double t1,
bool cutpreview /* = false */, bool cutpreview /* = false */,
TimeTrack *timetrack /* = NULL */) TimeTrack *timetrack /* = NULL */)
{ {
SetPlay(true); SetPlay(true, looped);
if (gAudioIO->IsBusy()) { if (gAudioIO->IsBusy()) {
SetPlay(false); SetPlay(false);
@ -634,8 +635,6 @@ void ControlToolBar::SetVUMeters(AudacityProject *p)
void ControlToolBar::PlayCurrentRegion(bool looped /* = false */, void ControlToolBar::PlayCurrentRegion(bool looped /* = false */,
bool cutpreview /* = false */) bool cutpreview /* = false */)
{ {
mPlay->SetAlternate(looped);
AudacityProject *p = GetActiveProject(); AudacityProject *p = GetActiveProject();
if (p) if (p)
@ -668,7 +667,7 @@ void ControlToolBar::OnKeyEvent(wxKeyEvent & event)
StopPlaying(); StopPlaying();
} }
else if (!gAudioIO->IsBusy()) { else if (!gAudioIO->IsBusy()) {
SetPlay(true); SetPlay(true);// Not needed as done in PlayPlayRegion
SetStop(false); SetStop(false);
PlayCurrentRegion(); PlayCurrentRegion();
} }

View File

@ -60,7 +60,7 @@ class ControlToolBar:public ToolBar {
void OnPause(wxCommandEvent & evt); void OnPause(wxCommandEvent & evt);
//These allow buttons to be controlled externally: //These allow buttons to be controlled externally:
void SetPlay(bool down); void SetPlay(bool down, bool looped=false);
void SetStop(bool down); void SetStop(bool down);
void SetRecord(bool down); void SetRecord(bool down);