Skip to content

Commit

Permalink
fix GLib build
Browse files Browse the repository at this point in the history
  • Loading branch information
psmokotnin committed Feb 14, 2022
1 parent c72d317 commit c9ccf26
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/common/wavfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
*/
#include "wavfile.h"
#include <QtEndian>
#include <QtMath>
#include <QDebug>
#include <cstring>

WavFile::WavFile() : m_dataPosition(0)
{
Expand Down
1 change: 1 addition & 0 deletions src/generator/mnoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
M‑Noise Test Signal and Test Method is Patent Pending.
*/
#include "mnoise.h"
#include <QtMath>

MNoise::MNoise(QObject *parent) : Wav(parent)
{
Expand Down
1 change: 1 addition & 0 deletions src/generator/wav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "wav.h"
#include <QtMath>

Wav::Wav(QObject *parent) : OutputDevice(parent)
{
Expand Down
7 changes: 4 additions & 3 deletions src/union.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "stored.h"
#include "sourcelist.h"
#include <QJsonArray>
#include <cmath>

Union::Union(Settings *settings, QObject *parent): chart::Source(parent),
m_settings(settings),
Expand Down Expand Up @@ -320,7 +321,7 @@ void Union::calcdB(unsigned int count, chart::Source *primary) noexcept
for (unsigned int i = 0; i < primary->size(); i++) {
magnitude = primary->magnitude(i);
phase = primary->phase(i);
module = 20.f * std::log10f((primary)->module(i));
module = 20.f * std::log10((primary)->module(i));
coherence = std::abs(primary->module(i) * primary->coherence(i));
coherenceWeight = std::abs(primary->module(i));

Expand All @@ -331,15 +332,15 @@ void Union::calcdB(unsigned int count, chart::Source *primary) noexcept
case Avg:
magnitude += (*it)->magnitude(i);
phase += (*it)->phase(i);
module += 20.f * std::log10f((*it)->module(i));
module += 20.f * std::log10((*it)->module(i));
break;
case Subtract:
magnitude -= (*it)->magnitude(i);
auto p = phase.real * (*it)->phase(i).real + phase.imag * (*it)->phase(i).imag;
auto sign = (phase.imag - (*it)->phase(i).imag > 0 ? 1 : -1);
phase.real = p / (phase.abs() * (*it)->phase(i).abs());
phase.imag = sign * std::sqrt(1 - phase.real * phase.real);
module -= 20.f * std::log10f((*it)->module(i));
module -= 20.f * std::log10((*it)->module(i));
break;
}

Expand Down

0 comments on commit c9ccf26

Please sign in to comment.