mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 14:50:06 +02:00
AudioIO::StopStream stops exceptions in many non-editing actions
This commit is contained in:
parent
a1bc6948f4
commit
f4e2fb5eac
@ -296,6 +296,7 @@ writing audio.
|
|||||||
#include <wx/txtstrm.h>
|
#include <wx/txtstrm.h>
|
||||||
|
|
||||||
#include "AudacityApp.h"
|
#include "AudacityApp.h"
|
||||||
|
#include "AudacityException.h"
|
||||||
#include "Mix.h"
|
#include "Mix.h"
|
||||||
#include "MixerBoard.h"
|
#include "MixerBoard.h"
|
||||||
#include "Resample.h"
|
#include "Resample.h"
|
||||||
@ -2436,8 +2437,13 @@ void AudioIO::StopStream()
|
|||||||
double recordingOffset =
|
double recordingOffset =
|
||||||
mLastRecordingOffset + latencyCorrection / 1000.0;
|
mLastRecordingOffset + latencyCorrection / 1000.0;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mCaptureTracks.size(); i++)
|
for (unsigned int i = 0; i < mCaptureTracks.size(); i++) {
|
||||||
{
|
// The calls to Flush, and (less likely) Clear and InsertSilence,
|
||||||
|
// may cause exceptions because of exhaustion of disk space.
|
||||||
|
// Stop those exceptions here, or else they propagate through too
|
||||||
|
// many parts of Audacity that are not effects or editing
|
||||||
|
// operations. GuardedCall ensures that the user sees a warning.
|
||||||
|
GuardedCall<void>( [&] {
|
||||||
WaveTrack* track = mCaptureTracks[i];
|
WaveTrack* track = mCaptureTracks[i];
|
||||||
track->Flush();
|
track->Flush();
|
||||||
|
|
||||||
@ -2475,14 +2481,16 @@ void AudioIO::StopStream()
|
|||||||
track->SetOffset(track->GetStartTime() + recordingOffset);
|
track->SetOffset(track->GetStartTime() + recordingOffset);
|
||||||
if(track->GetEndTime() < 0.)
|
if(track->GetEndTime() < 0.)
|
||||||
{
|
{
|
||||||
wxMessageDialog m(NULL, _("Latency Correction setting has caused the recorded audio to be hidden before zero.\nAudacity has brought it back to start at zero.\nYou may have to use the Time Shift Tool (<---> or F5) to drag the track to the right place."),
|
wxMessageDialog m(NULL, _(
|
||||||
|
"Latency Correction setting has caused the recorded audio to be hidden before zero.\nAudacity has brought it back to start at zero.\nYou may have to use the Time Shift Tool (<---> or F5) to drag the track to the right place."),
|
||||||
_("Latency problem"), wxOK);
|
_("Latency problem"), wxOK);
|
||||||
m.ShowModal();
|
m.ShowModal();
|
||||||
track->SetOffset(0.);
|
track->SetOffset(0.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user