Vapor: add additional options for ADM export

This commit is contained in:
Robin Gareus 2024-03-11 23:55:26 +01:00
parent 35017245d9
commit 682f4dafd3
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 36 additions and 8 deletions

View File

@ -111,6 +111,8 @@ public:
/* XXX this is only for testing */
void set_bed_mix (bool on, std::string const& ref, int* cmap = NULL);
void set_sync_and_align (bool on);
void set_ffoa (float);
void set_with_all_metadata (bool);
int set_state (XMLNode const&, int version);
@ -190,8 +192,10 @@ private:
samplepos_t _export_end;
bool _rolling;
bool _with_bed;
std::string _export_reference;
bool _sync_and_align;
bool _with_all_metadata;
float _ffoa;
std::string _export_reference;
FixedDelay _delaybuffers;
std::atomic<int> _flush;
};

View File

@ -1923,6 +1923,8 @@ LuaBindings::common (lua_State* L)
.deriveWSPtrClass <SurroundReturn, Processor> ("SurroundReturn")
.addFunction ("set_bed_mix", &SurroundReturn::set_bed_mix)
.addFunction ("set_sync_and_align", &SurroundReturn::set_sync_and_align)
.addFunction ("set_ffoa", &SurroundReturn::set_ffoa)
.addFunction ("set_with_all_metadata", &SurroundReturn::set_with_all_metadata)
.addFunction ("have_au_renderer", &SurroundReturn::have_au_renderer)
.addFunction ("load_au_preset", &SurroundReturn::load_au_preset)
.addFunction ("set_au_param", &SurroundReturn::set_au_param)

View File

@ -92,6 +92,8 @@ SurroundReturn::SurroundReturn (Session& s, Route* r)
, _rolling (false)
, _with_bed (false)
, _sync_and_align (false)
, _with_all_metadata (false)
, _ffoa (0)
{
#if !(defined(LV2_EXTENDED) && defined(HAVE_LV2_1_10_0))
throw failed_constructor ();
@ -357,6 +359,7 @@ void
SurroundReturn::set_bed_mix (bool on, std::string const& ref, int* cmap)
{
_with_bed = on;
_with_all_metadata = on;
if (!_with_bed) {
_export_reference.clear ();
@ -385,6 +388,18 @@ SurroundReturn::set_sync_and_align (bool on)
_sync_and_align = on;
}
void
SurroundReturn::set_ffoa (float ffoa)
{
_ffoa = ffoa;
}
void
SurroundReturn::set_with_all_metadata (bool on)
{
_with_all_metadata = on;
}
void
SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_sample, double speed, pframes_t nframes, bool)
{
@ -425,7 +440,8 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_
latency_changed ();
}
bool with_bed = _with_bed;
bool with_bed = _with_bed;
bool with_all_metadata = _with_all_metadata;
samplecnt_t latency = effective_latency ();
@ -501,12 +517,18 @@ SurroundReturn::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t end_
break;
}
samplecnt_t pos = std::min (timepos_t (start).distance (next_event.when).samples (), (samplecnt_t)nframes - 1);
evaluate (id, p, next_event.when, pos, with_bed);
evaluate (id, p, next_event.when, pos, with_all_metadata);
next = next_event.when;
}
/* inform live renderer */
if (!found_event && !_exporting) {
evaluate (id, p, start, 0);
if (!found_event) {
if (p->pan_pos_x->list ()->interpolation () != Evoral::ControlList::Discrete || !_exporting) {
evaluate (id, p, start, 0, with_all_metadata);
/* send event at export end */
if (_exporting && _export_end - 1 >= start_sample && _export_end - 1 < end_sample) {
evaluate (id, p, timepos_t (_export_end + latency - 1), _export_end - start_sample - 1, with_all_metadata);
}
}
}
}
}
@ -714,7 +736,7 @@ void
SurroundReturn::maybe_send_metadata (size_t id, pframes_t sample, pan_t const v[num_pan_parameters], bool force)
{
bool changed = false;
for (size_t i = 0; i < (_with_bed ? num_pan_parameters : 5); ++i) {
for (size_t i = 0; i < (_with_all_metadata ? num_pan_parameters : 5); ++i) {
if (_current_value[id][i] != v[i]) {
changed = true;
}
@ -745,7 +767,7 @@ SurroundReturn::maybe_send_metadata (size_t id, pframes_t sample, pan_t const v[
lv2_atom_forge_key (&_forge, urids.surr_Snap);
lv2_atom_forge_bool (&_forge, v[4] > 0 ? true : false);
if (_with_bed) {
if (_with_all_metadata) {
lv2_atom_forge_key (&_forge, urids.surr_ElevEn);
lv2_atom_forge_bool (&_forge, v[5] > 0 ? true : false);
lv2_atom_forge_key (&_forge, urids.surr_Ramp);
@ -807,7 +829,7 @@ SurroundReturn::setup_export (std::string const& fn, samplepos_t ss, samplepos_t
bool have_ref = !_export_reference.empty () && Glib::file_test (_export_reference, Glib::FileTest (Glib::FILE_TEST_EXISTS | Glib::FILE_TEST_IS_REGULAR));
float content_start = ss / (float) _session.nominal_sample_rate ();
float content_ffoa = 0;
float content_ffoa = _ffoa;
float content_fps = 30;
switch (_session.config.get_timecode_format()) {