Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ target_include_directories(spatialaudio
target_compile_definitions(spatialaudio
PRIVATE
SPATIALAUDIO_COMPILATION
PUBLIC
_USE_MATH_DEFINES
)

if(MYSOFA_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion cmake/spatialaudio.pc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Name: spatialaudio
Description: Spatial audio rendering library
Version: @PROJECT_VERSION@
Libs: -L${libdir} -lspatialaudio @MYSOFA_LIB@ -lm -lz
Cflags: -I${includedir} @MYSOFA_INCLUDE@
Cflags: -I${includedir} @MYSOFA_INCLUDE@ -D_USE_MATH_DEFINES
5 changes: 3 additions & 2 deletions include/AmbisonicCommons.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
#ifndef SPATIALAUDIO_AMBISONIC_COMMONS_H
#define SPATIALAUDIO_AMBISONIC_COMMONS_H

#define _USE_MATH_DEFINES
#include <math.h>
#ifndef _USE_MATH_DEFINES
# define _USE_MATH_DEFINES
#endif
#include <cmath>
#include <memory.h>

Expand Down
11 changes: 6 additions & 5 deletions include/Tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
#ifndef SPATIALAUDIO_TOOLS_H
#define SPATIALAUDIO_TOOLS_H

#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<numeric>
#include<algorithm>
#ifndef _USE_MATH_DEFINES
# define _USE_MATH_DEFINES
#endif
#include <cmath>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <vector>
#include "assert.h"
Expand Down
1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ libspatialaudio_dep = declare_dependency(
include_directories : spatialaudio_incdirs,
dependencies : dependencies,
link_with : spatialaudio_lib,
compile_args : ['-D_USE_MATH_DEFINES'],
)
meson.override_dependency('libspatialaudio', libspatialaudio_dep)

Expand Down
2 changes: 1 addition & 1 deletion source/Decorrelator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#include "Decorrelator.h"

#include<random>
#include <random>

namespace spaudio {

Expand Down
12 changes: 6 additions & 6 deletions source/PointSourcePannerGainCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

#include "LoudspeakerLayoutHulls.h"

#include<cmath>
#include<string>
#include <cmath>
#include <string>
#include <map>

namespace spaudio {
Expand Down Expand Up @@ -364,7 +364,7 @@ namespace spaudio {
{
upperLayerSet.push_back(iSpk);
// TODO: consider remapping azimuth to range -180 to 180
maxUpperAz = std::max(maxUpperAz, abs(layout.getChannel(iSpk).getPolarPositionNominal().azimuth));
maxUpperAz = std::max(maxUpperAz, std::abs(layout.getChannel(iSpk).getPolarPositionNominal().azimuth));
meanUpperEl += layout.getChannel(iSpk).getPolarPosition().elevation;
}
else if (el >= -10 && el <= 10)
Expand All @@ -376,7 +376,7 @@ namespace spaudio {
{
lowerLayerSet.push_back(iSpk);
// TODO: consider remapping azimuth to range -180 to 180
maxLowerAz = std::max(maxLowerAz, abs(layout.getChannel(iSpk).getPolarPositionNominal().azimuth));
maxLowerAz = std::max(maxLowerAz, std::abs(layout.getChannel(iSpk).getPolarPositionNominal().azimuth));
meanLowerEl += layout.getChannel(iSpk).getPolarPosition().elevation;
}
}
Expand All @@ -390,7 +390,7 @@ namespace spaudio {
auto name = layout.getChannel(midLayerSet[iMid]).getChannelName();
double azimuth = layout.getChannel(midLayerSet[iMid]).getPolarPosition().azimuth;
// Lower layer
if ((lowerLayerSet.size() > 0 && abs(azimuth) > maxLowerAz + 40.) || lowerLayerSet.size() == 0)
if ((lowerLayerSet.size() > 0 && std::abs(azimuth) > maxLowerAz + 40.) || lowerLayerSet.size() == 0)
{
m_downmixMapping.push_back(iMid);
name.at(0) = 'B';
Expand All @@ -406,7 +406,7 @@ namespace spaudio {
auto name = layout.getChannel(midLayerSet[iMid]).getChannelName();
double azimuth = layout.getChannel(midLayerSet[iMid]).getPolarPosition().azimuth;
// Upper layer
if ((upperLayerSet.size() > 0 && abs(azimuth) > maxUpperAz + 40.) || upperLayerSet.size() == 0)
if ((upperLayerSet.size() > 0 && std::abs(azimuth) > maxUpperAz + 40.) || upperLayerSet.size() == 0)
{
m_downmixMapping.push_back(iMid);
name.at(0) = 'U';
Expand Down
2 changes: 1 addition & 1 deletion source/RegionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/*############################################################################*/

#include "RegionHandlers.h"
#include<string>
#include <string>
#include <map>

namespace spaudio {
Expand Down
4 changes: 2 additions & 2 deletions source/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
/*############################################################################*/

#include "Renderer.h"
#include<type_traits>
#include<iostream>
#include <type_traits>
#include <iostream>

namespace spaudio {

Expand Down
2 changes: 1 addition & 1 deletion source/adm/DirectSpeakersGainCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/*############################################################################*/

#include "adm/DirectSpeakersGainCalc.h"
#include<string>
#include <string>
#include <map>

namespace spaudio {
Expand Down
2 changes: 1 addition & 1 deletion source/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ spatialaudio_sources = files(
'ObjectPanner.cpp',
)

spatialaudio_clike_args = ['-DSPATIALAUDIO_COMPILATION']
spatialaudio_clike_args = ['-DSPATIALAUDIO_COMPILATION', '-D_USE_MATH_DEFINES']

# Extract version info from header
spatialaudio_api_version = cpp.get_define('SPATIALAUDIO_API_VERSION_STRING',
Expand Down
Loading