mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Add API to configure plugins for non-realtime offline processing
This commit is contained in:
parent
598ff1cb9a
commit
2bb4a9ac4e
5 changed files with 33 additions and 4 deletions
|
|
@ -154,6 +154,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||||
|
|
||||||
void add_slave (std::shared_ptr<Plugin>, bool);
|
void add_slave (std::shared_ptr<Plugin>, bool);
|
||||||
void remove_slave (std::shared_ptr<Plugin>);
|
void remove_slave (std::shared_ptr<Plugin>);
|
||||||
|
void set_non_realtime (bool);
|
||||||
|
|
||||||
bool write_from_ui(uint32_t index,
|
bool write_from_ui(uint32_t index,
|
||||||
uint32_t protocol,
|
uint32_t protocol,
|
||||||
|
|
@ -226,6 +227,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
|
||||||
double _current_bpm;
|
double _current_bpm;
|
||||||
double _prev_time_scale; ///< previous Port::speed_ratio
|
double _prev_time_scale; ///< previous Port::speed_ratio
|
||||||
PBD::ID _insert_id;
|
PBD::ID _insert_id;
|
||||||
|
bool _non_realtime;
|
||||||
std::string _plugin_state_dir;
|
std::string _plugin_state_dir;
|
||||||
uint32_t _bpm_control_port_index;
|
uint32_t _bpm_control_port_index;
|
||||||
uint32_t _patch_port_in_index;
|
uint32_t _patch_port_in_index;
|
||||||
|
|
|
||||||
|
|
@ -191,6 +191,9 @@ public:
|
||||||
void realtime_locate (bool);
|
void realtime_locate (bool);
|
||||||
void monitoring_changed ();
|
void monitoring_changed ();
|
||||||
|
|
||||||
|
/* use plugin for offline processing */
|
||||||
|
virtual void set_non_realtime (bool) {}
|
||||||
|
|
||||||
virtual void add_slave (std::shared_ptr<Plugin>, bool realtime) {}
|
virtual void add_slave (std::shared_ptr<Plugin>, bool realtime) {}
|
||||||
virtual void remove_slave (std::shared_ptr<Plugin>) {}
|
virtual void remove_slave (std::shared_ptr<Plugin>) {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_owner (ARDOUR::SessionObject* o);
|
void set_owner (ARDOUR::SessionObject* o);
|
||||||
|
void set_non_realtime (bool);
|
||||||
|
|
||||||
void enable_io (std::vector<bool> const&, std::vector<bool> const&);
|
void enable_io (std::vector<bool> const&, std::vector<bool> const&);
|
||||||
|
|
||||||
|
|
@ -297,6 +298,7 @@ private:
|
||||||
bool _is_loading_state;
|
bool _is_loading_state;
|
||||||
bool _is_processing;
|
bool _is_processing;
|
||||||
int32_t _block_size;
|
int32_t _block_size;
|
||||||
|
bool _process_offline;
|
||||||
|
|
||||||
/* ports */
|
/* ports */
|
||||||
struct Param {
|
struct Param {
|
||||||
|
|
@ -426,6 +428,7 @@ public:
|
||||||
int set_block_size (pframes_t);
|
int set_block_size (pframes_t);
|
||||||
|
|
||||||
void set_owner (ARDOUR::SessionObject* o);
|
void set_owner (ARDOUR::SessionObject* o);
|
||||||
|
void set_non_realtime (bool);
|
||||||
|
|
||||||
void add_slave (std::shared_ptr<Plugin>, bool);
|
void add_slave (std::shared_ptr<Plugin>, bool);
|
||||||
void remove_slave (std::shared_ptr<Plugin>);
|
void remove_slave (std::shared_ptr<Plugin>);
|
||||||
|
|
|
||||||
|
|
@ -453,6 +453,7 @@ LV2Plugin::LV2Plugin (AudioEngine& engine,
|
||||||
, _worker(NULL)
|
, _worker(NULL)
|
||||||
, _state_worker(NULL)
|
, _state_worker(NULL)
|
||||||
, _insert_id("0")
|
, _insert_id("0")
|
||||||
|
, _non_realtime (false)
|
||||||
, _bpm_control_port_index((uint32_t)-1)
|
, _bpm_control_port_index((uint32_t)-1)
|
||||||
, _patch_port_in_index((uint32_t)-1)
|
, _patch_port_in_index((uint32_t)-1)
|
||||||
, _patch_port_out_index((uint32_t)-1)
|
, _patch_port_out_index((uint32_t)-1)
|
||||||
|
|
@ -472,6 +473,7 @@ LV2Plugin::LV2Plugin (const LV2Plugin& other)
|
||||||
, _worker(NULL)
|
, _worker(NULL)
|
||||||
, _state_worker(NULL)
|
, _state_worker(NULL)
|
||||||
, _insert_id(other._insert_id)
|
, _insert_id(other._insert_id)
|
||||||
|
, _non_realtime (other._non_realtime)
|
||||||
, _bpm_control_port_index((uint32_t)-1)
|
, _bpm_control_port_index((uint32_t)-1)
|
||||||
, _patch_port_in_index((uint32_t)-1)
|
, _patch_port_in_index((uint32_t)-1)
|
||||||
, _patch_port_out_index((uint32_t)-1)
|
, _patch_port_out_index((uint32_t)-1)
|
||||||
|
|
@ -1830,6 +1832,12 @@ LV2Plugin::remove_slave (std::shared_ptr<Plugin> p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LV2Plugin::set_non_realtime (bool yn)
|
||||||
|
{
|
||||||
|
_non_realtime = yn;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LV2Plugin::has_message_output() const
|
LV2Plugin::has_message_output() const
|
||||||
{
|
{
|
||||||
|
|
@ -2790,7 +2798,7 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
|
||||||
TempoMetric metric (tmap->metric_at (timepos_t (start0)));
|
TempoMetric metric (tmap->metric_at (timepos_t (start0)));
|
||||||
|
|
||||||
if (_freewheel_control_port) {
|
if (_freewheel_control_port) {
|
||||||
*_freewheel_control_port = _session.engine().freewheeling() ? 1.f : 0.f;
|
*_freewheel_control_port = _non_realtime || _session.engine().freewheeling() ? 1.f : 0.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_bpm_control_port) {
|
if (_bpm_control_port) {
|
||||||
|
|
@ -3379,7 +3387,7 @@ LV2Plugin::run(pframes_t nframes, bool sync_work)
|
||||||
|
|
||||||
if (_worker) {
|
if (_worker) {
|
||||||
// Execute work synchronously if we're freewheeling (export)
|
// Execute work synchronously if we're freewheeling (export)
|
||||||
_worker->set_synchronous(sync_work || session().engine().freewheeling());
|
_worker->set_synchronous(sync_work || _non_realtime || session().engine().freewheeling());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the plugin for this cycle
|
// Run the plugin for this cycle
|
||||||
|
|
|
||||||
|
|
@ -699,6 +699,12 @@ VST3Plugin::remove_slave (std::shared_ptr<Plugin> p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VST3Plugin::set_non_realtime (bool yn)
|
||||||
|
{
|
||||||
|
_plug->set_non_realtime (yn);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
VST3Plugin::connect_and_run (BufferSet& bufs,
|
VST3Plugin::connect_and_run (BufferSet& bufs,
|
||||||
samplepos_t start, samplepos_t end, double speed,
|
samplepos_t start, samplepos_t end, double speed,
|
||||||
|
|
@ -1166,6 +1172,7 @@ VST3PI::VST3PI (std::shared_ptr<ARDOUR::VST3PluginModule> m, std::string unique_
|
||||||
, _is_loading_state (false)
|
, _is_loading_state (false)
|
||||||
, _is_processing (false)
|
, _is_processing (false)
|
||||||
, _block_size (0)
|
, _block_size (0)
|
||||||
|
, _process_offline (false)
|
||||||
, _port_id_bypass (UINT32_MAX)
|
, _port_id_bypass (UINT32_MAX)
|
||||||
, _owner (0)
|
, _owner (0)
|
||||||
, _add_to_selection (false)
|
, _add_to_selection (false)
|
||||||
|
|
@ -1764,7 +1771,7 @@ VST3PI::update_processor ()
|
||||||
}
|
}
|
||||||
|
|
||||||
Vst::ProcessSetup setup;
|
Vst::ProcessSetup setup;
|
||||||
setup.processMode = AudioEngine::instance ()->freewheeling () ? Vst::kOffline : Vst::kRealtime;
|
setup.processMode = _process_offline || AudioEngine::instance ()->freewheeling () ? Vst::kOffline : Vst::kRealtime;
|
||||||
setup.symbolicSampleSize = Vst::kSample32;
|
setup.symbolicSampleSize = Vst::kSample32;
|
||||||
setup.maxSamplesPerBlock = _block_size;
|
setup.maxSamplesPerBlock = _block_size;
|
||||||
setup.sampleRate = _context.sampleRate;
|
setup.sampleRate = _context.sampleRate;
|
||||||
|
|
@ -1804,6 +1811,12 @@ VST3PI::set_owner (SessionObject* o)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
VST3PI::set_non_realtime (bool yn)
|
||||||
|
{
|
||||||
|
_process_offline = yn;
|
||||||
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
VST3PI::count_channels (Vst::MediaType media, Vst::BusDirection dir, Vst::BusType type)
|
VST3PI::count_channels (Vst::MediaType media, Vst::BusDirection dir, Vst::BusType type)
|
||||||
{
|
{
|
||||||
|
|
@ -2315,7 +2328,7 @@ VST3PI::process (float** ins, float** outs, uint32_t n_samples)
|
||||||
|
|
||||||
Vst::ProcessData data;
|
Vst::ProcessData data;
|
||||||
data.numSamples = n_samples;
|
data.numSamples = n_samples;
|
||||||
data.processMode = AudioEngine::instance ()->freewheeling () ? Vst::kOffline : Vst::kRealtime;
|
data.processMode = _process_offline || AudioEngine::instance ()->freewheeling () ? Vst::kOffline : Vst::kRealtime;
|
||||||
data.symbolicSampleSize = Vst::kSample32;
|
data.symbolicSampleSize = Vst::kSample32;
|
||||||
data.numInputs = _n_bus_in;
|
data.numInputs = _n_bus_in;
|
||||||
data.numOutputs = _n_bus_out;
|
data.numOutputs = _n_bus_out;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue