mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 16:46:35 +01:00
Hard-code GMsynth as the fallback, and allow UI to select the audition synth on-the-fly.
This commit is contained in:
parent
5eca084d00
commit
14c69e869f
2 changed files with 32 additions and 31 deletions
|
|
@ -86,7 +86,12 @@ public:
|
||||||
|
|
||||||
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) { return -1; }
|
int export_stuff (BufferSet&, samplepos_t, samplecnt_t, boost::shared_ptr<Processor>, bool, bool, bool) { return -1; }
|
||||||
|
|
||||||
|
void set_audition_synth_info(PluginInfoPtr in) { audition_synth_info = in; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
PluginInfoPtr audition_synth_info; //we will use this to create a new synth on-the-fly each time an audition is requested
|
||||||
|
|
||||||
boost::shared_ptr<AudioRegion> the_region;
|
boost::shared_ptr<AudioRegion> the_region;
|
||||||
boost::shared_ptr<MidiRegion> midi_region;
|
boost::shared_ptr<MidiRegion> midi_region;
|
||||||
samplepos_t current_sample;
|
samplepos_t current_sample;
|
||||||
|
|
@ -102,9 +107,10 @@ private:
|
||||||
|
|
||||||
boost::shared_ptr<Processor> asynth;
|
boost::shared_ptr<Processor> asynth;
|
||||||
|
|
||||||
PluginInfoPtr lookup_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_synth (bool);
|
void lookup_fallback_synth ();
|
||||||
|
void load_synth(bool);
|
||||||
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 ();
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ Auditioner::init ()
|
||||||
_output->add_port ("", this, DataType::MIDI);
|
_output->add_port ("", this, DataType::MIDI);
|
||||||
use_new_playlist (DataType::MIDI);
|
use_new_playlist (DataType::MIDI);
|
||||||
|
|
||||||
lookup_synth (false);
|
if (!audition_synth_info) {
|
||||||
|
lookup_fallback_synth ();
|
||||||
|
}
|
||||||
|
|
||||||
_output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
|
_output->changed.connect_same_thread (*this, boost::bind (&Auditioner::output_changed, this, _1, _2));
|
||||||
|
|
||||||
|
|
@ -83,14 +85,11 @@ Auditioner::init ()
|
||||||
|
|
||||||
Auditioner::~Auditioner ()
|
Auditioner::~Auditioner ()
|
||||||
{
|
{
|
||||||
if (asynth) {
|
unload_synth(true);
|
||||||
asynth->drop_references ();
|
|
||||||
}
|
|
||||||
asynth.reset ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginInfoPtr
|
PluginInfoPtr
|
||||||
Auditioner::lookup_synth_plugin_info (std::string const& uri) const
|
Auditioner::lookup_fallback_synth_plugin_info (std::string const& uri) const
|
||||||
{
|
{
|
||||||
PluginManager& mgr (PluginManager::instance());
|
PluginManager& mgr (PluginManager::instance());
|
||||||
PluginInfoList plugs;
|
PluginInfoList plugs;
|
||||||
|
|
@ -106,45 +105,42 @@ Auditioner::lookup_synth_plugin_info (std::string const& uri) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Auditioner::lookup_synth (bool and_load)
|
Auditioner::lookup_fallback_synth ()
|
||||||
{
|
{
|
||||||
string plugin_id = Config->get_midi_audition_synth_uri();
|
|
||||||
if (plugin_id.empty() && plugin_id != X_("@default@")) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PluginInfoPtr nfo;
|
|
||||||
|
|
||||||
nfo = lookup_synth_plugin_info (plugin_id);
|
PluginInfoPtr nfo = lookup_fallback_synth_plugin_info ("http://gareus.org/oss/lv2/gmsynth");
|
||||||
|
|
||||||
|
//GMsynth not found: fallback to Reasonable Synth
|
||||||
if (!nfo) {
|
if (!nfo) {
|
||||||
nfo = lookup_synth_plugin_info ("http://gareus.org/oss/lv2/gmsynth");
|
nfo = lookup_fallback_synth_plugin_info ("https://community.ardour.org/node/7596");
|
||||||
}
|
|
||||||
if (!nfo) {
|
|
||||||
nfo = lookup_synth_plugin_info ("https://community.ardour.org/node/7596");
|
|
||||||
if (nfo) {
|
if (nfo) {
|
||||||
warning << _("Falling back to Reasonable Synth for Midi Audition") << endmsg;
|
warning << _("Falling back to Reasonable Synth for Midi Audition") << endmsg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nfo) {
|
if (!nfo) {
|
||||||
warning << _("No synth for midi-audition found.") << endmsg;
|
warning << _("No synth for midi-audition found.") << endmsg;
|
||||||
Config->set_midi_audition_synth_uri(""); // Don't check again for Reasonable Synth
|
Config->set_midi_audition_synth_uri(""); // Don't check again for Reasonable Synth
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin_id == X_("@default@")) {
|
set_audition_synth_info(nfo);
|
||||||
Config->set_midi_audition_synth_uri (nfo->unique_id);
|
}
|
||||||
}
|
|
||||||
if (and_load) {
|
void
|
||||||
assert (!asynth);
|
Auditioner::load_synth (bool need_lock)
|
||||||
boost::shared_ptr<Plugin> p = nfo->load (_session);
|
{
|
||||||
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, p));
|
unload_synth(need_lock);
|
||||||
}
|
|
||||||
|
boost::shared_ptr<Plugin> p = audition_synth_info->load (_session);
|
||||||
|
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, p));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Auditioner::unload_synth (bool need_lock)
|
Auditioner::unload_synth (bool need_lock)
|
||||||
{
|
{
|
||||||
if (!asynth) {
|
if (asynth) {
|
||||||
return;
|
asynth->drop_references ();
|
||||||
}
|
}
|
||||||
if (0 == remove_processor (asynth, NULL, need_lock)) {
|
if (0 == remove_processor (asynth, NULL, need_lock)) {
|
||||||
asynth.reset ();
|
asynth.reset ();
|
||||||
|
|
@ -344,8 +340,7 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
||||||
|
|
||||||
ProcessorStreams ps;
|
ProcessorStreams ps;
|
||||||
|
|
||||||
unload_synth (true);
|
load_synth (true);
|
||||||
lookup_synth (true);
|
|
||||||
|
|
||||||
if (asynth) {
|
if (asynth) {
|
||||||
int rv = add_processor (asynth, PreFader, &ps, true);
|
int rv = add_processor (asynth, PreFader, &ps, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue