-/** @return true if an error occurred, otherwise false */
-bool
-ProcessorBox::choose_lua ()
-{
- LuaScriptInfoPtr spi;
-
- ScriptSelector ss (_("Add Lua DSP Processor"), LuaScriptInfo::DSP);
- switch (ss.run ()) {
- case Gtk::RESPONSE_ACCEPT:
- spi = ss.script();
- break;
- default:
- return true;
- }
- ss.hide ();
-
- PluginPtr p;
- try {
- LuaPluginInfoPtr lpi (new LuaPluginInfo(spi));
- p = (lpi->load (*_session));
- } catch (...) {
- string msg = _(
- "Failed to instantiate Lua DSP Processor,\n"
- "probably because the script is invalid (no dsp function).");
- MessageDialog am (msg);
- am.run ();
- return true;
- }
-
- boost::shared_ptr<Processor> processor (new PluginInsert (*_session, p));
-
- Route::ProcessorStreams err_streams;
- if (_route->add_processor_by_index (processor, _placement, &err_streams, Config->get_new_plugins_active ())) {
- string msg = _(
- "Failed to add Lua DSP Processor at the given position,\n"
- "probably because the I/O configuration of the plugins\n"
- "could not match the configuration of this track.");
- MessageDialog am (msg);
- am.run ();
- }
- return false;
-}
-