mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 00:04:56 +01:00
configurable midi audition synth
This commit is contained in:
parent
f0b95950ee
commit
8ad30bb76e
4 changed files with 61 additions and 6 deletions
|
|
@ -35,6 +35,7 @@
|
||||||
#include "ardour/dB.h"
|
#include "ardour/dB.h"
|
||||||
#include "ardour/rc_configuration.h"
|
#include "ardour/rc_configuration.h"
|
||||||
#include "ardour/control_protocol_manager.h"
|
#include "ardour/control_protocol_manager.h"
|
||||||
|
#include "ardour/plugin_manager.h"
|
||||||
#include "control_protocol/control_protocol.h"
|
#include "control_protocol/control_protocol.h"
|
||||||
|
|
||||||
#include "ardour_window.h"
|
#include "ardour_window.h"
|
||||||
|
|
@ -1816,6 +1817,31 @@ RCOptionEditor::RCOptionEditor ()
|
||||||
sigc::mem_fun (*_rc_config, &RCConfiguration::set_sound_midi_notes)
|
sigc::mem_fun (*_rc_config, &RCConfiguration::set_sound_midi_notes)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
add_option (_("MIDI"), new OptionEditorHeading (_("Midi Audition")));
|
||||||
|
|
||||||
|
ComboOption<std::string>* audition_synth = new ComboOption<std::string> (
|
||||||
|
"midi-audition-synth-uri",
|
||||||
|
_("Midi Audition Synth (LV2)"),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::get_midi_audition_synth_uri),
|
||||||
|
sigc::mem_fun (*_rc_config, &RCConfiguration::set_midi_audition_synth_uri)
|
||||||
|
);
|
||||||
|
|
||||||
|
audition_synth->add(X_(""), _("None"));
|
||||||
|
PluginInfoList all_plugs;
|
||||||
|
PluginManager& manager (PluginManager::instance());
|
||||||
|
#ifdef LV2_SUPPORT
|
||||||
|
all_plugs.insert (all_plugs.end(), manager.lv2_plugin_info().begin(), manager.lv2_plugin_info().end());
|
||||||
|
|
||||||
|
for (PluginInfoList::const_iterator i = all_plugs.begin(); i != all_plugs.end(); ++i) {
|
||||||
|
if (manager.get_status (*i) == PluginManager::Hidden) continue;
|
||||||
|
if (!(*i)->is_instrument()) continue;
|
||||||
|
if ((*i)->type != ARDOUR::LV2) continue;
|
||||||
|
audition_synth->add((*i)->unique_id, (*i)->name);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
add_option (_("MIDI"), audition_synth);
|
||||||
|
|
||||||
/* USER INTERACTION */
|
/* USER INTERACTION */
|
||||||
|
|
||||||
if (getenv ("ARDOUR_BUNDLED")) {
|
if (getenv ("ARDOUR_BUNDLED")) {
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ class Auditioner : public Track
|
||||||
bool via_monitor;
|
bool via_monitor;
|
||||||
bool _midi_audition;
|
bool _midi_audition;
|
||||||
bool _synth_added;
|
bool _synth_added;
|
||||||
|
bool _synth_changed;
|
||||||
bool _queue_panic;
|
bool _queue_panic;
|
||||||
|
|
||||||
boost::shared_ptr<Diskstream> _diskstream_audio;
|
boost::shared_ptr<Diskstream> _diskstream_audio;
|
||||||
|
|
@ -130,6 +131,8 @@ class Auditioner : public Track
|
||||||
boost::shared_ptr<Processor> asynth;
|
boost::shared_ptr<Processor> asynth;
|
||||||
|
|
||||||
void drop_ports ();
|
void drop_ports ();
|
||||||
|
void lookup_synth ();
|
||||||
|
void config_changed (std::string);
|
||||||
static void *_drop_ports (void *);
|
static void *_drop_ports (void *);
|
||||||
void actually_drop_ports ();
|
void actually_drop_ports ();
|
||||||
void output_changed (IOChange, void*);
|
void output_changed (IOChange, void*);
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ CONFIG_VARIABLE (std::string, monitor_bus_preferred_bundle, "monitor-bus-preferr
|
||||||
CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true)
|
CONFIG_VARIABLE (bool, quieten_at_speed, "quieten-at-speed", true)
|
||||||
|
|
||||||
CONFIG_VARIABLE (bool, link_send_and_route_panner, "link-send-and-route-panner", true)
|
CONFIG_VARIABLE (bool, link_send_and_route_panner, "link-send-and-route-panner", true)
|
||||||
CONFIG_VARIABLE (std::string, midi_audition_synth_uri, "midi-audition-synth-uri,", "https://community.ardour.org/node/7596")
|
CONFIG_VARIABLE (std::string, midi_audition_synth_uri, "midi-audition-synth-uri", "https://community.ardour.org/node/7596")
|
||||||
|
|
||||||
/* click */
|
/* click */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ Auditioner::Auditioner (Session& s)
|
||||||
, via_monitor (false)
|
, via_monitor (false)
|
||||||
, _midi_audition (false)
|
, _midi_audition (false)
|
||||||
, _synth_added (false)
|
, _synth_added (false)
|
||||||
|
, _synth_changed (false)
|
||||||
, _queue_panic (false)
|
, _queue_panic (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
@ -68,6 +69,21 @@ Auditioner::init ()
|
||||||
|
|
||||||
_output->add_port ("Midiaudition", this, DataType::MIDI);
|
_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();
|
string plugin_id = Config->get_midi_audition_synth_uri();
|
||||||
boost::shared_ptr<Plugin> p;
|
boost::shared_ptr<Plugin> p;
|
||||||
if (!plugin_id.empty()) {
|
if (!plugin_id.empty()) {
|
||||||
|
|
@ -84,14 +100,14 @@ Auditioner::init ()
|
||||||
if (p) {
|
if (p) {
|
||||||
asynth = boost::shared_ptr<Processor> (new PluginInsert (_session, 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
|
int
|
||||||
|
|
@ -393,6 +409,16 @@ Auditioner::audition_region (boost::shared_ptr<Region> region)
|
||||||
|
|
||||||
ProcessorStreams ps;
|
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) {
|
if (!_synth_added && asynth) {
|
||||||
int rv = add_processor_by_index(asynth, PreFader, &ps, true);
|
int rv = add_processor_by_index(asynth, PreFader, &ps, true);
|
||||||
if (rv) {
|
if (rv) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue