Browse Source

modules: spatialaudio: compat with new API

This merely makes it build with the new API and doesn't yet migrate
to newer APIs.
pull/203/head
Marvin Scholz 2 months ago
committed by Steve Lhomme
parent
commit
a41efcaf1d
  1. 39
      modules/audio_filter/channel_mixer/spatialaudio.cpp

39
modules/audio_filter/channel_mixer/spatialaudio.cpp

@ -44,6 +44,23 @@
#include <spatialaudio/Ambisonics.h>
#include <spatialaudio/SpeakersBinauralizer.h>
#ifdef HAVE_SPATIALAUDIOVERSION_H
# include <spatialaudio/SpatialaudioVersion.h>
#else
# define SPATIALAUDIO_API_VERSION_MAJOR 0
#endif
#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
using namespace spaudio;
using CAmbisonicBinauralizer = spaudio::AmbisonicBinauralizer;
using CAmbisonicDecoder = spaudio::AmbisonicDecoder;
using CAmbisonicProcessor = spaudio::AmbisonicProcessor;
using CAmbisonicZoomer = spaudio::AmbisonicZoomer;
using CAmbisonicSpeaker = spaudio::AmbisonicSpeaker;
using CBFormat = spaudio::BFormat;
#define kAmblib_CustomSpeakerSetUp Amblib_SpeakerSetUps::kAmblib_CustomSpeakerSetUp
#endif
#define DEFAULT_HRTF_PATH "hrtfs" DIR_SEP "dodeca_and_7channel_3DSL_HRTF.sofa"
#define HRTF_FILE_TEXT N_("HRTF file for the binauralization")
@ -487,10 +504,18 @@ static int Open(vlc_object_t *p_this)
p_sys->mode = filter_spatialaudio::AMBISONICS_DECODER;
unsigned i_nbChannels = aout_FormatNbChannels(&p_filter->fmt_out.audio);
if (i_nbChannels == 1
|| !p_sys->speakerDecoder.Configure(p_sys->i_order, true,
kAmblib_CustomSpeakerSetUp,
i_nbChannels))
bool ok = false;
if (i_nbChannels > 1) {
#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
ok = p_sys->speakerDecoder.Configure(p_sys->i_order, true,
AMB_BLOCK_TIME_LEN, p_filter->fmt_in.audio.i_rate,
kAmblib_CustomSpeakerSetUp, i_nbChannels);
#else
ok = p_sys->speakerDecoder.Configure(p_sys->i_order, true,
kAmblib_CustomSpeakerSetUp, i_nbChannels);
#endif
}
if (!ok)
{
msg_Err(p_filter, "Error creating the Ambisonics decoder.");
delete p_sys;
@ -539,7 +564,13 @@ static int Open(vlc_object_t *p_this)
return VLC_EGENERIC;
}
#if SPATIALAUDIO_API_VERSION_MAJOR >= 2
if (!p_sys->zoomer.Configure(p_sys->i_order, true,
AMB_BLOCK_TIME_LEN,
p_filter->fmt_in.audio.i_rate))
#else
if (!p_sys->zoomer.Configure(p_sys->i_order, true, 0))
#endif
{
msg_Err(p_filter, "Error creating the ambisonic zoomer.");
delete p_sys;

Loading…
Cancel
Save