mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
Session support to add/remove save/load IOPlugs
This commit is contained in:
parent
74f71c6683
commit
c45a6b80c7
4 changed files with 116 additions and 2 deletions
|
|
@ -143,6 +143,7 @@ class ExportStatus;
|
||||||
class Graph;
|
class Graph;
|
||||||
struct GraphChain;
|
struct GraphChain;
|
||||||
class IO;
|
class IO;
|
||||||
|
class IOPlug;
|
||||||
class IOProcessor;
|
class IOProcessor;
|
||||||
class ImportStatus;
|
class ImportStatus;
|
||||||
class MidiClockTicker;
|
class MidiClockTicker;
|
||||||
|
|
@ -939,6 +940,24 @@ public:
|
||||||
|
|
||||||
PBD::Signal0<void> LuaScriptsChanged;
|
PBD::Signal0<void> LuaScriptsChanged;
|
||||||
|
|
||||||
|
/* I/O Plugin */
|
||||||
|
PBD::Signal0<void> IOPluginsChanged;
|
||||||
|
|
||||||
|
void load_io_plugin (boost::shared_ptr<IOPlug>);
|
||||||
|
bool unload_io_plugin (boost::shared_ptr<IOPlug>);
|
||||||
|
|
||||||
|
boost::shared_ptr<IOPlug> nth_io_plug (uint32_t n) {
|
||||||
|
boost::shared_ptr<IOPlugList> iop (_io_plugins.reader ());
|
||||||
|
if (n < iop->size ()) {
|
||||||
|
return (*iop)[n];
|
||||||
|
}
|
||||||
|
return boost::shared_ptr<IOPlug> ();
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<IOPlugList> io_plugs () const {
|
||||||
|
return _io_plugins.reader ();
|
||||||
|
}
|
||||||
|
|
||||||
/* flattening stuff */
|
/* flattening stuff */
|
||||||
|
|
||||||
boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end,
|
boost::shared_ptr<Region> write_one_track (Track&, samplepos_t start, samplepos_t end,
|
||||||
|
|
@ -1614,6 +1633,8 @@ private:
|
||||||
void setup_lua ();
|
void setup_lua ();
|
||||||
void try_run_lua (pframes_t);
|
void try_run_lua (pframes_t);
|
||||||
|
|
||||||
|
SerializedRCUManager<IOPlugList> _io_plugins;
|
||||||
|
|
||||||
Butler* _butler;
|
Butler* _butler;
|
||||||
|
|
||||||
TransportFSM* _transport_fsm;
|
TransportFSM* _transport_fsm;
|
||||||
|
|
|
||||||
|
|
@ -639,6 +639,9 @@ typedef std::list<boost::shared_ptr<VCA> > VCAList;
|
||||||
class Bundle;
|
class Bundle;
|
||||||
typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
|
typedef std::vector<boost::shared_ptr<Bundle> > BundleList;
|
||||||
|
|
||||||
|
class IOPlug;
|
||||||
|
typedef std::vector<boost::shared_ptr<IOPlug> > IOPlugList;
|
||||||
|
|
||||||
enum RegionEquivalence {
|
enum RegionEquivalence {
|
||||||
Exact,
|
Exact,
|
||||||
Enclosed,
|
Enclosed,
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@
|
||||||
#include "ardour/filename_extensions.h"
|
#include "ardour/filename_extensions.h"
|
||||||
#include "ardour/gain_control.h"
|
#include "ardour/gain_control.h"
|
||||||
#include "ardour/graph.h"
|
#include "ardour/graph.h"
|
||||||
|
#include "ardour/io_plug.h"
|
||||||
#include "ardour/luabindings.h"
|
#include "ardour/luabindings.h"
|
||||||
#include "ardour/midiport_manager.h"
|
#include "ardour/midiport_manager.h"
|
||||||
#include "ardour/scene_changer.h"
|
#include "ardour/scene_changer.h"
|
||||||
|
|
@ -92,6 +93,7 @@
|
||||||
#include "ardour/playlist_factory.h"
|
#include "ardour/playlist_factory.h"
|
||||||
#include "ardour/plugin.h"
|
#include "ardour/plugin.h"
|
||||||
#include "ardour/plugin_insert.h"
|
#include "ardour/plugin_insert.h"
|
||||||
|
#include "ardour/plugin_manager.h"
|
||||||
#include "ardour/polarity_processor.h"
|
#include "ardour/polarity_processor.h"
|
||||||
#include "ardour/presentation_info.h"
|
#include "ardour/presentation_info.h"
|
||||||
#include "ardour/process_thread.h"
|
#include "ardour/process_thread.h"
|
||||||
|
|
@ -246,6 +248,7 @@ Session::Session (AudioEngine &eng,
|
||||||
, _mempool ("Session", 3145728)
|
, _mempool ("Session", 3145728)
|
||||||
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
|
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
|
||||||
, _n_lua_scripts (0)
|
, _n_lua_scripts (0)
|
||||||
|
, _io_plugins (new IOPlugList)
|
||||||
, _butler (new Butler (*this))
|
, _butler (new Butler (*this))
|
||||||
, _transport_fsm (new TransportFSM (*this))
|
, _transport_fsm (new TransportFSM (*this))
|
||||||
, _locations (new Locations (*this))
|
, _locations (new Locations (*this))
|
||||||
|
|
@ -704,6 +707,16 @@ Session::destroy ()
|
||||||
}
|
}
|
||||||
auditioner.reset ();
|
auditioner.reset ();
|
||||||
|
|
||||||
|
/* unregister IO Plugin */
|
||||||
|
{
|
||||||
|
RCUWriter<IOPlugList> writer (_io_plugins);
|
||||||
|
boost::shared_ptr<IOPlugList> iop = writer.get_copy ();
|
||||||
|
for (auto const& i : *iop) {
|
||||||
|
i->DropReferences ();
|
||||||
|
}
|
||||||
|
iop->clear ();
|
||||||
|
}
|
||||||
|
|
||||||
/* drop references to routes held by the monitoring section
|
/* drop references to routes held by the monitoring section
|
||||||
* specifically _monitor_out aux/listen references */
|
* specifically _monitor_out aux/listen references */
|
||||||
remove_monitor_section();
|
remove_monitor_section();
|
||||||
|
|
@ -712,6 +725,7 @@ Session::destroy ()
|
||||||
|
|
||||||
routes.flush ();
|
routes.flush ();
|
||||||
_bundles.flush ();
|
_bundles.flush ();
|
||||||
|
_io_plugins.flush ();
|
||||||
|
|
||||||
DiskReader::free_working_buffers();
|
DiskReader::free_working_buffers();
|
||||||
|
|
||||||
|
|
@ -1350,8 +1364,7 @@ Session::hookup_io ()
|
||||||
delete _bundle_xml_node;
|
delete _bundle_xml_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get everything connected
|
/* Get everything connected */
|
||||||
*/
|
|
||||||
|
|
||||||
AudioEngine::instance()->reconnect_ports ();
|
AudioEngine::instance()->reconnect_ports ();
|
||||||
|
|
||||||
|
|
@ -2122,6 +2135,11 @@ Session::set_block_size (pframes_t nframes)
|
||||||
|
|
||||||
foreach_route (&Route::set_block_size, nframes);
|
foreach_route (&Route::set_block_size, nframes);
|
||||||
|
|
||||||
|
boost::shared_ptr<IOPlugList> iop (_io_plugins.reader ());
|
||||||
|
for (auto const& i : *iop) {
|
||||||
|
i->set_block_size (nframes);
|
||||||
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_block_size -> update worst i/o latency\n");
|
DEBUG_TRACE (DEBUG::LatencyCompensation, "Session::set_block_size -> update worst i/o latency\n");
|
||||||
/* when this is called from the auto-connect thread, the process-lock is held */
|
/* when this is called from the auto-connect thread, the process-lock is held */
|
||||||
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
|
Glib::Threads::Mutex::Lock lx (_update_latency_lock);
|
||||||
|
|
@ -3938,6 +3956,13 @@ Session::io_name_is_legal (const std::string& name) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::shared_ptr<IOPlugList> iop (_io_plugins.reader ());
|
||||||
|
for (auto const& i : *iop) {
|
||||||
|
if (i->io_name () == name) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5033,6 +5058,38 @@ Session::audition_playlist ()
|
||||||
queue_event (ev);
|
queue_event (ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Session::load_io_plugin (boost::shared_ptr<IOPlug> ioplugin)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
RCUWriter<IOPlugList> writer (_io_plugins);
|
||||||
|
boost::shared_ptr<IOPlugList> iop = writer.get_copy ();
|
||||||
|
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||||
|
ioplugin->ensure_io ();
|
||||||
|
iop->push_back (ioplugin);
|
||||||
|
ioplugin->LatencyChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, this, true, false));
|
||||||
|
}
|
||||||
|
IOPluginsChanged (); /* EMIT SIGNAL */
|
||||||
|
set_dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
Session::unload_io_plugin (boost::shared_ptr<IOPlug> ioplugin)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
RCUWriter<IOPlugList> writer (_io_plugins);
|
||||||
|
boost::shared_ptr<IOPlugList> iop = writer.get_copy ();
|
||||||
|
auto i = find (iop->begin (), iop->end (), ioplugin);
|
||||||
|
if (i == iop->end ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
(*i)->drop_references ();
|
||||||
|
iop->erase (i);
|
||||||
|
}
|
||||||
|
IOPluginsChanged (); /* EMIT SIGNAL */
|
||||||
|
set_dirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::register_lua_function (
|
Session::register_lua_function (
|
||||||
|
|
@ -6663,6 +6720,11 @@ Session::set_owned_port_public_latency (bool playback)
|
||||||
}
|
}
|
||||||
_click_io->set_public_port_latencies (_click_io->connected_latency (playback), playback);
|
_click_io->set_public_port_latencies (_click_io->connected_latency (playback), playback);
|
||||||
|
|
||||||
|
boost::shared_ptr<IOPlugList> iop (_io_plugins.reader ());
|
||||||
|
for (auto const& i : *iop) {
|
||||||
|
i->set_public_latency (playback);
|
||||||
|
}
|
||||||
|
|
||||||
if (_midi_ports) {
|
if (_midi_ports) {
|
||||||
_midi_ports->set_public_latency (playback);
|
_midi_ports->set_public_latency (playback);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@
|
||||||
#include "ardour/disk_reader.h"
|
#include "ardour/disk_reader.h"
|
||||||
#include "ardour/filename_extensions.h"
|
#include "ardour/filename_extensions.h"
|
||||||
#include "ardour/graph.h"
|
#include "ardour/graph.h"
|
||||||
|
#include "ardour/io_plug.h"
|
||||||
#include "ardour/location.h"
|
#include "ardour/location.h"
|
||||||
#include "ardour/lv2_plugin.h"
|
#include "ardour/lv2_plugin.h"
|
||||||
#include "ardour/midi_model.h"
|
#include "ardour/midi_model.h"
|
||||||
|
|
@ -1482,6 +1483,15 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool only_used_ass
|
||||||
node->add_child_nocopy (*script_node);
|
node->add_child_nocopy (*script_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
boost::shared_ptr<IOPlugList> iop (_io_plugins.reader ());
|
||||||
|
XMLNode* iop_node = new XMLNode (X_("IOPlugins"));
|
||||||
|
for (auto const& i : *iop) {
|
||||||
|
iop_node->add_child_nocopy (i->get_state());
|
||||||
|
}
|
||||||
|
node->add_child_nocopy (*iop_node);
|
||||||
|
}
|
||||||
|
|
||||||
return *node;
|
return *node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1871,6 +1881,24 @@ Session::set_state (const XMLNode& node, int version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((child = find_named_node (node, "IOPlugins"))) {
|
||||||
|
RCUWriter<IOPlugList> writer (_io_plugins);
|
||||||
|
boost::shared_ptr<IOPlugList> iopl = writer.get_copy ();
|
||||||
|
for (XMLNodeList::const_iterator n = child->children ().begin (); n != child->children ().end (); ++n) {
|
||||||
|
boost::shared_ptr<IOPlug> iop = boost::make_shared<IOPlug>(*this);
|
||||||
|
if (0 == iop->set_state (**n, version)) {
|
||||||
|
iopl->push_back (iop);
|
||||||
|
iop->LatencyChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, this, true, false));
|
||||||
|
} else {
|
||||||
|
/* TODO Unknown I/O Plugin, retain state */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||||
|
for (auto const& i : *iopl) {
|
||||||
|
i->ensure_io ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((child = find_named_node (node, X_("Selection")))) {
|
if ((child = find_named_node (node, X_("Selection")))) {
|
||||||
_selection->set_state (*child, version);
|
_selection->set_state (*child, version);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue