Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "gml"]
path = gml
url = https://github.com/ilmola/gml.git
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be great to be able to use this from a system package as well.
Currently there's no release of this header-only library though.

Regarding submodules: Please keep in mind, that if you do a git tag, github will not include submodules in your tarball!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently there's no release of this header-only library

Yes, it's not very well known. But I liked it because it is very small. Most other libraries I found had a million other features that I don't need.

If you know a better option, just let me know, we can easily switch. I deliberately didn't use GML types in any API functions.

github will not include submodules in your tarball!

I know. But Github's tarball is quite useless anyway, because it doesn't have the ./configure in it. We ship our separate tarballs anyway.

19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ matrix:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test # only needed for <= trusty
- llvm-toolchain-trusty-7
packages:
- clang-7
- libstdc++-8-dev # only needed for <= trusty
dist: trusty
env:
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7 && COMPILE_ASIO=1"
Expand All @@ -49,10 +50,11 @@ matrix:
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test # only needed for <= trusty
- llvm-toolchain-trusty-6.0
packages:
- clang-6.0
- libstdc++-8-dev # only needed for <= trusty
dist: trusty
env:
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0 && COMPILE_ASIO=1"
Expand All @@ -61,23 +63,14 @@ matrix:
addons:
apt:
sources:
- ubuntu-toolchain-r-test # only needed for <= trusty
- llvm-toolchain-trusty-5.0
packages:
- clang-5.0
- libstdc++-7-dev # only needed for <= trusty
dist: trusty
env:
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++-5.0 && COMPILE_ASIO=1"
# linux with clang 4.0
- os: linux
addons:
apt:
sources:
- llvm-toolchain-trusty-4.0
packages:
- clang-4.0
dist: trusty
env:
- MATRIX_EVAL="CC=clang-4.0 && CXX=clang++-4.0 && COMPILE_ASIO=1"
# osx with xcode10.1/clang
- os: osx
osx_image: xcode10.1
Expand Down
12 changes: 8 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,19 @@ AS_IF([test x$have_debugging = xyes],
dnl overwrite default CXXFLAGS set by AC_PROG_CXX
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="-g"])

dnl select C++11 (unconditionally)
CXXFLAGS="$CXXFLAGS -std=c++11"
AC_MSG_CHECKING([if $CXX supports "-std=c++11"])
dnl select C++17 (unconditionally)
CXXFLAGS="$CXXFLAGS -std=c++17"
AC_MSG_CHECKING([if $CXX supports "-std=c++17"])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([C++11 not supported! Please upgrade.])
AC_MSG_ERROR([C++17 not supported! Please upgrade.])
])

dnl JACK1 problem with C++17: https://github.com/jackaudio/jack1/issues/84
AS_IF([test x$GCC = xyes],
[WARNING_FLAGS="$WARNING_FLAGS -Wno-register"])

dnl see http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1123
dnl and http://stackoverflow.com/q/11497252/500098
AC_MSG_CHECKING([if $CXX implements core/1123])
Expand Down
6 changes: 3 additions & 3 deletions flext/package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

vpath %.cpp ../src

SSR_SRCS = position.cpp orientation.cpp directionalpoint.cpp \
ssr_global.cpp xmlparser.cpp
SSR_SRCS = legacy_position.cpp legacy_orientation.cpp \
legacy_directionalpoint.cpp ssr_global.cpp xmlparser.cpp
SRCS = $(MAIN_SOURCE) $(SSR_SRCS)

INCPATH = -I../apf -I../src
Expand All @@ -12,7 +12,7 @@ PKG_CONFIG ?= pkg-config

INCPATH += `$(PKG_CONFIG) --cflags libxml-2.0`

CXXFLAGS = -std=c++11
CXXFLAGS = -std=c++17

LIBS = -lfftw3f -lsndfile -lxml2

Expand Down
21 changes: 16 additions & 5 deletions flext/ssr_flext.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#define SSR_FLEXT_H

#include <string>
#include <vector>

#include <flext.h>

Expand All @@ -50,7 +51,7 @@ FLEXT_NEW_DSP_V("ssr_" #name "~", ssr_ ## name)
#include "apf/pointer_policy.h"
#include "apf/cxx_thread_policy.h"

#include "../src/source.h"
#include "../src/legacy_source.h"

template<typename Renderer>
class SsrFlext : public flext_dsp
Expand Down Expand Up @@ -220,7 +221,7 @@ class SsrFlext : public flext_dsp

for (size_t i = 0; i < _in_channels; ++i)
{
_engine.add_source();
_source_ids.push_back(_engine.add_source(""));
AddInSignal();
}

Expand All @@ -244,6 +245,15 @@ class SsrFlext : public flext_dsp
_engine.audio_callback(Blocksize(), InSig(), OutSig());
}

