diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/App.cpp | 26 | ||||
-rw-r--r-- | src/gui/ConnectWindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/GraphBox.cpp | 6 | ||||
-rw-r--r-- | src/gui/GraphCanvas.cpp | 8 | ||||
-rw-r--r-- | src/gui/GraphPortModule.cpp | 10 | ||||
-rw-r--r-- | src/gui/GraphTreeWindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/GraphView.cpp | 2 | ||||
-rw-r--r-- | src/gui/LoadGraphWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/NodeMenu.cpp | 3 | ||||
-rw-r--r-- | src/gui/NodeModule.cpp | 5 | ||||
-rw-r--r-- | src/gui/ObjectMenu.cpp | 5 | ||||
-rw-r--r-- | src/gui/Port.cpp | 8 | ||||
-rw-r--r-- | src/gui/PortMenu.cpp | 4 | ||||
-rw-r--r-- | src/gui/PropertiesWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/RenameWindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/Style.cpp | 2 | ||||
-rw-r--r-- | src/gui/SubgraphModule.cpp | 2 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 4 | ||||
-rw-r--r-- | src/ingen/ingen.cpp | 80 | ||||
-rw-r--r-- | src/server/BlockFactory.cpp | 25 | ||||
-rw-r--r-- | src/server/InternalPlugin.cpp | 17 | ||||
-rw-r--r-- | src/server/ingen_engine.cpp | 10 | ||||
-rw-r--r-- | src/server/ingen_jack.cpp | 14 | ||||
-rw-r--r-- | src/server/ingen_lv2.cpp | 50 | ||||
-rw-r--r-- | src/server/ingen_portaudio.cpp | 14 |
26 files changed, 174 insertions, 144 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp index 55787d44..ecc20455 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -65,8 +65,6 @@ namespace ingen { namespace client { class PluginModel; } -using namespace client; - namespace gui { class Port; @@ -99,11 +97,14 @@ App::App(ingen::World& world) _about_dialog->property_program_name() = "Ingen"; _about_dialog->property_logo_icon_name() = "ingen"; - PluginModel::set_rdf_world(*world.rdf_world()); - PluginModel::set_lilv_world(world.lilv_world()); + client::PluginModel::set_rdf_world(*world.rdf_world()); + client::PluginModel::set_lilv_world(world.lilv_world()); - using namespace std::placeholders; - world.log().set_sink(std::bind(&MessagesWindow::log, _messages_window, _1, _2, _3)); + world.log().set_sink(std::bind(&MessagesWindow::log, + _messages_window, + std::placeholders::_1, + std::placeholders::_2, + std::placeholders::_3)); } App::~App() @@ -171,8 +172,13 @@ App::attach(const std::shared_ptr<ingen::Interface>& client) } _client = client; - _store = std::make_shared<ClientStore>(_world.uris(), _world.log(), sig_client()); + + _store = std::make_shared<client::ClientStore>(_world.uris(), + _world.log(), + sig_client()); + _loader = std::make_shared<ThreadedLoader>(*this, _world.interface()); + if (!_world.store()) { _world.set_store(_store); } @@ -215,14 +221,14 @@ App::request_plugins_if_necessary() } } -std::shared_ptr<SigClientInterface> +std::shared_ptr<client::SigClientInterface> App::sig_client() { auto qi = std::dynamic_pointer_cast<QueuedInterface>(_client); if (qi) { - return std::dynamic_pointer_cast<SigClientInterface>(qi->sink()); + return std::dynamic_pointer_cast<client::SigClientInterface>(qi->sink()); } - return std::dynamic_pointer_cast<SigClientInterface>(_client); + return std::dynamic_pointer_cast<client::SigClientInterface>(_client); } std::shared_ptr<Serialiser> diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index ea6c80d6..bf686308 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -69,8 +69,6 @@ #include <sys/time.h> #include <utility> -using namespace ingen::client; - namespace ingen { namespace gui { @@ -223,7 +221,7 @@ ConnectWindow::connect_remote(const URI& uri) { ingen::World& world = _app->world(); - auto sci = std::make_shared<SigClientInterface>(); + auto sci = std::make_shared<client::SigClientInterface>(); auto qi = std::make_shared<QueuedInterface>(sci); std::shared_ptr<ingen::Interface> iface(world.new_interface(uri, qi)); @@ -513,7 +511,7 @@ ConnectWindow::gtk_callback() if (ms_since_last >= 250) { last = now; if (_mode == Mode::INTERNAL) { - auto client = std::make_shared<SigClientInterface>(); + auto client = std::make_shared<client::SigClientInterface>(); _app->world().interface()->set_respondee(client); _app->attach(client); _app->register_callbacks(); @@ -555,7 +553,7 @@ ConnectWindow::gtk_callback() next_stage(); } else if (_connect_stage == 4) { if (!_app->store()->empty()) { - auto root = std::dynamic_pointer_cast<const GraphModel>( + auto root = std::dynamic_pointer_cast<const client::GraphModel>( _app->store()->object(Raul::Path("/"))); if (root) { set_connected_to(_app->interface()); diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 557c4261..fedde2f9 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -53,7 +53,11 @@ namespace ingen { -using namespace client; +using client::BlockModel; +using client::GraphModel; +using client::ObjectModel; +using client::PluginModel; +using client::PortModel; namespace gui { diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp index 23a3ecf5..a7351483 100644 --- a/src/gui/GraphCanvas.cpp +++ b/src/gui/GraphCanvas.cpp @@ -58,7 +58,11 @@ using std::string; namespace ingen { -using namespace client; +using client::ArcModel; +using client::BlockModel; +using client::GraphModel; +using client::PluginModel; +using client::PortModel; namespace gui { @@ -678,7 +682,7 @@ GraphCanvas::paste() ++_paste_count; // Make a client store to serve as clipboard - ClientStore clipboard(_app.world().uris(), _app.log()); + client::ClientStore clipboard(_app.world().uris(), _app.log()); clipboard.set_plugins(_app.store()->plugins()); clipboard.put(main_uri(), {{uris.rdf_type, Property(uris.ingen_Graph)}}); diff --git a/src/gui/GraphPortModule.cpp b/src/gui/GraphPortModule.cpp index 750a9e5a..3c8c17f1 100644 --- a/src/gui/GraphPortModule.cpp +++ b/src/gui/GraphPortModule.cpp @@ -36,9 +36,6 @@ #include <utility> namespace ingen { - -using namespace client; - namespace gui { GraphPortModule::GraphPortModule( @@ -50,7 +47,8 @@ GraphPortModule::GraphPortModule( { assert(model); - assert(std::dynamic_pointer_cast<const GraphModel>(model->parent())); + assert( + std::dynamic_pointer_cast<const client::GraphModel>(model->parent())); set_stacked(model->polyphonic()); if (model->is_input() && !model->is_numeric()) { @@ -65,8 +63,8 @@ GraphPortModule::GraphPortModule( } GraphPortModule* -GraphPortModule::create(GraphCanvas& canvas, - const std::shared_ptr<const PortModel>& model) +GraphPortModule::create(GraphCanvas& canvas, + const std::shared_ptr<const client::PortModel>& model) { auto* ret = new GraphPortModule(canvas, model); Port* port = Port::create(canvas.app(), *ret, model, true); diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp index 0406184a..0c805b5f 100644 --- a/src/gui/GraphTreeWindow.cpp +++ b/src/gui/GraphTreeWindow.cpp @@ -28,7 +28,8 @@ namespace ingen { -using namespace client; +using client::GraphModel; +using client::ObjectModel; namespace gui { @@ -67,7 +68,7 @@ GraphTreeWindow::GraphTreeWindow(BaseObjectType* cobject, } void -GraphTreeWindow::init(App& app, ClientStore& store) +GraphTreeWindow::init(App& app, client::ClientStore& store) { init_window(app); store.signal_new_object().connect( diff --git a/src/gui/GraphView.cpp b/src/gui/GraphView.cpp index 88b3d6fe..5f81a309 100644 --- a/src/gui/GraphView.cpp +++ b/src/gui/GraphView.cpp @@ -31,7 +31,7 @@ namespace ingen { -using namespace client; +using client::GraphModel; namespace gui { diff --git a/src/gui/LoadGraphWindow.cpp b/src/gui/LoadGraphWindow.cpp index 5b8bf84f..0a238c98 100644 --- a/src/gui/LoadGraphWindow.cpp +++ b/src/gui/LoadGraphWindow.cpp @@ -39,7 +39,7 @@ namespace ingen { -using namespace client; +using client::GraphModel; namespace gui { diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index 134cde1b..04f0bd38 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -35,7 +35,9 @@ using std::string; namespace ingen { -using namespace client; +using client::ClientStore; +using client::GraphModel; +using client::PluginModel; namespace gui { diff --git a/src/gui/NodeMenu.cpp b/src/gui/NodeMenu.cpp index 6c9cf5ce..06a65834 100644 --- a/src/gui/NodeMenu.cpp +++ b/src/gui/NodeMenu.cpp @@ -40,9 +40,6 @@ #include <utility> namespace ingen { - -using namespace client; - namespace gui { NodeMenu::NodeMenu(BaseObjectType* cobject, diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp index ab197525..4eff5210 100644 --- a/src/gui/NodeModule.cpp +++ b/src/gui/NodeModule.cpp @@ -46,7 +46,10 @@ namespace ingen { -using namespace client; +using client::BlockModel; +using client::GraphModel; +using client::PluginModel; +using client::PortModel; namespace gui { diff --git a/src/gui/ObjectMenu.cpp b/src/gui/ObjectMenu.cpp index 52fec864..91185cee 100644 --- a/src/gui/ObjectMenu.cpp +++ b/src/gui/ObjectMenu.cpp @@ -28,9 +28,6 @@ #include <memory> namespace ingen { - -using namespace client; - namespace gui { ObjectMenu::ObjectMenu(BaseObjectType* cobject, @@ -55,7 +52,7 @@ ObjectMenu::ObjectMenu(BaseObjectType* cobject, } void -ObjectMenu::init(App& app, std::shared_ptr<const ObjectModel> object) +ObjectMenu::init(App& app, std::shared_ptr<const client::ObjectModel> object) { _app = &app; _object = object; diff --git a/src/gui/Port.cpp b/src/gui/Port.cpp index a1c43aa5..b82fa8d1 100644 --- a/src/gui/Port.cpp +++ b/src/gui/Port.cpp @@ -38,9 +38,13 @@ #include <memory> #include <string> -using namespace ingen::client; - namespace ingen { + +using client::BlockModel; +using client::GraphModel; +using client::PluginModel; +using client::PortModel; + namespace gui { Port* diff --git a/src/gui/PortMenu.cpp b/src/gui/PortMenu.cpp index c8b9807e..33e106af 100644 --- a/src/gui/PortMenu.cpp +++ b/src/gui/PortMenu.cpp @@ -28,7 +28,9 @@ namespace ingen { -using namespace client; +using client::BlockModel; +using client::GraphModel; +using client::PortModel; namespace gui { diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp index ef832c5b..36d0cefa 100644 --- a/src/gui/PropertiesWindow.cpp +++ b/src/gui/PropertiesWindow.cpp @@ -39,7 +39,7 @@ namespace ingen { -using namespace client; +using client::ObjectModel; namespace gui { diff --git a/src/gui/RenameWindow.cpp b/src/gui/RenameWindow.cpp index b8bd89b8..dbda594c 100644 --- a/src/gui/RenameWindow.cpp +++ b/src/gui/RenameWindow.cpp @@ -29,7 +29,7 @@ namespace ingen { -using namespace client; +using client::ObjectModel; namespace gui { diff --git a/src/gui/Style.cpp b/src/gui/Style.cpp index 81c9da2f..e91f6c4b 100644 --- a/src/gui/Style.cpp +++ b/src/gui/Style.cpp @@ -34,8 +34,6 @@ namespace ingen { namespace gui { -using namespace ingen::client; - Style::Style(App& app) // Colours from the Tango palette with modified V : _app(app) diff --git a/src/gui/SubgraphModule.cpp b/src/gui/SubgraphModule.cpp index 828dbb20..e4f3d2df 100644 --- a/src/gui/SubgraphModule.cpp +++ b/src/gui/SubgraphModule.cpp @@ -32,7 +32,7 @@ namespace ingen { -using namespace client; +using client::GraphModel; namespace gui { diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index 0f2cb16f..9a21cce3 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -36,7 +36,9 @@ namespace ingen { -using namespace client; +using client::BlockModel; +using client::GraphModel; +using client::ObjectModel; namespace gui { diff --git a/src/ingen/ingen.cpp b/src/ingen/ingen.cpp index 29aad4ce..74fbe73d 100644 --- a/src/ingen/ingen.cpp +++ b/src/ingen/ingen.cpp @@ -45,8 +45,8 @@ #include <string> #include <thread> -using namespace std; -using namespace ingen; +namespace ingen { +namespace { class DummyInterface : public Interface { @@ -54,65 +54,62 @@ class DummyInterface : public Interface void message(const Message& msg) override {} }; -static unique_ptr<World> world; +std::unique_ptr<World> world; -static void +void ingen_interrupt(int signal) { if (signal == SIGTERM) { - cerr << "ingen: Terminated" << endl; + std::cerr << "ingen: Terminated\n"; exit(EXIT_FAILURE); } else { - cout << "ingen: Interrupted" << endl; + std::cout << "ingen: Interrupted\n"; if (world && world->engine()) { world->engine()->quit(); } } } -static void +void ingen_try(bool cond, const char* msg) { if (!cond) { - cerr << "ingen: error: " << msg << endl; + std::cerr << "ingen: error: " << msg << "\n"; exit(EXIT_FAILURE); } } -static int +int print_version() { - cout << "ingen " << INGEN_VERSION - << " <http://drobilla.net/software/ingen>\n" - << "Copyright 2007-2017 David Robillard <http://drobilla.net>.\n" - << "License: <https://www.gnu.org/licenses/agpl-3.0>\n" - << "This is free software; you are free to change and redistribute it.\n" - << "There is NO WARRANTY, to the extent permitted by law." << endl; + std::cout << "ingen " << INGEN_VERSION + << " <http://drobilla.net/software/ingen>\n" + << "Copyright 2007-2020 David Robillard <http://drobilla.net>.\n" + << "License: <https://www.gnu.org/licenses/agpl-3.0>\n" + << "This is free software; you are free to change and redistribute it.\n" + << "There is NO WARRANTY, to the extent permitted by law.\n"; return EXIT_SUCCESS; } int -main(int argc, char** argv) +run(int argc, char** argv) { - ingen::set_bundle_path_from_code( - reinterpret_cast<void (*)()>(&print_version)); - // Create world try { - world = unique_ptr<ingen::World>( + world = std::unique_ptr<ingen::World>( new ingen::World(nullptr, nullptr, nullptr)); world->load_configuration(argc, argv); if (argc <= 1) { - world->conf().print_usage("ingen", cout); + world->conf().print_usage("ingen", std::cout); return EXIT_FAILURE; } else if (world->conf().option("help").get<int32_t>()) { - world->conf().print_usage("ingen", cout); + world->conf().print_usage("ingen", std::cout); return EXIT_SUCCESS; } else if (world->conf().option("version").get<int32_t>()) { return print_version(); } } catch (std::exception& e) { - cout << "ingen: error: " << e.what() << endl; + std::cout << "ingen: error: " << e.what() << "\n"; return EXIT_FAILURE; } @@ -124,7 +121,7 @@ main(int argc, char** argv) // Run engine if (conf.option("engine").get<int32_t>()) { if (world->conf().option("threads").get<int32_t>() < 1) { - cerr << "ingen: error: threads must be > 0" << endl; + std::cerr << "ingen: error: threads must be > 0\n"; return EXIT_FAILURE; } @@ -154,7 +151,7 @@ main(int argc, char** argv) engine_interface = world->new_interface(URI(uri), dummy_client); if (!engine_interface && !conf.option("gui").get<int32_t>()) { - cerr << fmt("ingen: error: Failed to connect to `%1%'\n", uri); + std::cerr << fmt("ingen: error: Failed to connect to `%1%'\n", uri); return EXIT_FAILURE; } @@ -164,13 +161,13 @@ main(int argc, char** argv) // Activate the engine, if we have one if (world->engine()) { if (!world->load_module("jack") && !world->load_module("portaudio")) { - cerr << "ingen: error: Failed to load driver module" << endl; + std::cerr << "ingen: error: Failed to load driver module\n"; return EXIT_FAILURE; } if (!world->engine()->supports_dynamic_ports() && !conf.option("load").is_valid()) { - cerr << "ingen: error: Initial graph required for driver" << endl; + std::cerr << "ingen: error: Initial graph required for driver\n"; return EXIT_FAILURE; } } @@ -189,13 +186,14 @@ main(int argc, char** argv) symbol = Raul::Symbol(p.symbol()); } } else { - cerr << "Invalid path given: '" << path_option.ptr<char>() << endl; + std::cerr << "Invalid path given: '" << path_option.ptr<char>() + << "\n"; } } ingen_try(bool(world->parser()), "Failed to create parser"); - const string graph = conf.option("load").ptr<char>(); + const std::string graph = conf.option("load").ptr<char>(); engine_interface->get(URI("ingen:/plugins")); engine_interface->get(main_uri()); @@ -206,13 +204,13 @@ main(int argc, char** argv) } else if (conf.option("server-load").is_valid()) { const char* path = conf.option("server-load").ptr<char>(); if (serd_uri_string_has_scheme(reinterpret_cast<const uint8_t*>(path))) { - std::cout << "Loading " << path << " (server side)" << std::endl; + std::cout << "Loading " << path << " (server side)" << "\n"; engine_interface->copy(URI(path), main_uri()); } else { SerdNode uri = serd_node_new_file_uri( reinterpret_cast<const uint8_t*>(path), nullptr, nullptr, true); std::cout << "Loading " << reinterpret_cast<const char*>(uri.buf) - << " (server side)" << std::endl; + << " (server side)\n"; engine_interface->copy(URI(reinterpret_cast<const char*>(uri.buf)), main_uri()); serd_node_free(&uri); @@ -223,13 +221,13 @@ main(int argc, char** argv) if (conf.option("save").is_valid()) { const char* path = conf.option("save").ptr<char>(); if (serd_uri_string_has_scheme(reinterpret_cast<const uint8_t*>(path))) { - std::cout << "Saving to " << path << std::endl; + std::cout << "Saving to " << path << "\n"; engine_interface->copy(main_uri(), URI(path)); } else { SerdNode uri = serd_node_new_file_uri( reinterpret_cast<const uint8_t*>(path), nullptr, nullptr, true); std::cout << "Saving to " << reinterpret_cast<const char*>(uri.buf) - << std::endl; + << "\n"; engine_interface->copy(main_uri(), URI(reinterpret_cast<const char*>(uri.buf))); serd_node_free(&uri); } @@ -250,12 +248,12 @@ main(int argc, char** argv) } else if (world->engine()) { // Run engine main loop until interrupt while (world->engine()->main_iteration()) { - this_thread::sleep_for(chrono::milliseconds(125)); + std::this_thread::sleep_for(std::chrono::milliseconds(125)); } } // Sleep for a half second to allow event queues to drain - this_thread::sleep_for(chrono::milliseconds(500)); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Shut down if (world->engine()) { @@ -271,3 +269,15 @@ main(int argc, char** argv) return 0; } + +} // namespace +} // namespace ingen + +int +main(int argc, char** argv) +{ + ingen::set_bundle_path_from_code( + reinterpret_cast<void (*)()>(&ingen::run)); + + return ingen::run(argc, argv); +} diff --git a/src/server/BlockFactory.cpp b/src/server/BlockFactory.cpp index bcb26971..14a50098 100644 --- a/src/server/BlockFactory.cpp +++ b/src/server/BlockFactory.cpp @@ -41,8 +41,6 @@ namespace ingen { namespace server { -using namespace internals; - BlockFactory::BlockFactory(ingen::World& world) : _world(world) , _has_loaded(false) @@ -107,20 +105,23 @@ void BlockFactory::load_internal_plugins() { ingen::URIs& uris = _world.uris(); - InternalPlugin* block_delay_plug = BlockDelayNode::internal_plugin(uris); - _plugins.emplace(block_delay_plug->uri(), block_delay_plug); - InternalPlugin* controller_plug = ControllerNode::internal_plugin(uris); - _plugins.emplace(controller_plug->uri(), controller_plug); + InternalPlugin* block_delay = + internals::BlockDelayNode::internal_plugin(uris); + _plugins.emplace(block_delay->uri(), block_delay); + + InternalPlugin* controller = + internals::ControllerNode::internal_plugin(uris); + _plugins.emplace(controller->uri(), controller); - InternalPlugin* note_plug = NoteNode::internal_plugin(uris); - _plugins.emplace(note_plug->uri(), note_plug); + InternalPlugin* note = internals::NoteNode::internal_plugin(uris); + _plugins.emplace(note->uri(), note); - InternalPlugin* time_plug = TimeNode::internal_plugin(uris); - _plugins.emplace(time_plug->uri(), time_plug); + InternalPlugin* time = internals::TimeNode::internal_plugin(uris); + _plugins.emplace(time->uri(), time); - InternalPlugin* trigger_plug = TriggerNode::internal_plugin(uris); - _plugins.emplace(trigger_plug->uri(), trigger_plug); + InternalPlugin* trigger = internals::TriggerNode::internal_plugin(uris); + _plugins.emplace(trigger->uri(), trigger); } void diff --git a/src/server/InternalPlugin.cpp b/src/server/InternalPlugin.cpp index 47129c99..384ece0f 100644 --- a/src/server/InternalPlugin.cpp +++ b/src/server/InternalPlugin.cpp @@ -29,8 +29,6 @@ namespace ingen { namespace server { -using namespace internals; - InternalPlugin::InternalPlugin(URIs& uris, const URI& uri, const Raul::Symbol& symbol) @@ -51,15 +49,20 @@ InternalPlugin::instantiate(BufferFactory& bufs, const SampleCount srate = engine.sample_rate(); if (uri() == NS_INTERNALS "BlockDelay") { - return new BlockDelayNode(this, bufs, symbol, polyphonic, parent, srate); + return new internals::BlockDelayNode( + this, bufs, symbol, polyphonic, parent, srate); } else if (uri() == NS_INTERNALS "Controller") { - return new ControllerNode(this, bufs, symbol, polyphonic, parent, srate); + return new internals::ControllerNode( + this, bufs, symbol, polyphonic, parent, srate); } else if (uri() == NS_INTERNALS "Note") { - return new NoteNode(this, bufs, symbol, polyphonic, parent, srate); + return new internals::NoteNode( + this, bufs, symbol, polyphonic, parent, srate); } else if (uri() == NS_INTERNALS "Time") { - return new TimeNode(this, bufs, symbol, polyphonic, parent, srate); + return new internals::TimeNode( + this, bufs, symbol, polyphonic, parent, srate); } else if (uri() == NS_INTERNALS "Trigger") { - return new TriggerNode(this, bufs, symbol, polyphonic, parent, srate); + return new internals::TriggerNode( + this, bufs, symbol, polyphonic, parent, srate); } else { return nullptr; } diff --git a/src/server/ingen_engine.cpp b/src/server/ingen_engine.cpp index 8f709967..dbcc2597 100644 --- a/src/server/ingen_engine.cpp +++ b/src/server/ingen_engine.cpp @@ -22,10 +22,10 @@ #include <memory> -using namespace ingen; +namespace ingen { -struct IngenEngineModule : public ingen::Module { - void load(ingen::World& world) override { +struct EngineModule : public Module { + void load(World& world) override { server::set_denormal_flags(world.log()); auto engine = std::make_shared<server::Engine>(world); world.set_engine(engine); @@ -35,12 +35,14 @@ struct IngenEngineModule : public ingen::Module { } }; +} // namespace ingen + extern "C" { ingen::Module* ingen_module_load() { - return new IngenEngineModule(); + return new ingen::EngineModule(); } } // extern "C" diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp index 4ea2d179..ebdb96ae 100644 --- a/src/server/ingen_jack.cpp +++ b/src/server/ingen_jack.cpp @@ -27,16 +27,13 @@ #include <memory> #include <string> -using namespace ingen; - namespace ingen { namespace server { + class Driver; -} // namespace server -} // namespace ingen -struct IngenJackModule : public ingen::Module { - void load(ingen::World& world) override { +struct JackModule : public Module { + void load(World& world) override { server::Engine* const engine = static_cast<server::Engine*>(world.engine().get()); @@ -57,12 +54,15 @@ struct IngenJackModule : public ingen::Module { } }; +} // namespace server +} // namespace ingen + extern "C" { ingen::Module* ingen_module_load() { - return new IngenJackModule(); + return new ingen::server::JackModule(); } } // extern "C" diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp index d1fb293e..faff3a1c 100644 --- a/src/server/ingen_lv2.cpp +++ b/src/server/ingen_lv2.cpp @@ -75,6 +75,9 @@ #include <vector> namespace ingen { +namespace server { + +class LV2Driver; /** Record of a graph in this bundle. */ struct LV2Graph : public Parser::ResourceRecord { @@ -93,12 +96,6 @@ public: Graphs graphs; }; -namespace server { - -class LV2Driver; - -void signal_main(RunContext& ctx, LV2Driver* driver); - inline size_t ui_ring_size(SampleCount block_length) { @@ -106,8 +103,7 @@ ui_ring_size(SampleCount block_length) static_cast<size_t>(block_length) * 16u); } -class LV2Driver : public ingen::server::Driver - , public ingen::AtomSink +class LV2Driver : public Driver, public ingen::AtomSink { public: LV2Driver(Engine& engine, @@ -425,14 +421,17 @@ private: bool _instantiated; }; -} // namespace server -} // namespace ingen +struct IngenPlugin { + std::unique_ptr<World> world; + std::shared_ptr<Engine> engine; + std::unique_ptr<std::thread> main; + LV2_URID_Map* map = nullptr; + int argc = 0; + char** argv = nullptr; +}; extern "C" { -using namespace ingen; -using namespace ingen::server; - static void ingen_lv2_main(const std::shared_ptr<Engine>& engine, const std::shared_ptr<LV2Driver>& driver) @@ -451,15 +450,6 @@ ingen_lv2_main(const std::shared_ptr<Engine>& engine, } } -struct IngenPlugin { - std::unique_ptr<ingen::World> world; - std::shared_ptr<Engine> engine; - std::unique_ptr<std::thread> main; - LV2_URID_Map* map = nullptr; - int argc = 0; - char** argv = nullptr; -}; - static Lib::Graphs find_graphs(const URI& manifest_uri) { @@ -623,8 +613,6 @@ ingen_instantiate(const LV2_Descriptor* descriptor, static void ingen_connect_port(LV2_Handle instance, uint32_t port, void* data) { - using namespace ingen::server; - auto* me = static_cast<IngenPlugin*>(instance); server::Engine* engine = static_cast<server::Engine*>(me->world->engine().get()); const auto driver = std::static_pointer_cast<LV2Driver>(engine->driver()); @@ -858,6 +846,12 @@ lib_get_plugin(LV2_Lib_Handle handle, uint32_t index) return index < lib->graphs.size() ? &lib->graphs[index]->descriptor : nullptr; } +} // extern "C" +} // namespace server +} // namespace ingen + +extern "C" { + /** LV2 plugin library entry point */ LV2_SYMBOL_EXPORT const LV2_Lib_Descriptor* @@ -865,16 +859,16 @@ lv2_lib_descriptor(const char* bundle_path, const LV2_Feature*const* features) { static const uint32_t desc_size = sizeof(LV2_Lib_Descriptor); - Lib* lib = new Lib(bundle_path); + auto* lib = new ingen::server::Lib(bundle_path); // FIXME: memory leak. I think the LV2_Lib_Descriptor API is botched :( auto* desc = static_cast<LV2_Lib_Descriptor*>(malloc(desc_size)); desc->handle = lib; desc->size = desc_size; - desc->cleanup = lib_cleanup; - desc->get_plugin = lib_get_plugin; + desc->cleanup = ingen::server::lib_cleanup; + desc->get_plugin = ingen::server::lib_get_plugin; return desc; } -} // extern "C" +} diff --git a/src/server/ingen_portaudio.cpp b/src/server/ingen_portaudio.cpp index 93180eba..d27d26c3 100644 --- a/src/server/ingen_portaudio.cpp +++ b/src/server/ingen_portaudio.cpp @@ -23,12 +23,13 @@ #include <memory> -namespace ingen { namespace server { class Driver; } } +namespace ingen { +namespace server { -using namespace ingen; +class Driver; -struct IngenPortAudioModule : public ingen::Module { - void load(ingen::World& world) override { +struct PortAudioModule : public Module { + void load(World& world) override { server::Engine* const engine = static_cast<server::Engine*>(world.engine().get()); @@ -43,12 +44,15 @@ struct IngenPortAudioModule : public ingen::Module { } }; +} // namespace server +} // namespace ingen + extern "C" { ingen::Module* ingen_module_load() { - return new IngenPortAudioModule(); + return new ingen::server::PortAudioModule(); } } // extern "C" |