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

An alpha-only toggle command for extra dropout detection; default off

This commit is contained in:
Paul Licameli 2018-01-17 18:12:12 -05:00
parent a019addafb
commit f78a418df8
4 changed files with 20 additions and 2 deletions

View File

@ -5168,8 +5168,10 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
bool inputError = bool inputError =
(statusFlags & (paInputOverflow)) (statusFlags & (paInputOverflow))
&& !(statusFlags & paPrimingOutput); && !(statusFlags & paPrimingOutput);
// But it seems it's easy to get false positives, at least on Mac // But it seems it's easy to get false positives, at least on Mac
wxUnusedVar( inputError ); // So we have not decided to enable this extra detection yet in
// production
size_t len = framesPerBuffer; size_t len = framesPerBuffer;
for(unsigned t = 0; t < numCaptureChannels; t++) for(unsigned t = 0; t < numCaptureChannels; t++)
@ -5186,7 +5188,7 @@ int audacityAudioCallback(const void *inputBuffer, void *outputBuffer,
// enough from mCaptureBuffers; maybe it's CPU-bound, or maybe the // enough from mCaptureBuffers; maybe it's CPU-bound, or maybe the
// storage device it writes is too slow // storage device it writes is too slow
if (gAudioIO->mDetectDropouts && if (gAudioIO->mDetectDropouts &&
(//inputError || ((gAudioIO->mDetectUpstreamDropouts && inputError) ||
len < framesPerBuffer) ) { len < framesPerBuffer) ) {
// Assume that any good partial buffer should be written leftmost // Assume that any good partial buffer should be written leftmost
// and zeroes will be padded after; label the zeroes. // and zeroes will be padded after; label the zeroes.

View File

@ -807,6 +807,10 @@ public:
// Used only for testing purposes in alpha builds // Used only for testing purposes in alpha builds
bool mSimulateRecordingErrors{ false }; bool mSimulateRecordingErrors{ false };
// Whether to check the error code passed to audacityAudioCallback to
// detect more dropouts
bool mDetectUpstreamDropouts{ false };
}; };
#endif #endif

View File

@ -1237,6 +1237,10 @@ void AudacityProject::CreateMenusAndCommands()
_("Simulate Recording Errors"), _("Simulate Recording Errors"),
FN(OnSimulateRecordingErrors), FN(OnSimulateRecordingErrors),
gAudioIO->mSimulateRecordingErrors); gAudioIO->mSimulateRecordingErrors);
c->AddCheck(wxT("DetectUpstreamDropouts"),
_("Detect Upstream Dropouts"),
FN(OnDetectUpstreamDropouts),
gAudioIO->mDetectUpstreamDropouts);
#endif #endif
c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot)); c->AddItem(wxT("Screenshot"), _("&Screenshot Tools..."), FN(OnScreenshot));
@ -8422,6 +8426,13 @@ void AudacityProject::OnSimulateRecordingErrors(const CommandContext &)
setting = !setting; setting = !setting;
} }
void AudacityProject::OnDetectUpstreamDropouts(const CommandContext &)
{
bool &setting = gAudioIO->mDetectUpstreamDropouts;
mCommandManager.Check(wxT("DetectUpstreamDropouts"), !setting);
setting = !setting;
}
void AudacityProject::OnScreenshot(const CommandContext &) void AudacityProject::OnScreenshot(const CommandContext &)
{ {
::OpenScreenshotTools(); ::OpenScreenshotTools();

View File

@ -510,6 +510,7 @@ void OnBenchmark(const CommandContext &);
void OnCrashReport(const CommandContext &); void OnCrashReport(const CommandContext &);
#endif #endif
void OnSimulateRecordingErrors(const CommandContext &); void OnSimulateRecordingErrors(const CommandContext &);
void OnDetectUpstreamDropouts(const CommandContext &);
void OnScreenshot(const CommandContext &); void OnScreenshot(const CommandContext &);
void OnAudioDeviceInfo(const CommandContext &); void OnAudioDeviceInfo(const CommandContext &);
#ifdef EXPERIMENTAL_MIDI_OUT #ifdef EXPERIMENTAL_MIDI_OUT