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.
| 859 | // The calculations made are based on the user's current |
| 860 | // preferences. |
| 861 | int 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 | } |