Skip to content

Commit 6a67d65

Browse files
committed
Re-design publish/subscribe interface, introduce leader/follower concept
1 parent 640a87b commit 6a67d65

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+3353
-2662
lines changed

configure.ac

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ AS_IF([test x$have_debugging = xyes],
227227
dnl overwrite default CXXFLAGS set by AC_PROG_CXX
228228
AS_IF([test x$usercxxflags = xno], [CXXFLAGS="-g"])
229229

230-
dnl select C++11 (unconditionally)
231-
CXXFLAGS="$CXXFLAGS -std=c++11"
232-
AC_MSG_CHECKING([if $CXX supports "-std=c++11"])
230+
dnl select C++17 (unconditionally)
231+
CXXFLAGS="$CXXFLAGS -std=c++17"
232+
AC_MSG_CHECKING([if $CXX supports "-std=c++17"])
233233
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], AC_MSG_RESULT([yes]),
234234
[
235235
AC_MSG_RESULT([no])
236-
AC_MSG_ERROR([C++11 not supported! Please upgrade.])
236+
AC_MSG_ERROR([C++17 not supported! Please upgrade.])
237237
])
238238

239239
dnl JACK1 problem with C++17: https://github.com/jackaudio/jack1/issues/84

flext/package.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
vpath %.cpp ../src
44

5-
SSR_SRCS = position.cpp orientation.cpp directionalpoint.cpp \
6-
ssr_global.cpp xmlparser.cpp
5+
SSR_SRCS = legacy_position.cpp legacy_orientation.cpp \
6+
legacy_directionalpoint.cpp ssr_global.cpp xmlparser.cpp
77
SRCS = $(MAIN_SOURCE) $(SSR_SRCS)
88

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

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

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

1717
LIBS = -lfftw3f -lsndfile -lxml2
1818

flext/ssr_flext.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define SSR_FLEXT_H
3232

3333
#include <string>
34+
#include <vector>
3435

3536
#include <flext.h>
3637

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

53-
#include "../src/source.h"
54+
#include "../src/legacy_source.h"
5455

5556
template<typename Renderer>
5657
class SsrFlext : public flext_dsp
@@ -220,7 +221,7 @@ class SsrFlext : public flext_dsp
220221

221222
for (size_t i = 0; i < _in_channels; ++i)
222223
{
223-
_engine.add_source();
224+
_source_ids.push_back(_engine.add_source(""));
224225
AddInSignal();
225226
}
226227

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

248+
std::string _get_string_id(int numeric_id) const
249+
{
250+
if (numeric_id < 1 || _source_ids.size() < numeric_id)
251+
{
252+
return {};
253+
}
254+
return _source_ids[numeric_id - 1];
255+
}
256+
247257
FLEXT_CALLBACK_A(_handle_messages)
248258
void _handle_messages(const t_symbol* s, int argc, const t_atom* argv)
249259
{
@@ -265,7 +275,7 @@ class SsrFlext : public flext_dsp
265275
return;
266276
}
267277

268-
auto* source = _engine.get_source(src_id);
278+
auto* source = _engine.get_source(_get_string_id(src_id));
269279

270280
if (!source)
271281
{
@@ -364,14 +374,14 @@ class SsrFlext : public flext_dsp
364374
error("%s - src model expects a string value!", thisName());
365375
return;
366376
}
367-
Source::model_t model = Source::unknown;
377+
LegacySource::model_t model = LegacySource::unknown;
368378
if (!apf::str::S2A(model_str, model))
369379
{
370380
error("%s - couldn't convert model string: %s"
371381
, thisName(), model_str.c_str());
372382
return;
373383
}
374-
source->model = model;
384+
source->model = model == LegacySource::plane ? "plane" : "point";
375385
}
376386
else
377387
{
@@ -506,6 +516,7 @@ class SsrFlext : public flext_dsp
506516

507517
int _in_channels;
508518
Renderer _engine;
519+
std::vector<std::string> _source_ids;
509520
};
510521

511522
#endif

mex/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
MEXFILES ?= ssr_dca ssr_binaural ssr_vbap ssr_aap ssr_wfs ssr_generic \
77
ssr_brs
88

9-
OBJECTS := ssr_global position orientation directionalpoint xmlparser
9+
OBJECTS := ssr_global legacy_position legacy_orientation \
10+
legacy_directionalpoint xmlparser
1011

1112
LIBRARIES += libxml-2.0 fftw3f sndfile
1213

@@ -15,7 +16,7 @@ SRC_DIR ?= ../src
1516
MEX ?= mex -v
1617
OCT ?= mkoctfile --mex --verbose
1718

18-
CXXFLAGS += -std=c++11
19+
CXXFLAGS += -std=c++17
1920

2021
# optimization:
2122
CXXFLAGS_OPT += -O3

mex/ssr_mex.h

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "apf/cxx_thread_policy.h"
4545
#include "loudspeakerrenderer.h"
4646

47-
#include "../src/source.h"
47+
#include "../src/legacy_source.h"
4848

4949
template<typename Renderer>
5050
class SsrMex
@@ -208,6 +208,7 @@ class SsrMex
208208

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

211+
assert(_source_ids.size() == 0);
211212
for (mwSize i = 0; i < _in_channels; ++i)
212213
{
213214
apf::parameter_map source_params;
@@ -216,8 +217,7 @@ class SsrMex
216217
{
217218
source_params.set("properties_file", filename_list[i]);
218219
}
219-
// TODO: specify ID?
220-
_engine->add_source(source_params);
220+
_source_ids.push_back(_engine->add_source("", source_params));
221221
}
222222

223223
_inputs.resize(_in_channels);
@@ -367,7 +367,7 @@ class SsrMex
367367
APF_MEX_ERROR_NO_FURTHER_INPUTS(command);
368368
APF_MEX_ERROR_ONE_OPTIONAL_OUTPUT(command);
369369

370-
std::vector<Loudspeaker> ls_list;
370+
std::vector<LegacyLoudspeaker> ls_list;
371371
_engine->get_loudspeakers(ls_list);
372372

373373
if (command == "loudspeaker_position")
@@ -395,6 +395,16 @@ class SsrMex
395395
}
396396
}
397397

398+
// zero-based index
399+
std::string _get_source_id(mwSize index)
400+
{
401+
if (index < 0 || static_cast<mwSize>(_source_ids.size()) <= index)
402+
{
403+
return {};
404+
}
405+
return _source_ids[index];
406+
}
407+
398408
void _source_position(int& nrhs, const mxArray**& prhs)
399409
{
400410
APF_MEX_ERROR_FURTHER_INPUT_NEEDED("'source_position'");
@@ -419,7 +429,7 @@ class SsrMex
419429
{
420430
// TODO: handle 3D coordinates
421431

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

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

471481
for (mwSize i = 0; i < _in_channels; ++i)
472482
{
473-
auto* source = _engine->get_source(i + 1);
483+
auto* source = _engine->get_source(_get_source_id(i));
474484
source->mute = mute[i]; // logical
475485
}
476486
}
@@ -493,13 +503,14 @@ class SsrMex
493503

494504
for (int i = 0; i < _in_channels; ++i)
495505
{
496-
Source::model_t model = Source::unknown;
506+
LegacySource::model_t model = LegacySource::unknown;
497507
if (!apf::str::S2A(model_list[i], model))
498508
{
499509
mexPrintf("Model string '%s':", model_list[i].c_str());
500510
mexErrMsgTxt("Couldn't convert source model string!");
501511
}
502-
_engine->get_source(i + 1)->model = model;
512+
_engine->get_source(_get_source_id(i))->model
513+
= model == LegacySource::plane ? "plane" : "point";
503514
}
504515
}
505516

@@ -549,6 +560,7 @@ class SsrMex
549560
std::unique_ptr<Renderer> _engine;
550561
mwSize _in_channels, _out_channels, _block_size;
551562
std::vector<sample_type*> _inputs, _outputs;
563+
std::vector<std::string> _source_ids;
552564
};
553565

554566
#endif

src/Doxyfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ ALWAYS_DETAILED_SEC = YES
9999
# members were ordinary class members. Constructors, destructors and assignment
100100
# operators of the base classes will not be shown.
101101

102-
INLINE_INHERITED_MEMB = NO
102+
INLINE_INHERITED_MEMB = YES
103103

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

537-
INPUT = main.cpp .
537+
INPUT = main.cpp . ../gml/include/gml
538538

539539
# This tag can be used to specify the character encoding of the source files
540540
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is

src/Makefile.am

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ nodist_ssr_dca_SOURCES = $(SSRMOCFILES)
9393

9494
LOUDSPEAKERSOURCES = \
9595
loudspeakerrenderer.h \
96-
loudspeaker.h
96+
legacy_loudspeaker.h
9797

9898
SSRSOURCES = \
9999
../apf/apf/blockdelayline.h \
@@ -124,22 +124,24 @@ SSRSOURCES = \
124124
configuration.cpp \
125125
configuration.h \
126126
controller.h \
127-
directionalpoint.cpp \
128-
directionalpoint.h \
127+
legacy_directionalpoint.cpp \
128+
legacy_directionalpoint.h \
129129
maptools.h \
130-
orientation.cpp \
131-
orientation.h \
132-
position.cpp \
133-
position.h \
130+
legacy_orientation.cpp \
131+
legacy_orientation.h \
132+
legacy_position.cpp \
133+
legacy_position.h \
134134
posixpathtools.h \
135-
publisher.h \
135+
api.h \
136+
geometry.h \
136137
rendererbase.h \
137-
scene.cpp \
138+
legacy_scene.cpp \
139+
legacy_scene.h \
140+
legacy_xmlsceneprovider.h \
138141
scene.h \
139-
source.h \
142+
legacy_source.h \
140143
ssr_global.cpp \
141144
ssr_global.h \
142-
subscriber.h \
143145
timetools.h \
144146
tracker.h \
145147
xmlparser.cpp \

src/aaprenderer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ AapRenderer::load_reproduction_setup()
183183

184184
for (const auto& out: rtlist_proxy<Output>(this->get_output_list()))
185185
{
186-
if (out.model == Loudspeaker::subwoofer)
186+
if (out.model == LegacyLoudspeaker::subwoofer)
187187
{
188188
// TODO: something
189189
}
@@ -221,7 +221,7 @@ AapRenderer::RenderFunction::select(SourceChannel& in)
221221

222222
auto weighting_factor = sample_type();
223223

224-
if (_out.model == Loudspeaker::normal)
224+
if (_out.model == LegacyLoudspeaker::normal)
225225
{
226226
// WARNING: The reference offset is currently broken!
227227

0 commit comments

Comments
 (0)