mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-03 14:13:11 +02:00
Ungrey more actions, if paused.
This introduces a new variable, mStopIfWasPaused (default true). Actions which require AudioIONotBusyFlag will now stop the audio, if audio was busy but paused and attempt to continue. We could perhaps make mStopAudioIfWasPaused into a preference, but I don't think we need to keep even the option of the old behaviour.
This commit is contained in:
parent
f77000bcfb
commit
05fe684114
@ -93,10 +93,10 @@ enum CommandFlag : unsigned long long
|
||||
IsRealtimeNotActiveFlag= 0x10000000, //lll
|
||||
CaptureNotBusyFlag = 0x20000000,
|
||||
CanStopAudioStreamFlag = 0x40000000,
|
||||
RulerHasFocus
|
||||
= 0x80000000ULL, // prl
|
||||
NotMinimizedFlag
|
||||
= 0x100000000ULL, // prl
|
||||
RulerHasFocus = 0x80000000ULL, // prl
|
||||
NotMinimizedFlag = 0x100000000ULL, // prl
|
||||
PausedFlag = 0x200000000ULL, // jkc
|
||||
NotPausedFlag = 0x400000000ULL, // jkc
|
||||
|
||||
NoFlagsSpecifed = ~0ULL
|
||||
};
|
||||
|
@ -1692,6 +1692,11 @@ CommandFlag AudacityProject::GetUpdateFlags()
|
||||
else
|
||||
flags |= AudioIOBusyFlag;
|
||||
|
||||
if( gAudioIO->IsPaused() )
|
||||
flags |= PausedFlag;
|
||||
else
|
||||
flags |= NotPausedFlag;
|
||||
|
||||
if (!mViewInfo.selectedRegion.isPoint())
|
||||
flags |= TimeSelectedFlag;
|
||||
|
||||
@ -1824,6 +1829,13 @@ void AudacityProject::SelectAllIfNone()
|
||||
OnSelectAll();
|
||||
}
|
||||
|
||||
void AudacityProject::StopIfPaused()
|
||||
{
|
||||
auto flags = GetUpdateFlags();
|
||||
if( flags & PausedFlag )
|
||||
OnStop();
|
||||
}
|
||||
|
||||
void AudacityProject::ModifyAllProjectToolbarMenus()
|
||||
{
|
||||
AProjectArray::iterator i;
|
||||
@ -1912,6 +1924,9 @@ void AudacityProject::UpdateMenus(bool checkActive)
|
||||
|
||||
// We can enable some extra items if we have select-all-on-none.
|
||||
//EXPLAIN-ME: Why is this here rather than in GetUpdateFlags()?
|
||||
//ANSWER: Because flags2 is used in the menu enable/disable.
|
||||
//The effect still needs flags to determine whether it will need
|
||||
//to actually do the 'select all' to make the command valid.
|
||||
if (mSelectAllOnNone)
|
||||
{
|
||||
if ((flags & TracksExistFlag))
|
||||
@ -1926,6 +1941,13 @@ void AudacityProject::UpdateMenus(bool checkActive)
|
||||
}
|
||||
}
|
||||
|
||||
if( mStopIfWasPaused )
|
||||
{
|
||||
if( flags & PausedFlag ){
|
||||
flags2 |= AudioIONotBusyFlag;
|
||||
}
|
||||
}
|
||||
|
||||
// Return from this function if nothing's changed since
|
||||
// the last time we were here.
|
||||
if (flags == mLastFlags)
|
||||
|
@ -1176,6 +1176,7 @@ void AudacityProject::UpdatePrefsVariables()
|
||||
gPrefs->Read(wxT("/GUI/EmptyCanBeDirty"), &mEmptyCanBeDirty, true );
|
||||
gPrefs->Read(wxT("/GUI/Help"), &mHelpPref, wxT("InBrowser") );
|
||||
gPrefs->Read(wxT("/GUI/SelectAllOnNone"), &mSelectAllOnNone, true);
|
||||
mStopIfWasPaused = true; // not configurable for now, but could be later.
|
||||
gPrefs->Read(wxT("/GUI/ShowSplashScreen"), &mShowSplashScreen, true);
|
||||
gPrefs->Read(wxT("/GUI/Solo"), &mSoloPref, wxT("Simple"));
|
||||
// Update the old default to the NEW default.
|
||||
@ -2138,16 +2139,31 @@ bool AudacityProject::TryToMakeActionAllowed
|
||||
if( bAllowed )
|
||||
return true;
|
||||
|
||||
// Action is not allowed
|
||||
// Why is action not allowed?
|
||||
// 1's wherever a required flag is missing.
|
||||
auto MissingFlags = (~flags & flagsRqd) & mask;
|
||||
|
||||
if( mStopIfWasPaused && (MissingFlags & AudioIONotBusyFlag ) ){
|
||||
StopIfPaused();
|
||||
// Hope this will now reflect stopped audio.
|
||||
flags = GetUpdateFlags();
|
||||
bAllowed = ((flags & mask) == (flagsRqd & mask));
|
||||
if( bAllowed )
|
||||
return true;
|
||||
}
|
||||
|
||||
// Why is action still not allowed?
|
||||
// 0's wherever a required flag is missing (or is don't care)
|
||||
MissingFlags = (flags & ~flagsRqd) & mask;
|
||||
// IF not set up to select all audio in that case, THEN return with failure.
|
||||
if( !mSelectAllOnNone )
|
||||
return false;
|
||||
|
||||
auto MissingFlags = (flags & ~flagsRqd) & mask;
|
||||
|
||||
// IF selecting all audio won't do any good, THEN return with failure.
|
||||
if( !(flags & WaveTracksExistFlag) )
|
||||
return false;
|
||||
// returns if mask wants a zero in some flag and that's not present.
|
||||
// logic seems a bit peculiar and worth revisiting.
|
||||
if( (MissingFlags & ~( TimeSelectedFlag | WaveTracksSelectedFlag)) )
|
||||
return false;
|
||||
|
||||
|
@ -350,6 +350,7 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
||||
void RefreshCursor();
|
||||
void SelectNone();
|
||||
void SelectAllIfNone();
|
||||
void StopIfPaused();
|
||||
void Zoom(double level);
|
||||
void ZoomBy(double multiplier);
|
||||
void Rewind(bool shift);
|
||||
@ -655,6 +656,7 @@ private:
|
||||
bool mEmptyCanBeDirty;
|
||||
|
||||
bool mSelectAllOnNone;
|
||||
bool mStopIfWasPaused;
|
||||
|
||||
bool mIsSyncLocked;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user