diff options
Diffstat (limited to 'src/libs')
28 files changed, 100 insertions, 83 deletions
diff --git a/src/libs/client/ClientStore.hpp b/src/libs/client/ClientStore.hpp index 954dcc04..f08fcd9b 100644 --- a/src/libs/client/ClientStore.hpp +++ b/src/libs/client/ClientStore.hpp @@ -15,8 +15,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef STORE_H -#define STORE_H +#ifndef CLIENT_STORE_HPP +#define CLIENT_STORE_HPP #include <cassert> #include <string> @@ -148,4 +148,4 @@ private: } // namespace Client } // namespace Ingen -#endif // STORE_H +#endif // CLIENT_STORE_HPP diff --git a/src/libs/engine/InternalPlugin.cpp b/src/libs/engine/InternalPlugin.cpp index 9141b545..1c6a92a5 100644 --- a/src/libs/engine/InternalPlugin.cpp +++ b/src/libs/engine/InternalPlugin.cpp @@ -21,33 +21,22 @@ #include "MidiTriggerNode.hpp" #include "MidiControlNode.hpp" #include "TransportNode.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" namespace Ingen { -#if 0 -InternalPlugin::InternalPlugin(const InternalPlugin* const copy) -{ - _type = copy->_type; - _uri = copy->_uri; - _lib_path = copy->_lib_path; - _lib_name = copy->_lib_name; - _plug_label = copy->_plug_label; - _name = copy->_name; - _id = _id; - _module = copy->_module; -} -#endif - - NodeImpl* InternalPlugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { assert(_type == Internal); + + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); if (_uri == NS_INGEN "note_node") { return new MidiNoteNode(name, polyphonic, parent, srate, buffer_size); diff --git a/src/libs/engine/InternalPlugin.hpp b/src/libs/engine/InternalPlugin.hpp index 02ca3e59..c04c9015 100644 --- a/src/libs/engine/InternalPlugin.hpp +++ b/src/libs/engine/InternalPlugin.hpp @@ -54,13 +54,10 @@ public: , _name(name) {} - //InternalPlugin(const InternalPlugin* const copy); - NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const string symbol() const { return _symbol; } const string name() const { return _name; } diff --git a/src/libs/engine/LADSPAPlugin.cpp b/src/libs/engine/LADSPAPlugin.cpp index a43baa9a..4a0b5c14 100644 --- a/src/libs/engine/LADSPAPlugin.cpp +++ b/src/libs/engine/LADSPAPlugin.cpp @@ -21,6 +21,8 @@ #include "LADSPAPlugin.hpp" #include "LADSPANode.hpp" #include "NodeImpl.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" using namespace std; @@ -31,11 +33,13 @@ NodeImpl* LADSPAPlugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { assert(_id != 0); + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); + LADSPA_Descriptor_Function df = NULL; LADSPANode* n = NULL; diff --git a/src/libs/engine/LADSPAPlugin.hpp b/src/libs/engine/LADSPAPlugin.hpp index 59a6972b..2414be7c 100644 --- a/src/libs/engine/LADSPAPlugin.hpp +++ b/src/libs/engine/LADSPAPlugin.hpp @@ -54,8 +54,7 @@ public: NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const std::string& label() const { return _label; } unsigned long id() const { return _id; } diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index 974c5858..cfc9be78 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -129,8 +129,7 @@ LV2Node::instantiate() uint32_t num_ports = slv2_plugin_get_num_ports(plug); assert(num_ports > 0); - _ports = new Raul::Array<PortImpl*>(num_ports, NULL); - + _ports = new Raul::Array<PortImpl*>(num_ports, NULL); _instances = new Raul::Array<SLV2Instance>(_polyphony, NULL); uint32_t port_buffer_size = 0; diff --git a/src/libs/engine/LV2Plugin.cpp b/src/libs/engine/LV2Plugin.cpp index 09d48a10..90a3a6b8 100644 --- a/src/libs/engine/LV2Plugin.cpp +++ b/src/libs/engine/LV2Plugin.cpp @@ -16,9 +16,13 @@ */ #include <cassert> +#include <glibmm.h> +#include <redlandmm/World.hpp> #include "LV2Plugin.hpp" #include "LV2Node.hpp" #include "NodeImpl.hpp" +#include "Engine.hpp" +#include "AudioDriver.hpp" namespace Ingen { @@ -58,11 +62,14 @@ NodeImpl* LV2Plugin::instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { + SampleCount srate = engine.audio_driver()->sample_rate(); + SampleCount buffer_size = engine.audio_driver()->buffer_size(); + load(); // FIXME: unload at some point + Glib::Mutex::Lock lock(engine.world()->rdf_world->mutex()); LV2Node* n = new LV2Node(this, name, polyphonic, parent, srate, buffer_size); if ( ! n->instantiate() ) { diff --git a/src/libs/engine/LV2Plugin.hpp b/src/libs/engine/LV2Plugin.hpp index 827e7e89..c1f8671d 100644 --- a/src/libs/engine/LV2Plugin.hpp +++ b/src/libs/engine/LV2Plugin.hpp @@ -61,8 +61,7 @@ public: NodeImpl* instantiate(const string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size); + Engine& engine); const string symbol() const; const string name() const; diff --git a/src/libs/engine/PatchPlugin.hpp b/src/libs/engine/PatchPlugin.hpp index 24a2679a..a7334392 100644 --- a/src/libs/engine/PatchPlugin.hpp +++ b/src/libs/engine/PatchPlugin.hpp @@ -44,8 +44,7 @@ public: NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) + Engine& engine) { return NULL; } diff --git a/src/libs/engine/PluginImpl.hpp b/src/libs/engine/PluginImpl.hpp index 9ad16ee3..0301d942 100644 --- a/src/libs/engine/PluginImpl.hpp +++ b/src/libs/engine/PluginImpl.hpp @@ -36,6 +36,7 @@ namespace Ingen { class PatchImpl; class NodeImpl; +class Engine; /** Implementation of a plugin (internal code, or a loaded shared library). @@ -55,8 +56,7 @@ public: virtual NodeImpl* instantiate(const std::string& name, bool polyphonic, Ingen::PatchImpl* parent, - SampleRate srate, - size_t buffer_size) = 0; + Engine& engine) = 0; virtual const string symbol() const = 0; virtual const string name() const = 0; diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index a3681597..b58bc2c3 100644 --- a/src/libs/engine/events/CreateNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -87,8 +87,7 @@ CreateNodeEvent::pre_process() if (_patch && plugin) { - _node = plugin->instantiate(_path.name(), _polyphonic, _patch, - _engine.audio_driver()->sample_rate(), _engine.audio_driver()->buffer_size()); + _node = plugin->instantiate(_path.name(), _polyphonic, _patch, _engine); if (_node != NULL) { _node->activate(); diff --git a/src/libs/gui/App.hpp b/src/libs/gui/App.hpp index 08ceb271..4a4b6580 100644 --- a/src/libs/gui/App.hpp +++ b/src/libs/gui/App.hpp @@ -15,23 +15,20 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef APP_H -#define APP_H +#ifndef INGEN_APP_HPP +#define INGEN_APP_HPP #include <cassert> #include <string> #include <map> -#include <list> +#include <utility> #include <iostream> #include <libgnomecanvasmm.h> #include <gtkmm.h> #include <libglademm.h> #include <raul/SharedPtr.hpp> -#include <redlandmm/World.hpp> +#include <raul/Deletable.hpp> #include <module/World.hpp> -#include <shared/Store.hpp> - -using namespace std; namespace Ingen { class Engine; @@ -51,10 +48,6 @@ namespace Ingen { } } -using namespace Ingen::Shared; -using namespace Ingen::Serialisation; -using namespace Ingen::Client; - /** \defgroup GUI GTK GUI */ @@ -84,10 +77,10 @@ class App public: ~App(); - void error_message(const string& msg); + void error_message(const std::string& msg); - void attach(SharedPtr<SigClientInterface> client, - SharedPtr<Raul::Deletable> handle=SharedPtr<Raul::Deletable>()); + void attach(SharedPtr<Client::SigClientInterface> client, + SharedPtr<Raul::Deletable> handle=SharedPtr<Raul::Deletable>()); void detach(); @@ -110,14 +103,14 @@ public: Configuration* configuration() const { return _configuration; } WindowFactory* window_factory() const { return _window_factory; } - Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const string& path, int size); + Glib::RefPtr<Gdk::Pixbuf> icon_from_path(const std::string& path, int size); - const SharedPtr<EngineInterface>& engine() const { return _world->engine; } - const SharedPtr<SigClientInterface>& client() const { return _client; } - const SharedPtr<ClientStore>& store() const { return _store; } - const SharedPtr<ThreadedLoader>& loader() const { return _loader; } + const SharedPtr<Shared::EngineInterface>& engine() const { return _world->engine; } + const SharedPtr<Client::SigClientInterface>& client() const { return _client; } + const SharedPtr<Client::ClientStore>& store() const { return _store; } + const SharedPtr<ThreadedLoader>& loader() const { return _loader; } - const SharedPtr<Serialiser>& serialiser(); + const SharedPtr<Serialisation::Serialiser>& serialiser(); static inline App& instance() { assert(_instance); return *_instance; } @@ -130,29 +123,31 @@ protected: /** This is needed for the icon map. */ template <typename A, typename B> struct LexicalCompare { - bool operator()(const pair<A, B>& p1, const pair<A, B>& p2) { + bool operator()(const std::pair<A, B>& p1, const std::pair<A, B>& p2) { return (p1.first < p2.first) || ((p1.first == p2.first) && (p1.second < p2.second)); } }; - typedef map<pair<string, int>, Gdk::Pixbuf*, LexicalCompare<string, int> > Icons; + typedef std::map< std::pair<std::string, int>, + Gdk::Pixbuf*, + LexicalCompare<std::string, int> > Icons; Icons _icons; App(Ingen::Shared::World* world); bool animate(); - void error_response(int32_t id, const string& str); + void error_response(int32_t id, const std::string& str); static void* icon_destroyed(void* data); static App* _instance; - SharedPtr<SigClientInterface> _client; - SharedPtr<Raul::Deletable> _handle; - SharedPtr<ClientStore> _store; - SharedPtr<Serialiser> _serialiser; - SharedPtr<ThreadedLoader> _loader; + SharedPtr<Client::SigClientInterface> _client; + SharedPtr<Raul::Deletable> _handle; + SharedPtr<Client::ClientStore> _store; + SharedPtr<Serialisation::Serialiser> _serialiser; + SharedPtr<ThreadedLoader> _loader; Configuration* _configuration; @@ -174,5 +169,5 @@ protected: } // namespace GUI } // namespace Ingen -#endif // APP_H +#endif // INGEN_APP_HPP diff --git a/src/libs/gui/Configuration.hpp b/src/libs/gui/Configuration.hpp index 5baa7a09..124b41c8 100644 --- a/src/libs/gui/Configuration.hpp +++ b/src/libs/gui/Configuration.hpp @@ -52,11 +52,18 @@ public: void set_patch_folder(const string& f) { _patch_folder = f; } uint32_t get_port_color(const PortModel* pi); + + enum NameStyle { PATH, HUMAN }; + + NameStyle name_style() const { return _name_style; } + void set_name_style(NameStyle s) { _name_style = s; } private: /** Most recent patch folder shown in open dialog */ string _patch_folder; + NameStyle _name_style; + uint32_t _audio_port_color; uint32_t _control_port_color; uint32_t _event_port_color; diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp index 3037ee88..5600a0b2 100644 --- a/src/libs/gui/ConnectWindow.cpp +++ b/src/libs/gui/ConnectWindow.cpp @@ -40,6 +40,7 @@ #include "ConnectWindow.hpp" using Ingen::QueuedEngineInterface; using Ingen::Client::ThreadedSigClientInterface; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 032f5758..0e637721 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -25,6 +25,8 @@ #include "Controls.hpp" #include "GladeFactory.hpp" +using namespace std; + namespace Ingen { namespace GUI { diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp index 2f3b6af7..c33ad495 100644 --- a/src/libs/gui/LoadPatchWindow.cpp +++ b/src/libs/gui/LoadPatchWindow.cpp @@ -27,6 +27,7 @@ using namespace Ingen::Serialisation; using boost::optional; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/LoadPluginWindow.hpp b/src/libs/gui/LoadPluginWindow.hpp index a5246c39..98644dde 100644 --- a/src/libs/gui/LoadPluginWindow.hpp +++ b/src/libs/gui/LoadPluginWindow.hpp @@ -94,7 +94,7 @@ public: LoadPluginWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glade::Xml>& xml); void set_patch(SharedPtr<PatchModel> patch); - void set_plugins(SharedPtr<const ClientStore::Plugins> plugins); + void set_plugins(SharedPtr<const Client::ClientStore::Plugins> plugins); void add_plugin(SharedPtr<PluginModel> plugin); diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp index 5d4bcb5c..5567d67b 100644 --- a/src/libs/gui/LoadRemotePatchWindow.cpp +++ b/src/libs/gui/LoadRemotePatchWindow.cpp @@ -30,6 +30,7 @@ using boost::optional; using namespace Raul; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/LoadSubpatchWindow.cpp b/src/libs/gui/LoadSubpatchWindow.cpp index df954e48..52a989af 100644 --- a/src/libs/gui/LoadSubpatchWindow.cpp +++ b/src/libs/gui/LoadSubpatchWindow.cpp @@ -28,6 +28,7 @@ #include "Configuration.hpp" #include "ThreadedLoader.hpp" using boost::optional; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/NodeModule.cpp b/src/libs/gui/NodeModule.cpp index 09df174e..f8308264 100644 --- a/src/libs/gui/NodeModule.cpp +++ b/src/libs/gui/NodeModule.cpp @@ -31,6 +31,9 @@ #include "RenameWindow.hpp" #include "SubpatchModule.hpp" #include "WindowFactory.hpp" +#include "Configuration.hpp" + +using namespace std; namespace Ingen { namespace GUI { @@ -227,8 +230,12 @@ NodeModule::add_port(SharedPtr<PortModel> port, bool resize_to_fit) { uint32_t index = _ports.size(); // FIXME: kludge, engine needs to tell us this + string name = (App::instance().configuration()->name_style() == Configuration::PATH) + ? port->path().name() + : ((PluginModel*)node()->plugin())->port_human_name(index); + Module::add_port(boost::shared_ptr<Port>( - new Port(PtrCast<NodeModule>(shared_from_this()), port))); + new Port(PtrCast<NodeModule>(shared_from_this()), port, name))); port->signal_value_changed.connect(sigc::bind<0>( sigc::mem_fun(this, &NodeModule::value_changed), index)); diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp index ddbbdc2b..f96a9f57 100644 --- a/src/libs/gui/PatchCanvas.cpp +++ b/src/libs/gui/PatchCanvas.cpp @@ -47,6 +47,7 @@ using Ingen::Client::ClientStore; using Ingen::Serialisation::Serialiser; using Ingen::Client::PluginModel; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchPortModule.cpp b/src/libs/gui/PatchPortModule.cpp index 76bc8812..d8aaa91d 100644 --- a/src/libs/gui/PatchPortModule.cpp +++ b/src/libs/gui/PatchPortModule.cpp @@ -70,7 +70,7 @@ PatchPortModule::create(boost::shared_ptr<PatchCanvas> canvas, SharedPtr<PortMod new PatchPortModule(canvas, port)); assert(ret); - ret->_patch_port = boost::shared_ptr<Port>(new Port(ret, port, true)); + ret->_patch_port = boost::shared_ptr<Port>(new Port(ret, port, port->symbol(), true)); ret->add_port(ret->_patch_port); diff --git a/src/libs/gui/PatchTreeWindow.cpp b/src/libs/gui/PatchTreeWindow.cpp index 87393cec..4730da2b 100644 --- a/src/libs/gui/PatchTreeWindow.cpp +++ b/src/libs/gui/PatchTreeWindow.cpp @@ -25,6 +25,8 @@ #include "SubpatchModule.hpp" #include "WindowFactory.hpp" +using namespace std; + namespace Ingen { namespace GUI { diff --git a/src/libs/gui/PatchTreeWindow.hpp b/src/libs/gui/PatchTreeWindow.hpp index 5cd078a5..f549a322 100644 --- a/src/libs/gui/PatchTreeWindow.hpp +++ b/src/libs/gui/PatchTreeWindow.hpp @@ -45,12 +45,12 @@ public: void init(ClientStore& store); - void new_object(SharedPtr<ObjectModel> object); + void new_object(SharedPtr<Client::ObjectModel> object); void patch_property_changed(const string& key, const Raul::Atom& value, const Path& path); void patch_renamed(const Path& old_path, const Path& new_path); - void add_patch(SharedPtr<PatchModel> pm); + void add_patch(SharedPtr<Client::PatchModel> pm); void remove_patch(const Path& path); void show_patch_menu(GdkEventButton* ev); @@ -68,9 +68,9 @@ protected: PatchTreeModelColumns() { add(name_col); add(enabled_col); add(patch_model_col); } - Gtk::TreeModelColumn<Glib::ustring> name_col; - Gtk::TreeModelColumn<bool> enabled_col; - Gtk::TreeModelColumn<SharedPtr<PatchModel> > patch_model_col; + Gtk::TreeModelColumn<Glib::ustring> name_col; + Gtk::TreeModelColumn<bool> enabled_col; + Gtk::TreeModelColumn<SharedPtr<Client::PatchModel> > patch_model_col; }; bool _enable_signal; diff --git a/src/libs/gui/Port.cpp b/src/libs/gui/Port.cpp index 0452edc6..ab574f88 100644 --- a/src/libs/gui/Port.cpp +++ b/src/libs/gui/Port.cpp @@ -28,6 +28,7 @@ #include "GladeFactory.hpp" using namespace Ingen::Client; +using namespace std; namespace Ingen { namespace GUI { @@ -35,9 +36,12 @@ namespace GUI { /** @param flip Make an input port appear as an output port, and vice versa. */ -Port::Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm, bool flip) - : FlowCanvas::Port(module, - pm->path().name(), +Port::Port( + boost::shared_ptr<FlowCanvas::Module> module, + SharedPtr<PortModel> pm, + const string& name, + bool flip) + : FlowCanvas::Port(module, name, flip ? (!pm->is_input()) : pm->is_input(), App::instance().configuration()->get_port_color(pm.get())) , _port_model(pm) diff --git a/src/libs/gui/Port.hpp b/src/libs/gui/Port.hpp index 4851a63f..7b347194 100644 --- a/src/libs/gui/Port.hpp +++ b/src/libs/gui/Port.hpp @@ -38,7 +38,11 @@ namespace GUI { class Port : public FlowCanvas::Port { public: - Port(boost::shared_ptr<FlowCanvas::Module> module, SharedPtr<PortModel> pm, bool flip=false); + Port(boost::shared_ptr<FlowCanvas::Module> module, + SharedPtr<PortModel> pm, + const std::string& name, + bool flip=false); + ~Port(); SharedPtr<PortModel> model() const { return _port_model; } diff --git a/src/libs/gui/PortPropertiesWindow.cpp b/src/libs/gui/PortPropertiesWindow.cpp index 0129993b..ddab5715 100644 --- a/src/libs/gui/PortPropertiesWindow.cpp +++ b/src/libs/gui/PortPropertiesWindow.cpp @@ -24,7 +24,7 @@ #include "Controls.hpp" #include "PortPropertiesWindow.hpp" -using std::string; +using namespace std; namespace Ingen { namespace GUI { diff --git a/src/libs/gui/RenameWindow.cpp b/src/libs/gui/RenameWindow.cpp index 465b6b1b..b9c252d0 100644 --- a/src/libs/gui/RenameWindow.cpp +++ b/src/libs/gui/RenameWindow.cpp @@ -91,7 +91,6 @@ RenameWindow::name_changed() void RenameWindow::cancel_clicked() { - cout << "cancel\n"; _name_entry->set_text(""); hide(); } |