13
0

Vapor: replace output format API with a controllable

This commit is contained in:
Robin Gareus 2024-01-18 00:14:07 +01:00
parent d01bb73548
commit 356374bfb3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 27 additions and 8 deletions

View File

@ -30,6 +30,7 @@
#include "ardour/chan_mapping.h"
#include "ardour/lufs_meter.h"
#include "ardour/monitor_processor.h"
#include "ardour/processor.h"
namespace ARDOUR
@ -69,8 +70,8 @@ public:
return _current_output_format;
}
void set_output_format (MainOutputFormat mov) {
_target_output_format = mov;
std::shared_ptr<PBD::Controllable> output_format_controllable () const {
return _output_format_control;
}
/* a value <= -200 indicates that no data is available */
@ -98,12 +99,29 @@ private:
std::shared_ptr<Amp> _trim;
class OutputFormatControl : public MPControl<bool>
{
public:
OutputFormatControl (bool v, std::string const& n, PBD::Controllable::Flag f)
: MPControl<bool> (v, n, f)
{}
virtual std::string get_user_string () const {
if (get_value () == 0) {
return "7.1.4";
} else {
return "5.1";
}
}
};
std::shared_ptr<OutputFormatControl> _output_format_control;
LV2_Atom_Forge _forge;
uint8_t _atom_buf[8192];
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;

View File

@ -33,8 +33,8 @@ using namespace ARDOUR;
SurroundReturn::SurroundReturn (Session& s, Route* r)
: Processor (s, _("SurrReturn"), Temporal::TimeDomainProvider (Temporal::AudioTime))
, _lufs_meter (s.nominal_sample_rate (), 5)
, _output_format_control (new OutputFormatControl (false, _("Output Format"), PBD::Controllable::Toggle))
, _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 */))
@ -204,11 +204,12 @@ 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;
MainOutputFormat target_output_format = _output_format_control->get_value () == 0 ? OUTPUT_FORMAT_7_1_4 : OUTPUT_FORMAT_5_1;
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);
forge_int_msg (urids.surr_Settings, urids.surr_OutputFormat, target_output_format);
#endif
}
@ -399,7 +400,7 @@ 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;
_output_format_control->set_value (target_output_format == OUTPUT_FORMAT_7_1_4 ? 0.0 : 1.0, PBD::Controllable::NoGroup);
}
}
return _trim->set_state (node, version);