Audacity 3.2.0
Functions
anonymous_namespace{TimeAndPitchExperimentalSettings.cpp} Namespace Reference

Functions

template<typename T >
std::optional< T > GetFromFile (const char *filenameStem)
 

Detailed Description


Audacity: A Digital Audio Editor

TimeAndPitchExperimentalSettings.cpp

Matthieu Hodgkinson

Function Documentation

◆ GetFromFile()

template<typename T >
std::optional< T > anonymous_namespace{TimeAndPitchExperimentalSettings.cpp}::GetFromFile ( const char *  filenameStem)

Definition at line 19 of file TimeAndPitchExperimentalSettings.cpp.

20{
21 bool tuningOn = false;
22 gPrefs->Read(wxT("/TimeAndPitch/TuningOn"), &tuningOn, false);
23 if (!tuningOn)
24 return {};
25 T value;
26 std::ifstream file { TimeAndPitchExperimentalSettings::GetLogDir() + "/" +
27 filenameStem + ".txt" };
28 if (!file.is_open())
29 return {};
30 // Check if file is empty or first character is newline.
31 if (file.peek() == std::ifstream::traits_type::eof() || file.peek() == '\n')
32 return {};
33 file >> value;
34 return value;
35}
wxT("CloseDown"))
audacity::BasicSettings * gPrefs
Definition: Prefs.cpp:68
virtual bool Read(const wxString &key, bool *value) const =0

References TimeAndPitchExperimentalSettings::GetLogDir(), gPrefs, audacity::BasicSettings::Read(), and wxT().

Here is the call graph for this function: