summaryrefslogtreecommitdiff
path: root/libs/ardour/auditioner.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-01-22 23:59:24 +0100
committerRobin Gareus <robin@gareus.org>2014-01-22 23:59:24 +0100
commit8ad30bb76ed9d90ce3f8e4698ec68a425067a3a9 (patch)
tree8620176ecde4daf86414804017edd3644e9cef38 /libs/ardour/auditioner.cc
parentf0b95950eefb7c95e2ae1c8e885faac8ca8aa592 (diff)
configurable midi audition synth
Diffstat (limited to 'libs/ardour/auditioner.cc')
-rw-r--r--libs/ardour/auditioner.cc36
1 files changed, 31 insertions, 5 deletions
diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc
index fd640f8e3e..3e382625a0 100644
--- a/libs/ardour/auditioner.cc
+++ b/libs/ardour/auditioner.cc
@@ -51,6 +51,7 @@ Auditioner::Auditioner (Session& s)
, via_monitor (false)
, _midi_audition (false)
, _synth_added (false)
+ , _synth_changed (false)
, _queue_panic (false)
{
}
@@ -68,6 +69,21 @@ Auditioner::init ()
_output->add_port ("Midiaudition", this, DataType::MIDI);
+ lookup_synth();
+
+ _output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
+ Config->ParameterChanged.connect_same_thread (*this, boost::bind (&Auditioner::config_changed, this, _1));
+
+ return 0;
+}
+
+Auditioner::~Auditioner ()
+{
+}
+
+void
+Auditioner::lookup_synth ()
+{
string plugin_id = Config->get_midi_audition_synth_uri();
boost::shared_ptr<Plugin> p;
if (!plugin_id.empty()) {
@@ -84,14 +100,14 @@ Auditioner::init ()
if (p) {
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, p));
}
-
- _output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
-
- return 0;
}
-Auditioner::~Auditioner ()
+void
+Auditioner::config_changed (std::string p)
{
+ if (p == "midi-audition-synth-uri") {
+ _synth_changed = true;
+ }
}
int
@@ -393,6 +409,16 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
ProcessorStreams ps;
+ if (_synth_changed && _synth_added) {
+ remove_processor(asynth);
+ _synth_added = false;
+ }
+ if (_synth_changed && !_synth_added) {
+ _synth_added = false;
+ lookup_synth();
+ }
+
+
if (!_synth_added && asynth) {
int rv = add_processor_by_index(asynth, PreFader, &ps, true);
if (rv) {