std::string _get_string_id(int numeric_id) const
{
if (numeric_id < 1 || _source_ids.size() < numeric_id)
{
return {};
}
return _source_ids[numeric_id - 1];
}

FLEXT_CALLBACK_A(_handle_messages)
void _handle_messages(const t_symbol* s, int argc, const t_atom* argv)
{
Expand All @@ -265,7 +275,7 @@ class SsrFlext : public flext_dsp
return;
}

auto* source = _engine.get_source(src_id);
auto* source = _engine.get_source(_get_string_id(src_id));

if (!source)
{
Expand Down Expand Up @@ -364,14 +374,14 @@ class SsrFlext : public flext_dsp
error("%s - src model expects a string value!", thisName());
return;
}
Source::model_t model = Source::unknown;
LegacySource::model_t model = LegacySource::unknown;
if (!apf::str::S2A(model_str, model))
{
error("%s - couldn't convert model string: %s"
, thisName(), model_str.c_str());
return;
}
source->model = model;
source->model = model == LegacySource::plane ? "plane" : "point";
}
else
{
Expand Down Expand Up @@ -506,6 +516,7 @@ class SsrFlext : public flext_dsp

int _in_channels;
Renderer _engine;
std::vector<std::string> _source_ids;
};

#endif
1 change: 1 addition & 0 deletions gml
Submodule gml added at 154c1d
5 changes: 3 additions & 2 deletions mex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
MEXFILES ?= ssr_dca ssr_binaural ssr_vbap ssr_aap ssr_wfs ssr_generic \
ssr_brs

OBJECTS := ssr_global position orientation directionalpoint xmlparser
OBJECTS := ssr_global legacy_position legacy_orientation \
legacy_directionalpoint xmlparser

LIBRARIES += libxml-2.0 fftw3f sndfile

Expand All @@ -15,7 +16,7 @@ SRC_DIR ?= ../src
MEX ?= mex -v
OCT ?= mkoctfile --mex --verbose

CXXFLAGS += -std=c++11
CXXFLAGS += -std=c++17

# optimization:
CXXFLAGS_OPT += -O3
Expand Down
30 changes: 21 additions & 9 deletions mex/ssr_mex.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include "apf/cxx_thread_policy.h"
#include "loudspeakerrenderer.h"

#include "../src/source.h"
#include "../src/legacy_source.h"

template<typename Renderer>
class SsrMex
Expand Down Expand Up @@ -208,6 +208,7 @@ class SsrMex

_out_channels = _engine->get_output_list().size();

assert(_source_ids.size() == 0);
for (mwSize i = 0; i < _in_channels; ++i)
{
apf::parameter_map source_params;
Expand All @@ -216,8 +217,7 @@ class SsrMex
{
source_params.set("properties_file", filename_list[i]);
}
// TODO: specify ID?
_engine->add_source(source_params);
_source_ids.push_back(_engine->add_source("", source_params));
}

_inputs.resize(_in_channels);
Expand Down Expand Up @@ -367,7 +367,7 @@ class SsrMex
APF_MEX_ERROR_NO_FURTHER_INPUTS(command);
APF_MEX_ERROR_ONE_OPTIONAL_OUTPUT(command);

std::vector<Loudspeaker> ls_list;
std::vector<LegacyLoudspeaker> ls_list;
_engine->get_loudspeakers(ls_list);

if (command == "loudspeaker_position")
Expand Down Expand Up @@ -395,6 +395,16 @@ class SsrMex
}
}

// zero-based index
std::string _get_source_id(mwSize index)
{
if (index < 0 || static_cast<mwSize>(_source_ids.size()) <= index)
{
return {};
}
return _source_ids[index];
}

