From a7d83f19b08eb4c6f79a82fe60c2b86db13f4420 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 24 Nov 2018 13:44:03 +0100 Subject: Squashed 'waflib/' changes from 6e726eb1..5ea8f99f 5ea8f99f Improve test output spacing 0e23b29f Raise exception when test suite fails to ensure non-zero exit status d6de073b Show run time of unit tests 5b655541 Add short configure option for ultra-strict flags 4687ba6d Use gtest-like test output 258903d9 Fix failure count in test group summaries da07e738 Fix verbose tests with Python 3 git-subtree-dir: waflib git-subtree-split: 5ea8f99f6e1246079c1fe6bb590c38a53aadd40d --- src/server/LV2Plugin.cpp | 143 ----------------------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 src/server/LV2Plugin.cpp (limited to 'src/server/LV2Plugin.cpp') diff --git a/src/server/LV2Plugin.cpp b/src/server/LV2Plugin.cpp deleted file mode 100644 index f56fd4d7..00000000 --- a/src/server/LV2Plugin.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - This file is part of Ingen. - Copyright 2007-2015 David Robillard - - Ingen is free software: you can redistribute it and/or modify it under the - terms of the GNU Affero General Public License as published by the Free - Software Foundation, either version 3 of the License, or any later version. - - Ingen is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. See the GNU Affero General Public License for details. - - You should have received a copy of the GNU Affero General Public License - along with Ingen. If not, see . -*/ - -#include - -#include "ingen/Forge.hpp" -#include "ingen/Log.hpp" -#include "ingen/URIs.hpp" -#include "ingen/World.hpp" -#include "lv2/lv2plug.in/ns/ext/presets/presets.h" - -#include "Engine.hpp" -#include "LV2Block.hpp" -#include "LV2Plugin.hpp" - -namespace Ingen { -namespace Server { - -LV2Plugin::LV2Plugin(World* world, const LilvPlugin* lplugin) - : PluginImpl(world->uris(), - world->uris().lv2_Plugin.urid, - URI(lilv_node_as_uri(lilv_plugin_get_uri(lplugin)))) - , _world(world) - , _lilv_plugin(lplugin) -{ - set_property(_uris.rdf_type, _uris.lv2_Plugin); - - update_properties(); -} - -void -LV2Plugin::update_properties() -{ - LilvNode* minor = lilv_world_get(_world->lilv_world(), - lilv_plugin_get_uri(_lilv_plugin), - _uris.lv2_minorVersion, - nullptr); - LilvNode* micro = lilv_world_get(_world->lilv_world(), - lilv_plugin_get_uri(_lilv_plugin), - _uris.lv2_microVersion, - nullptr); - - if (lilv_node_is_int(minor) && lilv_node_is_int(micro)) { - set_property(_uris.lv2_minorVersion, - _world->forge().make(lilv_node_as_int(minor))); - set_property(_uris.lv2_microVersion, - _world->forge().make(lilv_node_as_int(micro))); - } - - lilv_node_free(minor); - lilv_node_free(micro); -} - -const Raul::Symbol -LV2Plugin::symbol() const -{ - std::string working = uri(); - if (working.back() == '/') { - working = working.substr(0, working.length() - 1); - } - - while (working.length() > 0) { - size_t last_slash = working.find_last_of("/"); - const std::string symbol = working.substr(last_slash+1); - if ( (symbol[0] >= 'a' && symbol[0] <= 'z') - || (symbol[0] >= 'A' && symbol[0] <= 'Z') ) { - return Raul::Symbol::symbolify(symbol); - } else { - working = working.substr(0, last_slash); - } - } - - return Raul::Symbol("lv2_symbol"); -} - -BlockImpl* -LV2Plugin::instantiate(BufferFactory& bufs, - const Raul::Symbol& symbol, - bool polyphonic, - GraphImpl* parent, - Engine& engine, - const LilvState* state) -{ - LV2Block* b = new LV2Block( - this, symbol, polyphonic, parent, engine.sample_rate()); - - if (!b->instantiate(bufs, state)) { - delete b; - return nullptr; - } else { - return b; - } -} - -void -LV2Plugin::load_presets() -{ - const URIs& uris = _world->uris(); - LilvWorld* lworld = _world->lilv_world(); - LilvNodes* presets = lilv_plugin_get_related(_lilv_plugin, uris.pset_Preset); - - if (presets) { - LILV_FOREACH(nodes, i, presets) { - const LilvNode* preset = lilv_nodes_get(presets, i); - lilv_world_load_resource(lworld, preset); - - LilvNodes* labels = lilv_world_find_nodes( - lworld, preset, uris.rdfs_label, nullptr); - if (labels) { - const LilvNode* label = lilv_nodes_get_first(labels); - - _presets.emplace(URI(lilv_node_as_uri(preset)), - lilv_node_as_string(label)); - - lilv_nodes_free(labels); - } else { - _world->log().error( - fmt("Preset <%1%> has no rdfs:label\n") - % lilv_node_as_string(lilv_nodes_get(presets, i))); - } - } - - lilv_nodes_free(presets); - } - - PluginImpl::load_presets(); -} - -} // namespace Server -} // namespace Ingen -- cgit v1.2.1