diff options
-rw-r--r-- | patches/saw_lp.ingen.ttl | 2 | ||||
-rw-r--r-- | src/libs/client/Makefile.am | 1 | ||||
-rw-r--r-- | src/libs/client/PortModel.h | 26 | ||||
-rw-r--r-- | src/libs/client/Serializer.cpp | 6 | ||||
-rw-r--r-- | src/libs/client/Serializer.h | 1 | ||||
-rw-r--r-- | src/libs/engine/MidiControlNode.cpp | 7 | ||||
-rw-r--r-- | src/libs/engine/MidiNoteNode.cpp | 10 | ||||
-rw-r--r-- | src/libs/engine/MidiTriggerNode.cpp | 8 | ||||
-rw-r--r-- | src/libs/engine/OSCClientSender.cpp | 11 | ||||
-rw-r--r-- | src/libs/engine/ObjectSender.cpp | 29 | ||||
-rw-r--r-- | src/libs/gui/ControlGroups.cpp | 31 | ||||
-rw-r--r-- | src/libs/gui/ControlPanel.cpp | 4 |
12 files changed, 70 insertions, 66 deletions
diff --git a/patches/saw_lp.ingen.ttl b/patches/saw_lp.ingen.ttl index 3503ff20..98fc4165 100644 --- a/patches/saw_lp.ingen.ttl +++ b/patches/saw_lp.ingen.ttl @@ -6,7 +6,7 @@ @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -<file:///home/dave/files/code/lad/ingen/src/progs/ingen/saw_lp.ingen.ttl> +<> ingen:node [ ingen:plugin <ladspa:1668>; a "ingen:Node"; diff --git a/src/libs/client/Makefile.am b/src/libs/client/Makefile.am index 20822e8a..7250de36 100644 --- a/src/libs/client/Makefile.am +++ b/src/libs/client/Makefile.am @@ -35,6 +35,7 @@ libingen_client_la_SOURCES = \ NodeModel.h \ NodeModel.cpp \ PortModel.h \ + PortModel.cpp \ PatchModel.h \ PatchModel.cpp \ PluginModel.h \ diff --git a/src/libs/client/PortModel.h b/src/libs/client/PortModel.h index 139e2a97..4dcf5e7f 100644 --- a/src/libs/client/PortModel.h +++ b/src/libs/client/PortModel.h @@ -41,9 +41,6 @@ class PortModel : public ObjectModel public: enum Direction { INPUT, OUTPUT }; - // FIXME: metadataify - enum Hint { NONE, INTEGER, TOGGLE, LOGARITHMIC }; - inline string type() const { return _type; } inline float value() const { return _current_val; } inline bool connected() const { return (_connections > 0); } @@ -52,10 +49,11 @@ public: inline bool is_audio() const { return (_type == "ingen:audio"); } inline bool is_control() const { return (_type == "ingen:control"); } inline bool is_midi() const { return (_type == "ingen:midi"); } - inline bool is_logarithmic() const { return (_hint == LOGARITHMIC); } - inline bool is_integer() const { return (_hint == INTEGER); } - inline bool is_toggle() const { return (_hint == TOGGLE); } + bool is_logarithmic() const; + bool is_integer() const; + bool is_toggle() const; + inline bool operator==(const PortModel& pm) const { return (_path == pm._path); } inline void value(float val) @@ -74,30 +72,17 @@ public: private: friend class Store; - PortModel(const Path& path, const string& type, Direction dir, Hint hint) - : ObjectModel(path), - _type(type), - _direction(dir), - _hint(hint), - _current_val(0.0f), - _connections(0) - { - if (!is_audio() && !is_control() && !is_input()) - cerr << "[PortModel] Warning: Unknown port type" << endl; - } - PortModel(const Path& path, const string& type, Direction dir) : ObjectModel(path), _type(type), _direction(dir), - _hint(NONE), _current_val(0.0f), _connections(0) { if (!is_audio() && !is_control() && !is_input()) cerr << "[PortModel] Warning: Unknown port type" << endl; } - + void add_child(SharedPtr<ObjectModel> c) { throw; } void remove_child(SharedPtr<ObjectModel> c) { throw; } @@ -106,7 +91,6 @@ private: string _type; Direction _direction; - Hint _hint; float _current_val; size_t _connections; }; diff --git a/src/libs/client/Serializer.cpp b/src/libs/client/Serializer.cpp index 92b0ad41..a1d5cc03 100644 --- a/src/libs/client/Serializer.cpp +++ b/src/libs/client/Serializer.cpp @@ -70,7 +70,6 @@ Serializer::start_to_filename(const string& filename) _base_uri = "file://" + filename; _model = new RDF::Model(_world); _mode = TO_FILE; - _filename = filename; } @@ -89,7 +88,6 @@ Serializer::start_to_string() _base_uri = ""; _model = new RDF::Model(_world); _mode = TO_STRING; - _filename = ""; } @@ -104,11 +102,11 @@ Serializer::finish() string ret = ""; if (_mode == TO_FILE) - _model->serialize_to_file(_filename); + _model->serialize_to_file(_base_uri); else ret = _model->serialize_to_string(); - _filename = ""; + _base_uri = ""; _node_map.clear(); return ret; diff --git a/src/libs/client/Serializer.h b/src/libs/client/Serializer.h index ee7d3dff..6095cb25 100644 --- a/src/libs/client/Serializer.h +++ b/src/libs/client/Serializer.h @@ -73,7 +73,6 @@ private: typedef std::map<Path, Raul::RDF::Node> NodeMap; Mode _mode; - std::string _filename; NodeMap _node_map; string _base_uri; Raul::RDF::World& _world; diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index 6b83e335..dcd32768 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -39,12 +39,19 @@ MidiControlNode::MidiControlNode(const string& path, size_t poly, Patch* parent, _ports->at(0) = _midi_in_port; _param_port = new InputPort(this, "ControllerNumber", 1, 1, DataType::FLOAT, 1); + _param_port->set_metadata("ingen:minimum", 0.0f); + _param_port->set_metadata("ingen:maximum", 127.0f); + _param_port->set_metadata("ingen:default", 0.0f); + _param_port->set_metadata("ingen:integer", 1); _ports->at(1) = _param_port; _log_port = new InputPort(this, "Logarithmic", 2, 1, DataType::FLOAT, 1); + _log_port->set_metadata("ingen:toggled", 1); + _log_port->set_metadata("ingen:default", 0.0f); _ports->at(2) = _log_port; _min_port = new InputPort(this, "Min", 3, 1, DataType::FLOAT, 1); + _min_port->set_metadata("ingen:default", 0.0f); _ports->at(3) = _min_port; _max_port = new InputPort(this, "Max", 4, 1, DataType::FLOAT, 1); diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index aac195ef..2eec62a4 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -45,19 +45,21 @@ MidiNoteNode::MidiNoteNode(const string& path, size_t poly, Patch* parent, Sampl _ports->at(0) = _midi_in_port; _freq_port = new OutputPort(this, "Frequency", 1, poly, DataType::FLOAT, _buffer_size); - // new PortInfo("Frequency", AUDIO, OUTPUT, 440, 0, 99999), _buffer_size); _ports->at(1) = _freq_port; _vel_port = new OutputPort(this, "Velocity", 2, poly, DataType::FLOAT, _buffer_size); - // new PortInfo("Velocity", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); + _vel_port->set_metadata("ingen:minimum", 0.0f); + _vel_port->set_metadata("ingen:maximum", 1.0f); _ports->at(2) = _vel_port; _gate_port = new OutputPort(this, "Gate", 3, poly, DataType::FLOAT, _buffer_size); - // new PortInfo("Gate", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); + _gate_port->set_metadata("ingen:toggled", 1); + _gate_port->set_metadata("ingen:default", 0.0f); _ports->at(3) = _gate_port; _trig_port = new OutputPort(this, "Trigger", 4, poly, DataType::FLOAT, _buffer_size); - // new PortInfo("Trigger", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); + _trig_port->set_metadata("ingen:toggled", 1); + _trig_port->set_metadata("ingen:default", 0.0f); _ports->at(4) = _trig_port; plugin()->plug_label("note_in"); diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index a0b0c032..610f3ef9 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -36,19 +36,19 @@ MidiTriggerNode::MidiTriggerNode(const string& path, size_t poly, Patch* parent, _ports->at(0) = _midi_in_port; _note_port = new InputPort(this, "NoteNumber", 1, 1, DataType::FLOAT, 1); - // new PortInfo("Note Number", CONTROL, INPUT, INTEGER, 60, 0, 127), 1); + _note_port->set_metadata("ingen:minimum", 0.0f); + _note_port->set_metadata("ingen:maximum", 127.0f); + _note_port->set_metadata("ingen:default", 60.0f); + _note_port->set_metadata("ingen:integer", 1); _ports->at(1) = _note_port; _gate_port = new OutputPort(this, "Gate", 2, 1, DataType::FLOAT, _buffer_size); - // new PortInfo("Gate", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(2) = _gate_port; _trig_port = new OutputPort(this, "Trigger", 3, 1, DataType::FLOAT, _buffer_size); - // new PortInfo("Trigger", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(3) = _trig_port; _vel_port = new OutputPort(this, "Velocity", 4, poly, DataType::FLOAT, _buffer_size); - // new PortInfo("Velocity", AUDIO, OUTPUT, 0, 0, 1), _buffer_size); _ports->at(4) = _vel_port; plugin()->plug_label("trigger_in"); diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 5565505b..a20efea4 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -351,20 +351,13 @@ void OSCClientSender::new_node(string plugin_uri, */ void OSCClientSender::new_port(string path, - string data_type, - bool is_output) + string data_type, + bool is_output) { if (!_enabled) return; - //PortInfo* info = port->port_info(); - lo_send(_address, "/ingen/new_port", "ssi", path.c_str(), data_type.c_str(), is_output); - - // Send metadata - /*const map<string, string>& data = port->metadata(); - for (map<string, string>::const_iterator i = data.begin(); i != data.end(); ++i) - metadata_update(port->path(), (*i).first, (*i).second);*/ } diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index db573afc..608d1768 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -96,29 +96,22 @@ ObjectSender::send_node(ClientInterface* client, const Node* node, bool recursiv return; } - // FIXME: bundleify - //client->bundle_begin(); + client->bundle_begin(); - const Raul::Array<Port*>& ports = node->ports(); - - client->new_node(node->plugin()->uri(), node->path(), polyphonic, ports.size()); + client->new_node(node->plugin()->uri(), node->path(), polyphonic, node->ports().size()); - if (recursive) { - // Send ports - for (size_t j=0; j < ports.size(); ++j) { - Port* const port = ports.at(j); - assert(port); - - send_port(client, port); - } - } - // Send metadata const GraphObject::MetadataMap& data = node->metadata(); for (GraphObject::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j) client->metadata_update(node->path(), (*j).first, (*j).second); - //client->bundle_end(); + client->bundle_end(); + + if (recursive) { + // Send ports + for (size_t j=0; j < node->ports().size(); ++j) + send_port(client, node->ports().at(j)); + } } @@ -142,6 +135,8 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) //cerr << ", type = " << type << endl; + client->bundle_begin(); + client->new_port(port->path(), type, port->is_output()); // Send control value @@ -155,6 +150,8 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) const GraphObject::MetadataMap& data = port->metadata(); for (GraphObject::MetadataMap::const_iterator j = data.begin(); j != data.end(); ++j) client->metadata_update(port->path(), (*j).first, (*j).second); + + client->bundle_end(); } diff --git a/src/libs/gui/ControlGroups.cpp b/src/libs/gui/ControlGroups.cpp index 2d68492c..14d67870 100644 --- a/src/libs/gui/ControlGroups.cpp +++ b/src/libs/gui/ControlGroups.cpp @@ -93,7 +93,7 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm) _slider->set_draw_value(false); - _name_label->signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControlGroup::clicked)); + signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControlGroup::clicked)); _slider->signal_button_press_event().connect(sigc::mem_fun(*this, &SliderControlGroup::clicked)); _slider->signal_event().connect( @@ -138,7 +138,13 @@ SliderControlGroup::init(ControlPanel* panel, SharedPtr<PortModel> pm) if (max <= min) max = min + 1.0f; - _slider->set_increments(0, 0); + if (pm->is_integer() || pm->is_toggle()) { + _slider->set_increments(1, 10); + _value_spinner->set_digits(0); + } else { + _slider->set_increments(0, 0); + } + _slider->set_range(min, max); //_value_spinner->set_range(min, max); @@ -177,6 +183,9 @@ SliderControlGroup::menu_properties() void SliderControlGroup::set_value(float val) { + if (_port_model->is_integer()) + val = lrintf(val); + _enable_signal = false; if (_enabled) { if (_slider->get_value() != val) { @@ -237,12 +246,22 @@ void SliderControlGroup::update_value_from_slider() { if (_enable_signal) { - const float value = _slider->get_value(); + float value = _slider->get_value(); + bool change = true; + _enable_signal = false; - _value_spinner->set_value(value); - _control_panel->value_changed(_port_model, value); - + if (_port_model->is_integer()) { + value = lrintf(value); + if (value == lrintf(_port_model->value())) + change = false; + } + + if (change) { + _value_spinner->set_value(value); + _control_panel->value_changed(_port_model, value); + } + _enable_signal = true; } } diff --git a/src/libs/gui/ControlPanel.cpp b/src/libs/gui/ControlPanel.cpp index 6f3638a8..70ab273e 100644 --- a/src/libs/gui/ControlPanel.cpp +++ b/src/libs/gui/ControlPanel.cpp @@ -99,6 +99,7 @@ ControlPanel::add_port(SharedPtr<PortModel> pm) // Add port if (pm->is_control() && pm->is_input()) { SliderControlGroup* cg = NULL; +#if 0 if (pm->is_integer()) cerr << "FIXME: integer\n"; //cg = new IntegerControlGroup(this, pm); @@ -106,10 +107,13 @@ ControlPanel::add_port(SharedPtr<PortModel> pm) cerr << "FIXME: toggle\n"; //cg = new ToggleControlGroup(this, pm); else { +#endif Glib::RefPtr<Gnome::Glade::Xml> xml = GladeFactory::new_glade_reference("control_strip"); xml->get_widget_derived("control_strip", cg); cg->init(this, pm); +#if 0 } +#endif if (_controls.size() > 0) _control_box->pack_start(*Gtk::manage(new Gtk::HSeparator()), false, false, 4); |