void _source_position(int& nrhs, const mxArray**& prhs)
{
APF_MEX_ERROR_FURTHER_INPUT_NEEDED("'source_position'");
Expand All @@ -419,7 +429,7 @@ class SsrMex
{
// TODO: handle 3D coordinates

auto* source = _engine->get_source(i + 1);
auto* source = _engine->get_source(_get_source_id(i));
// TODO: check if source == nullptr
source->position = Position(coordinates[i*2], coordinates[i*2+1]);
}
Expand All @@ -443,7 +453,7 @@ class SsrMex

for (mwSize i = 0; i < _in_channels; ++i)
{
auto* source = _engine->get_source(i + 1);
auto* source = _engine->get_source(_get_source_id(i));
// TODO: check if source == nullptr
source->orientation = Orientation(angles[i]); // degree
}
Expand All @@ -470,7 +480,7 @@ class SsrMex

for (mwSize i = 0; i < _in_channels; ++i)
{
auto* source = _engine->get_source(i + 1);
auto* source = _engine->get_source(_get_source_id(i));
source->mute = mute[i]; // logical
}
}
Expand All @@ -493,13 +503,14 @@ class SsrMex

for (int i = 0; i < _in_channels; ++i)
{
Source::model_t model = Source::unknown;
LegacySource::model_t model = LegacySource::unknown;
if (!apf::str::S2A(model_list[i], model))
{
mexPrintf("Model string '%s':", model_list[i].c_str());
mexErrMsgTxt("Couldn't convert source model string!");
}
_engine->get_source(i + 1)->model = model;
_engine->get_source(_get_source_id(i))->model
= model == LegacySource::plane ? "plane" : "point";
}
}

Expand Down Expand Up @@ -549,6 +560,7 @@ class SsrMex
std::unique_ptr<Renderer> _engine;
mwSize _in_channels, _out_channels, _block_size;
std::vector<sample_type*> _inputs, _outputs;
std::vector<std::string> _source_ids;
};

#endif
4 changes: 2 additions & 2 deletions src/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ALWAYS_DETAILED_SEC = YES
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.

INLINE_INHERITED_MEMB = NO
INLINE_INHERITED_MEMB = YES

# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
Expand Down Expand Up @@ -534,7 +534,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.

INPUT = main.cpp .
INPUT = main.cpp . ../gml/include/gml

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand Down
33 changes: 21 additions & 12 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ AM_CPPFLAGS =
## Add Audio Processing Framework (APF) path
AM_CPPFLAGS += -I$(srcdir)/../apf

## Add GML path
AM_CPPFLAGS += -I$(srcdir)/../gml/include

if ENABLE_APP_BUNDLE
AM_CPPFLAGS += -DSSR_DATA_DIR=\"SoundScapeRenderer.app/Contents/Resources\"
else
Expand All @@ -41,7 +44,9 @@ DOXYGEN_DOC_DIR = ../doc/doxygen
# files which should be distributed but not installed
dist_noinst_DATA = Doxyfile coding_style.txt \
../apf/misc/Makefile.dependencies \
../apf/apf/mextools.h
../apf/apf/mextools.h \
../gml/README.md \
../gml/LICENSE.txt

ssr_binaural_SOURCES = ssr_binaural.cpp binauralrenderer.h \
$(SSRSOURCES)
Expand Down Expand Up @@ -88,7 +93,7 @@ nodist_ssr_dca_SOURCES = $(SSRMOCFILES)

LOUDSPEAKERSOURCES = \
loudspeakerrenderer.h \
loudspeaker.h
legacy_loudspeaker.h

SSRSOURCES = \
../apf/apf/blockdelayline.h \
Expand All @@ -114,25 +119,29 @@ SSRSOURCES = \
../apf/apf/shareddata.h \
../apf/apf/sndfiletools.h \
../apf/apf/stringtools.h \
../gml/include/gml/vec.hpp \
../gml/include/gml/quaternion.hpp \
configuration.cpp \
configuration.h \
controller.h \
directionalpoint.cpp \
directionalpoint.h \
legacy_directionalpoint.cpp \
legacy_directionalpoint.h \
maptools.h \
orientation.cpp \
orientation.h \
position.cpp \
position.h \
legacy_orientation.cpp \
legacy_orientation.h \
legacy_position.cpp \
legacy_position.h \
posixpathtools.h \
publisher.h \
api.h \
geometry.h \
rendererbase.h \
scene.cpp \
legacy_scene.cpp \
legacy_scene.h \
legacy_xmlsceneprovider.h \
scene.h \
source.h \
legacy_source.h \
ssr_global.cpp \
ssr_global.h \
subscriber.h \
timetools.h \
tracker.h \
xmlparser.cpp \
Expand Down
Loading