MCPcopy Create free account
hub / github.com/audacity/audacity / GetEstimatedRecordingMinsLeftOnDisk

Method GetEstimatedRecordingMinsLeftOnDisk

src/ProjectManager.cpp:861–886  ·  view source on GitHub ↗

This routine will give an estimate of how many minutes of recording time we have available. The calculations made are based on the user's current preferences.

Source from the content-addressed store, hash-verified

859// The calculations made are based on the user's current
860// preferences.
861int ProjectManager::GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels) {
862 auto &project = mProject;
863
864 // Obtain the current settings
865 auto oCaptureFormat = QualitySettings::SampleFormatChoice();
866 if (lCaptureChannels == 0)
867 lCaptureChannels = AudioIORecordChannels.Read();
868
869 // Find out how much free space we have on disk
870 wxLongLong lFreeSpace = ProjectFileIO::Get( project ).GetFreeDiskSpace();
871 if (lFreeSpace < 0) {
872 return 0;
873 }
874
875 // Calculate the remaining time
876 double dRecTime = 0.0;
877 double bytesOnDiskPerSample = SAMPLE_SIZE_DISK(oCaptureFormat);
878 dRecTime = lFreeSpace.GetHi() * 4294967296.0 + lFreeSpace.GetLo();
879 dRecTime /= bytesOnDiskPerSample;
880 dRecTime /= lCaptureChannels;
881 dRecTime /= ProjectRate::Get( project ).GetRate();
882
883 // Convert to minutes before returning
884 int iRecMins = (int)round(dRecTime / 60.0);
885 return iRecMins;
886}

Callers 1

OnOKMethod · 0.80

Calls 5

GetFunction · 0.85
roundFunction · 0.85
GetFreeDiskSpaceMethod · 0.80
ReadMethod · 0.45
GetRateMethod · 0.45

Tested by

no test coverage detected