13
0

Vapor: allow to toggle 5.1 and 7.1.4 main output

This commit is contained in:
Robin Gareus 2024-01-11 05:16:21 +01:00
parent a9719f1b35
commit db7a67980d
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 34 additions and 0 deletions

View File

@ -60,6 +60,19 @@ public:
return _surround_processor;
}
enum MainOutputFormat {
OUTPUT_FORMAT_5_1 = 2,
OUTPUT_FORMAT_7_1_4 = 6
};
MainOutputFormat output_format () const {
return _current_output_format;
}
void set_output_format (MainOutputFormat mov) {
_target_output_format = mov;
}
/* a value <= -200 indicates that no data is available */
float integrated_loudness () const;
float max_dbtp () const;
@ -90,6 +103,8 @@ private:
pan_t _current_value[max_object_id][num_pan_parameters];
int _current_render_mode[max_object_id];
size_t _current_n_objects;
MainOutputFormat _target_output_format;
MainOutputFormat _current_output_format;
BufferSet _surround_bufs;
ChanMapping _in_map;
ChanMapping _out_map;

View File

@ -112,6 +112,7 @@ public:
uint32_t surr_BinauralRenderMode;
uint32_t surr_ChannelCount;
uint32_t surr_DownmixMode;
uint32_t surr_OutputFormat;
uint32_t surr_WarpMode;
uint32_t surr_ExportStart;
uint32_t surr_ExportStop;

View File

@ -34,6 +34,8 @@ SurroundReturn::SurroundReturn (Session& s, Route* r)
: Processor (s, _("SurrReturn"), Temporal::TimeDomainProvider (Temporal::AudioTime))
, _lufs_meter (s.nominal_sample_rate (), 5)
, _current_n_objects (max_object_id)
, _target_output_format (OUTPUT_FORMAT_7_1_4)
, _current_output_format (OUTPUT_FORMAT_7_1_4)
, _in_map (ChanCount (DataType::AUDIO, 128))
, _out_map (ChanCount (DataType::AUDIO, 14 + 6 /* Loudness Meter */))
, _exporting (false)
@ -202,6 +204,14 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_
#endif
}
if (_current_output_format != _target_output_format) {
_current_output_format = _target_output_format;
#if defined(LV2_EXTENDED) && defined(HAVE_LV2_1_10_0)
URIMap::URIDs const& urids = URIMap::instance ().urids;
forge_int_msg (urids.surr_Settings, urids.surr_OutputFormat, _target_output_format);
#endif
}
uint32_t meter_nframes = nframes;
uint32_t meter_offset = 0;
@ -386,6 +396,12 @@ SurroundReturn::max_dbtp () const
int
SurroundReturn::set_state (XMLNode const& node, int version)
{
int target_output_format;
if (node.get_property (X_("output-format"), target_output_format)) {
if (target_output_format == OUTPUT_FORMAT_5_1 || target_output_format == OUTPUT_FORMAT_7_1_4) {
_target_output_format = (MainOutputFormat) target_output_format;
}
}
return _trim->set_state (node, version);
}
@ -395,5 +411,6 @@ SurroundReturn::state () const
XMLNode& node (_trim->state ());
node.set_property ("name", "SurrReturn");
node.set_property ("type", "surreturn");
node.set_property ("output-format", (int) _current_output_format);
return node;
}

View File

@ -89,6 +89,7 @@ URIMap::URIDs::init(URIMap& uri_map)
surr_BinauralRenderMode = uri_map.uri_to_id("urn:ardour:a-vapor#BinauralRenderMode");
surr_ChannelCount = uri_map.uri_to_id("urn:ardour:a-vapor#ChannelCount");
surr_DownmixMode = uri_map.uri_to_id("urn:ardour:a-vapor#DownmixMode");
surr_OutputFormat = uri_map.uri_to_id("urn:ardour:a-vapor#OutputFormat");
surr_WarpMode = uri_map.uri_to_id("urn:ardour:a-vapor#WarpMode");
surr_ExportStart = uri_map.uri_to_id("urn:ardour:a-vapor#ExportStart");
surr_ExportStop = uri_map.uri_to_id("urn:ardour:a-vapor#ExportStop");