aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/ambdec.cpp15
-rw-r--r--core/ambdec.h3
2 files changed, 12 insertions, 6 deletions
diff --git a/core/ambdec.cpp b/core/ambdec.cpp
index e40b3868..31eaf391 100644
--- a/core/ambdec.cpp
+++ b/core/ambdec.cpp
@@ -220,8 +220,6 @@ al::optional<std::string> AmbDecConf::load(const char *fname) noexcept
if(!ChanMask)
return al::make_optional("Invalid chan_mask: "+std::to_string(ChanMask));
- if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa)
- return al::make_optional<std::string>("FuMa not compatible with over third-order");
}
else if(command == "/dec/freq_bands")
{
@@ -252,15 +250,15 @@ al::optional<std::string> AmbDecConf::load(const char *fname) noexcept
}
else if(command == "/dec/coeff_scale")
{
+ if(CoeffScale != AmbDecScale::Unset)
+ return al::make_optional<std::string>("Duplicate coeff_scale");
+
std::string scale = read_word(istr);
if(scale == "n3d") CoeffScale = AmbDecScale::N3D;
else if(scale == "sn3d") CoeffScale = AmbDecScale::SN3D;
else if(scale == "fuma") CoeffScale = AmbDecScale::FuMa;
else
return al::make_optional("Unexpected coeff_scale: "+scale);
-
- if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa)
- return al::make_optional<std::string>("FuMa not compatible with over third-order");
}
else if(command == "/opt/xover_freq")
{
@@ -362,8 +360,15 @@ al::optional<std::string> AmbDecConf::load(const char *fname) noexcept
if(!is_at_end(buffer, endpos))
return al::make_optional("Extra junk on end: " + buffer.substr(endpos));
+ if(ChanMask == 0)
+ return al::make_optional<std::string>("No channel mask defined");
if(!speakers_loaded || !matrix_loaded || (FreqBands == 2 && !lfmatrix_loaded))
return al::make_optional<std::string>("No decoder defined");
+ if(CoeffScale == AmbDecScale::Unset)
+ return al::make_optional<std::string>("No coefficient scaling defined");
+
+ if(ChanMask > Ambi3OrderMask && CoeffScale == AmbDecScale::FuMa)
+ return al::make_optional<std::string>("FuMa not compatible with over third-order");
return al::nullopt;
}
diff --git a/core/ambdec.h b/core/ambdec.h
index e1bcde26..7f739781 100644
--- a/core/ambdec.h
+++ b/core/ambdec.h
@@ -11,6 +11,7 @@
/* Helpers to read .ambdec configuration files. */
enum class AmbDecScale {
+ Unset,
N3D,
SN3D,
FuMa,
@@ -21,7 +22,7 @@ struct AmbDecConf {
unsigned int ChanMask{0u};
unsigned int FreqBands{0u}; /* Must be 1 or 2 */
- AmbDecScale CoeffScale{};
+ AmbDecScale CoeffScale{AmbDecScale::Unset};
float XOverFreq{0.0f};
float XOverRatio{0.0f};