mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 16:39:30 +02:00
Check for updates will not interrupt the Timer Record wait dialog
This commit is contained in:
parent
1f9a81eb82
commit
f8239de14c
@ -1823,6 +1823,16 @@ int AudioIO::StartStream(const TransportTracks &tracks,
|
||||
return mStreamToken;
|
||||
}
|
||||
|
||||
void AudioIO::DelayActions(bool recording)
|
||||
{
|
||||
mDelayingActions = recording;
|
||||
}
|
||||
|
||||
bool AudioIO::DelayingActions() const
|
||||
{
|
||||
return mDelayingActions || (mPortStreamV19 && mNumCaptureChannels > 0);
|
||||
}
|
||||
|
||||
void AudioIO::CallAfterRecording(PostRecordingAction action)
|
||||
{
|
||||
if (!action)
|
||||
@ -1839,7 +1849,7 @@ void AudioIO::CallAfterRecording(PostRecordingAction action)
|
||||
]{ prevAction(); nextAction(); };
|
||||
return;
|
||||
}
|
||||
else if (mPortStreamV19 && mNumCaptureChannels > 0) {
|
||||
else if (DelayingActions()) {
|
||||
mPostRecordingAction = std::move(action);
|
||||
return;
|
||||
}
|
||||
@ -2456,6 +2466,7 @@ void AudioIO::StopStream()
|
||||
mPostRecordingAction();
|
||||
mPostRecordingAction = {};
|
||||
}
|
||||
DelayActions(false);
|
||||
});
|
||||
|
||||
//
|
||||
|
@ -739,15 +739,18 @@ public:
|
||||
static void Init();
|
||||
static void Deinit();
|
||||
|
||||
|
||||
/*! For purposes of CallAfterRecording, treat time from now as if
|
||||
recording (when argument is true) or not necessarily so (false) */
|
||||
void DelayActions(bool recording);
|
||||
|
||||
private:
|
||||
|
||||
bool DelayingActions() const;
|
||||
|
||||
/** \brief Set the current VU meters - this should be done once after
|
||||
* each call to StartStream currently */
|
||||
void SetMeters();
|
||||
|
||||
|
||||
/** \brief Opens the portaudio stream(s) used to do playback or recording
|
||||
* (or both) through.
|
||||
*
|
||||
@ -796,6 +799,7 @@ private:
|
||||
|
||||
std::mutex mPostRecordingActionMutex;
|
||||
PostRecordingAction mPostRecordingAction;
|
||||
bool mDelayingActions{ false };
|
||||
};
|
||||
|
||||
static constexpr unsigned ScrubPollInterval_ms = 50;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <wx/timer.h>
|
||||
#include <wx/dynlib.h> //<! For windows.h
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "ShuttleGui.h"
|
||||
#include "ProjectAudioManager.h"
|
||||
#include "ProjectFileIO.h"
|
||||
@ -481,58 +482,64 @@ int TimerRecordDialog::RunWaitDialog()
|
||||
{
|
||||
auto updateResult = ProgressResult::Success;
|
||||
|
||||
if (m_DateTime_Start > wxDateTime::UNow())
|
||||
updateResult = this->WaitForStart();
|
||||
const auto gAudioIO = AudioIO::Get();
|
||||
gAudioIO->DelayActions(true);
|
||||
{
|
||||
auto cleanup = finally([gAudioIO]{ gAudioIO->DelayActions(false); });
|
||||
|
||||
if (updateResult != ProgressResult::Success) {
|
||||
// Don't proceed, but don't treat it as canceled recording. User just canceled waiting.
|
||||
return POST_TIMER_RECORD_CANCEL_WAIT;
|
||||
} else {
|
||||
// Record for specified time.
|
||||
ProjectAudioManager::Get( mProject ).OnRecord(false);
|
||||
bool bIsRecording = true;
|
||||
if (m_DateTime_Start > wxDateTime::UNow())
|
||||
updateResult = this->WaitForStart();
|
||||
|
||||
auto sPostAction = Verbatim(
|
||||
m_pTimerAfterCompleteChoiceCtrl->GetStringSelection() );
|
||||
if (updateResult != ProgressResult::Success) {
|
||||
// Don't proceed, but don't treat it as canceled recording. User just canceled waiting.
|
||||
return POST_TIMER_RECORD_CANCEL_WAIT;
|
||||
} else {
|
||||
// Record for specified time.
|
||||
ProjectAudioManager::Get( mProject ).OnRecord(false);
|
||||
bool bIsRecording = true;
|
||||
|
||||
// Two column layout.
|
||||
TimerProgressDialog::MessageTable columns{
|
||||
{
|
||||
XO("Recording start:") ,
|
||||
XO("Duration:") ,
|
||||
XO("Recording end:") ,
|
||||
{} ,
|
||||
XO("Automatic Save enabled:") ,
|
||||
XO("Automatic Export enabled:") ,
|
||||
XO("Action after Timer Recording:") ,
|
||||
},
|
||||
{
|
||||
GetDisplayDate(m_DateTime_Start) ,
|
||||
Verbatim( m_TimeSpan_Duration.Format() ),
|
||||
GetDisplayDate(m_DateTime_End) ,
|
||||
{} ,
|
||||
(m_bAutoSaveEnabled ? XO("Yes") : XO("No")) ,
|
||||
(m_bAutoExportEnabled ? XO("Yes") : XO("No")) ,
|
||||
sPostAction ,
|
||||
auto sPostAction = Verbatim(
|
||||
m_pTimerAfterCompleteChoiceCtrl->GetStringSelection() );
|
||||
|
||||
// Two column layout.
|
||||
TimerProgressDialog::MessageTable columns{
|
||||
{
|
||||
XO("Recording start:") ,
|
||||
XO("Duration:") ,
|
||||
XO("Recording end:") ,
|
||||
{} ,
|
||||
XO("Automatic Save enabled:") ,
|
||||
XO("Automatic Export enabled:") ,
|
||||
XO("Action after Timer Recording:") ,
|
||||
},
|
||||
{
|
||||
GetDisplayDate(m_DateTime_Start) ,
|
||||
Verbatim( m_TimeSpan_Duration.Format() ),
|
||||
GetDisplayDate(m_DateTime_End) ,
|
||||
{} ,
|
||||
(m_bAutoSaveEnabled ? XO("Yes") : XO("No")) ,
|
||||
(m_bAutoExportEnabled ? XO("Yes") : XO("No")) ,
|
||||
sPostAction ,
|
||||
}
|
||||
};
|
||||
|
||||
TimerProgressDialog
|
||||
progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(),
|
||||
XO("Audacity Timer Record Progress"),
|
||||
columns,
|
||||
pdlgHideCancelButton | pdlgConfirmStopCancel);
|
||||
|
||||
// Make sure that start and end time are updated, so we always get the full
|
||||
// duration, even if there's some delay getting here.
|
||||
wxTimerEvent dummyTimerEvent;
|
||||
this->OnTimer(dummyTimerEvent);
|
||||
|
||||
// Loop for progress display during recording.
|
||||
while (bIsRecording && (updateResult == ProgressResult::Success)) {
|
||||
updateResult = progress.UpdateProgress();
|
||||
wxMilliSleep(kTimerInterval);
|
||||
bIsRecording = (wxDateTime::UNow() <= m_DateTime_End); // Call UNow() again for extra accuracy...
|
||||
}
|
||||
};
|
||||
|
||||
TimerProgressDialog
|
||||
progress(m_TimeSpan_Duration.GetMilliseconds().GetValue(),
|
||||
XO("Audacity Timer Record Progress"),
|
||||
columns,
|
||||
pdlgHideCancelButton | pdlgConfirmStopCancel);
|
||||
|
||||
// Make sure that start and end time are updated, so we always get the full
|
||||
// duration, even if there's some delay getting here.
|
||||
wxTimerEvent dummyTimerEvent;
|
||||
this->OnTimer(dummyTimerEvent);
|
||||
|
||||
// Loop for progress display during recording.
|
||||
while (bIsRecording && (updateResult == ProgressResult::Success)) {
|
||||
updateResult = progress.UpdateProgress();
|
||||
wxMilliSleep(kTimerInterval);
|
||||
bIsRecording = (wxDateTime::UNow() <= m_DateTime_End); // Call UNow() again for extra accuracy...
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user