1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-29 06:59:27 +02:00

Bug 50 - Calculation of "disk space remains for recording (time)" incorrect when recording in 24 bit quality

There is a very slight performance cost in using the sample-format set in preferences that does not seem to matter in practice.  That's because the status message is updated infrequently, not every screen refresh, and the actual cost per look up is small.  See http://bugzilla.audacityteam.org/show_bug.cgi?id=1436 for information on slow reading of preferences.
This commit is contained in:
James Crook 2016-07-05 15:14:27 +01:00
parent 18eb2bbc7a
commit 101b3ee8cd

View File

@ -4533,9 +4533,19 @@ void AudacityProject::OnTimer(wxTimerEvent& WXUNUSED(event))
wxString msg;
double recTime;
int recMins;
// JKC: Bug 50: Use preferences to get actual sample format.
// However there is a slight performance impact due to Bug 1436
// So have left the old code in that gets the size (in RAM) but
// #ifdeffed out.
#if 1
sampleFormat oCaptureFormat = (sampleFormat)
gPrefs->Read(wxT("/SamplingRate/DefaultProjectSampleFormat"), floatSample);
#else
sampleFormat oCaptureFormat = gAudioIO->GetCaptureFormat();
#endif
double bytesOnDiskPerSample = SAMPLE_SIZE_DISK(oCaptureFormat);
recTime = freeSpace.GetHi() * 4294967296.0 + freeSpace.GetLo();
recTime /= SAMPLE_SIZE_DISK(gAudioIO->GetCaptureFormat());
recTime /= bytesOnDiskPerSample;
// note size on disk (=3 for 24-bit) not in memory (=4 for 24-bit)
recTime /= gAudioIO->GetNumCaptureChannels();
recTime /= GetRate();
@ -5429,8 +5439,9 @@ int AudacityProject::GetEstimatedRecordingMinsLeftOnDisk() {
// Calculate the remaining time
double dRecTime = 0.0;
double bytesOnDiskPerSample = SAMPLE_SIZE_DISK(oCaptureFormat);
dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
dRecTime /= SAMPLE_SIZE_DISK(oCaptureFormat);
dRecTime /= bytesOnDiskPerSample;
dRecTime /= lCaptureChannels;
dRecTime /= GetRate();