summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-14 20:15:05 +0100
committerDavid Robillard <d@drobilla.net>2020-12-14 22:04:29 +0100
commitd10796d12fd477215fc024078c0f2d83abc6515e (patch)
tree2e317aeca3bbf96adafc83612c1768650d126c9f /src/server
parent337ca8a63882c43b086f5049cc3c03230953a063 (diff)
downloadingen-d10796d12fd477215fc024078c0f2d83abc6515e.tar.gz
ingen-d10796d12fd477215fc024078c0f2d83abc6515e.tar.bz2
ingen-d10796d12fd477215fc024078c0f2d83abc6515e.zip
Avoid "using namespace"
Diffstat (limited to 'src/server')
-rw-r--r--src/server/BlockFactory.cpp25
-rw-r--r--src/server/InternalPlugin.cpp17
-rw-r--r--src/server/ingen_engine.cpp10
-rw-r--r--src/server/ingen_jack.cpp14
-rw-r--r--src/server/ingen_lv2.cpp50
-rw-r--r--src/server/ingen_portaudio.cpp14
6 files changed, 67 insertions, 63 deletions
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"