Skip to content

Commit

Permalink
change parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
CrSjimo committed Jul 10, 2024
1 parent d2fa5ae commit 2be482f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/core/utils/Decibels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

namespace talcs {

float Decibels::decibelsToGain(float decibels, float minusInfinityDb) {
return decibels > minusInfinityDb ? std::pow (10.0f, decibels * .1f) : .0f;
float Decibels::decibelsToGain(double decibels, double minusInfinityDb) {
return static_cast<float>(decibels > minusInfinityDb ? std::pow (10.0, decibels * .1) : .0);
}
float Decibels::gainToDecibels(float gain, float minusInfinityDb) {
return gain > .0f ? qMax (minusInfinityDb, std::log10 (gain) * 10.0f) : minusInfinityDb;
double Decibels::gainToDecibels(float gain, double minusInfinityDb) {
return gain > .0f ? qMax (minusInfinityDb, std::log10 (gain) * 10.0) : minusInfinityDb;
}
QString Decibels::toString(float decibels, int precision, float minusInfinityDb) {
QString Decibels::toString(double decibels, int precision, double minusInfinityDb) {
if (decibels <= minusInfinityDb)
return "-INF dB";
QString s;
if (decibels >= .0f)
if (decibels >= .0)
s += "+";
if (precision <= 0)
s += QString::number(int(decibels));
Expand Down
6 changes: 3 additions & 3 deletions src/core/utils/Decibels.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace talcs {

class TALCSCORE_EXPORT Decibels {
public:
static float decibelsToGain(float decibels, float minusInfinityDb = -96);
static float gainToDecibels(float gain, float minusInfinityDb = -96);
static QString toString(float decibels, int precision = 1, float minusInfinityDb = -96);
static float decibelsToGain(double decibels, double minusInfinityDb = -96);
static double gainToDecibels(float gain, double minusInfinityDb = -96);
static QString toString(double decibels, int precision = 1, double minusInfinityDb = -96);
};

}
Expand Down

0 comments on commit 2be482f

Please sign in to comment.