Auditioner: retain instrument plugin
This allows the Trigger Clip Picker to keep the Plugin GUI available, and retain any custom settings.
This commit is contained in:
parent
35b6ddfb77
commit
a9b484e97e
|
@ -89,7 +89,7 @@ public:
|
||||||
|
|
||||||
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool, MidiNoteTracker&) { return -1; }
|
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool, MidiNoteTracker&) { return -1; }
|
||||||
|
|
||||||
void set_audition_synth_info(PluginInfoPtr in) { audition_synth_info = in; }
|
void set_audition_synth_info(PluginInfoPtr in);
|
||||||
|
|
||||||
samplecnt_t output_latency () const { return 0; }
|
samplecnt_t output_latency () const { return 0; }
|
||||||
|
|
||||||
|
@ -104,6 +104,7 @@ private:
|
||||||
Glib::Threads::Mutex lock;
|
Glib::Threads::Mutex lock;
|
||||||
timecnt_t length;
|
timecnt_t length;
|
||||||
sampleoffset_t _seek_sample;
|
sampleoffset_t _seek_sample;
|
||||||
|
bool _reload_synth;
|
||||||
bool _seeking;
|
bool _seeking;
|
||||||
bool _seek_complete;
|
bool _seek_complete;
|
||||||
bool via_monitor;
|
bool via_monitor;
|
||||||
|
@ -115,7 +116,7 @@ private:
|
||||||
PluginInfoPtr lookup_fallback_synth_plugin_info (std::string const&) const;
|
PluginInfoPtr lookup_fallback_synth_plugin_info (std::string const&) const;
|
||||||
void drop_ports ();
|
void drop_ports ();
|
||||||
void lookup_fallback_synth ();
|
void lookup_fallback_synth ();
|
||||||
void load_synth(bool);
|
bool load_synth();
|
||||||
void unload_synth (bool);
|
void unload_synth (bool);
|
||||||
static void*_drop_ports (void*);
|
static void*_drop_ports (void*);
|
||||||
void actually_drop_ports ();
|
void actually_drop_ports ();
|
||||||
|
|
|
@ -53,6 +53,7 @@ Auditioner::Auditioner (Session& s)
|
||||||
, current_sample (0)
|
, current_sample (0)
|
||||||
, length (0)
|
, length (0)
|
||||||
, _seek_sample (-1)
|
, _seek_sample (-1)
|
||||||
|
, _reload_synth (false)
|
||||||
, _seeking (false)
|
, _seeking (false)
|
||||||
, _seek_complete (false)
|
, _seek_complete (false)
|
||||||
, via_monitor (false)
|
, via_monitor (false)
|
||||||
|
@ -126,23 +127,47 @@ Auditioner::lookup_fallback_synth ()
|
||||||
set_audition_synth_info(nfo);
|
set_audition_synth_info(nfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
bool
|
||||||
Auditioner::load_synth (bool need_lock)
|
Auditioner::load_synth ()
|
||||||
{
|
{
|
||||||
unload_synth(need_lock);
|
|
||||||
|
|
||||||
if (!audition_synth_info) {
|
if (!audition_synth_info) {
|
||||||
lookup_fallback_synth ();
|
lookup_fallback_synth ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!audition_synth_info) {
|
if (!audition_synth_info) {
|
||||||
return;
|
unload_synth (true);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asynth && !_reload_synth) {
|
||||||
|
asynth->deactivate ();
|
||||||
|
asynth->activate ();
|
||||||
|
_queue_panic = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
unload_synth (true);
|
||||||
|
|
||||||
boost::shared_ptr<Plugin> p = audition_synth_info->load (_session);
|
boost::shared_ptr<Plugin> p = audition_synth_info->load (_session);
|
||||||
if (p) {
|
if (p) {
|
||||||
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, time_domain(), p));
|
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, time_domain(), p));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (asynth) {
|
||||||
|
ProcessorStreams ps;
|
||||||
|
if (add_processor (asynth, PreFader, &ps, true)) {
|
||||||
|
error << _("Failed to load synth for MIDI-Audition.") << endmsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||||
|
if (configure_processors (&ps)) {
|
||||||
|
error << _("Cannot setup auditioner processing flow.") << endmsg;
|
||||||
|
unload_synth (true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_reload_synth = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -320,8 +345,8 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
||||||
_disk_reader->audio_playlist()->drop_regions ();
|
_disk_reader->audio_playlist()->drop_regions ();
|
||||||
_disk_reader->audio_playlist()->add_region (the_region, timepos_t (Temporal::AudioTime), 1);
|
_disk_reader->audio_playlist()->add_region (the_region, timepos_t (Temporal::AudioTime), 1);
|
||||||
|
|
||||||
ProcessorStreams ps;
|
|
||||||
{
|
{
|
||||||
|
ProcessorStreams ps;
|
||||||
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
||||||
|
|
||||||
if (configure_processors (&ps)) {
|
if (configure_processors (&ps)) {
|
||||||
|
@ -347,26 +372,8 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
||||||
_disk_reader->midi_playlist()->add_region (midi_region, _import_position, 1);
|
_disk_reader->midi_playlist()->add_region (midi_region, _import_position, 1);
|
||||||
_disk_reader->reset_tracker();
|
_disk_reader->reset_tracker();
|
||||||
|
|
||||||
ProcessorStreams ps;
|
if (!load_synth ()) {
|
||||||
|
return;
|
||||||
load_synth (true);
|
|
||||||
|
|
||||||
if (asynth) {
|
|
||||||
int rv = add_processor (asynth, PreFader, &ps, true);
|
|
||||||
if (rv) {
|
|
||||||
error << _("Failed to load synth for MIDI-Audition.") << endmsg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Glib::Threads::Mutex::Lock lm (AudioEngine::instance()->process_lock ());
|
|
||||||
|
|
||||||
if (configure_processors (&ps)) {
|
|
||||||
error << string_compose (_("Cannot setup auditioner processing flow for %1 channels"),
|
|
||||||
region->sources().size()) << endmsg;
|
|
||||||
unload_synth (true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -421,6 +428,16 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
||||||
g_atomic_int_set (&_auditioning, 1);
|
g_atomic_int_set (&_auditioning, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Auditioner::set_audition_synth_info(PluginInfoPtr in)
|
||||||
|
{
|
||||||
|
if (audition_synth_info == in) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
audition_synth_info = in;
|
||||||
|
_reload_synth = true;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
Auditioner::play_audition (samplecnt_t nframes)
|
Auditioner::play_audition (samplecnt_t nframes)
|
||||||
{
|
{
|
||||||
|
@ -430,7 +447,9 @@ Auditioner::play_audition (samplecnt_t nframes)
|
||||||
|
|
||||||
if (g_atomic_int_get (&_auditioning) == 0) {
|
if (g_atomic_int_get (&_auditioning) == 0) {
|
||||||
silence (nframes);
|
silence (nframes);
|
||||||
unload_synth (false);
|
if (_reload_synth) {
|
||||||
|
unload_synth (false);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,7 +508,9 @@ Auditioner::play_audition (samplecnt_t nframes)
|
||||||
|
|
||||||
if (current_sample >= (length + _import_position).samples()) {
|
if (current_sample >= (length + _import_position).samples()) {
|
||||||
_session.cancel_audition ();
|
_session.cancel_audition ();
|
||||||
unload_synth (false);
|
if (_reload_synth) {
|
||||||
|
unload_synth (false);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
return need_butler ? 1 : 0;
|
return need_butler ? 1 : 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user