SoundStretch: parse command-line argument values with double precision

This commit is contained in:
Olli 2024-09-21 09:41:37 +03:00
parent ddf28667c9
commit d3f7e2530b
3 changed files with 12 additions and 12 deletions

View File

@ -199,7 +199,7 @@ void RunParameters::throwLicense() const
ST_THROW_RT_ERROR(licenseText);
}
float RunParameters::parseSwitchValue(const STRING& str) const
double RunParameters::parseSwitchValue(const STRING& str) const
{
int pos;
@ -211,7 +211,7 @@ float RunParameters::parseSwitchValue(const STRING& str) const
}
// Read numerical parameter value after '='
return (float)stof(str.substr(pos + 1).c_str());
return stof(str.substr(pos + 1).c_str());
}

View File

@ -48,17 +48,17 @@ private:
void throwLicense() const;
void parseSwitchParam(const STRING& str);
void checkLimits();
float parseSwitchValue(const STRING& tr) const;
double parseSwitchValue(const STRING& tr) const;
public:
STRING inFileName;
STRING outFileName;
float tempoDelta{ 0 };
float pitchDelta{ 0 };
float rateDelta{ 0 };
double tempoDelta{ 0 };
double pitchDelta{ 0 };
double rateDelta{ 0 };
int quick{ 0 };
int noAntiAlias{ 0 };
float goalBPM{ 0 };
double goalBPM{ 0 };
bool detectBPM{ false };
bool speech{ false };

View File

@ -145,9 +145,9 @@ static void setup(SoundTouch& soundTouch, const WavInFile& inFile, const RunPara
#endif
// print processing information only if outFileName given i.e. some processing will happen
fprintf(stderr, "Processing the file with the following changes:\n");
fprintf(stderr, " tempo change = %+g %%\n", params.tempoDelta);
fprintf(stderr, " pitch change = %+g semitones\n", params.pitchDelta);
fprintf(stderr, " rate change = %+g %%\n\n", params.rateDelta);
fprintf(stderr, " tempo change = %+lg %%\n", params.tempoDelta);
fprintf(stderr, " pitch change = %+lg semitones\n", params.pitchDelta);
fprintf(stderr, " rate change = %+lg %%\n\n", params.rateDelta);
fprintf(stderr, "Working...");
}
else
@ -240,7 +240,7 @@ static void detectBPM(WavInFile& inFile, RunParameters& params)
if (bpmValue > 0)
{
fprintf(stderr, "Detected BPM rate %.1f\n\n", bpmValue);
fprintf(stderr, "Detected BPM rate %.1lf\n\n", bpmValue);
}
else
{
@ -252,7 +252,7 @@ static void detectBPM(WavInFile& inFile, RunParameters& params)
{
// adjust tempo to given bpm
params.tempoDelta = (params.goalBPM / bpmValue - 1.0f) * 100.0f;
fprintf(stderr, "The file will be converted to %.1f BPM\n\n", params.goalBPM);
fprintf(stderr, "The file will be converted to %.1lf BPM\n\n", params.goalBPM);
}
}