summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/LV2Block.cpp25
-rw-r--r--src/server/LV2Block.hpp4
-rw-r--r--src/server/events/CreateBlock.cpp3
-rw-r--r--src/server/events/Delta.cpp14
4 files changed, 23 insertions, 23 deletions
diff --git a/src/server/LV2Block.cpp b/src/server/LV2Block.cpp
index 53bed410..f4792f39 100644
--- a/src/server/LV2Block.cpp
+++ b/src/server/LV2Block.cpp
@@ -18,9 +18,6 @@
#include <cmath>
#include <cstdint>
-#include <glibmm/miscutils.h>
-#include <glibmm/convert.h>
-
#include "lv2/lv2plug.in/ns/ext/morph/morph.h"
#include "lv2/lv2plug.in/ns/ext/presets/presets.h"
#include "lv2/lv2plug.in/ns/ext/options/options.h"
@@ -30,7 +27,9 @@
#include "raul/Maid.hpp"
#include "raul/Array.hpp"
+#include "ingen/FilePath.hpp"
#include "ingen/Log.hpp"
+#include "ingen/URI.hpp"
#include "ingen/URIMap.hpp"
#include "ingen/URIs.hpp"
#include "ingen/World.hpp"
@@ -460,7 +459,7 @@ LV2Block::instantiate(BufferFactory& bufs, const LilvState* state)
}
bool
-LV2Block::save_state(const std::string& dir) const
+LV2Block::save_state(const FilePath& dir) const
{
World* world = _lv2_plugin->world();
LilvWorld* lworld = world->lilv_world();
@@ -623,11 +622,11 @@ LV2Block::load_preset(const URI& uri)
}
LilvState*
-LV2Block::load_state(World* world, const std::string& path)
+LV2Block::load_state(World* world, const FilePath& path)
{
- LilvWorld* lworld = world->lilv_world();
- const std::string uri = Glib::filename_to_uri(path);
- LilvNode* subject = lilv_new_uri(lworld, uri.c_str());
+ LilvWorld* lworld = world->lilv_world();
+ const URI uri = URI(path);
+ LilvNode* subject = lilv_new_uri(lworld, uri.c_str());
LilvState* state = lilv_state_new_from_file(
lworld,
@@ -685,9 +684,9 @@ LV2Block::save_preset(const URI& uri,
LV2_URID_Map* lmap = &world->uri_map().urid_map_feature()->urid_map;
LV2_URID_Unmap* lunmap = &world->uri_map().urid_unmap_feature()->urid_unmap;
- const std::string path = Glib::filename_from_uri(uri.string());
- const std::string dirname = Glib::path_get_dirname(path);
- const std::string basename = Glib::path_get_basename(path);
+ const FilePath path = FilePath(uri.path());
+ const FilePath dirname = path.parent_path();
+ const FilePath basename = path.stem();
LilvState* state = lilv_state_new_from_instance(
_lv2_plugin->lilv_plugin(), instance(0), lmap,
@@ -715,8 +714,8 @@ LV2Block::save_preset(const URI& uri,
preset.set_property(_uris.lv2_appliesTo,
world->forge().make_urid(_lv2_plugin->uri()));
- LilvNode* lbundle = lilv_new_uri(
- lworld, Glib::filename_to_uri(dirname + "/").c_str());
+ const std::string bundle_uri = URI(dirname).string() + '/';
+ LilvNode* lbundle = lilv_new_uri(lworld, bundle_uri.c_str());
lilv_world_load_bundle(lworld, lbundle);
lilv_node_free(lbundle);
diff --git a/src/server/LV2Block.hpp b/src/server/LV2Block.hpp
index eec852a2..f3a59550 100644
--- a/src/server/LV2Block.hpp
+++ b/src/server/LV2Block.hpp
@@ -51,7 +51,7 @@ public:
bool instantiate(BufferFactory& bufs, const LilvState* state);
LilvInstance* instance() { return instance(0); }
- bool save_state(const std::string& dir) const;
+ bool save_state(const FilePath& dir) const;
BlockImpl* duplicate(Engine& engine,
const Raul::Symbol& symbol,
@@ -80,7 +80,7 @@ public:
BufferRef buf,
SampleCount offset);
- static LilvState* load_state(World* world, const std::string& path);
+ static LilvState* load_state(World* world, const FilePath& path);
protected:
struct Instance : public Raul::Noncopyable {
diff --git a/src/server/events/CreateBlock.cpp b/src/server/events/CreateBlock.cpp
index fc0c0f5e..d678bea3 100644
--- a/src/server/events/CreateBlock.cpp
+++ b/src/server/events/CreateBlock.cpp
@@ -119,7 +119,8 @@ CreateBlock::pre_process(PreProcessContext& ctx)
LilvState* state = nullptr;
auto s = _properties.find(uris.state_state);
if (s != _properties.end() && s->second.type() == uris.forge.Path) {
- state = LV2Block::load_state(_engine.world(), s->second.ptr<char>());
+ state = LV2Block::load_state(
+ _engine.world(), FilePath(s->second.ptr<char>()));
}
// Instantiate plugin
diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp
index 56cc22aa..b23ae884 100644
--- a/src/server/events/Delta.cpp
+++ b/src/server/events/Delta.cpp
@@ -17,8 +17,6 @@
#include <vector>
#include <thread>
-#include <glibmm/convert.h>
-
#include "ingen/Log.hpp"
#include "ingen/Store.hpp"
#include "ingen/URIs.hpp"
@@ -366,15 +364,17 @@ Delta::pre_process(PreProcessContext& ctx)
_status = Status::BAD_VALUE_TYPE;
}
} else if (key == uris.pset_preset) {
- std::string uri_str;
+ URI uri;
if (uris.forge.is_uri(value)) {
- uri_str = uris.forge.str(value, false);
+ const std::string uri_str = uris.forge.str(value, false);
+ if (URI::is_valid(uri_str)) {
+ uri = URI(uri_str);
+ }
} else if (value.type() == uris.forge.Path) {
- uri_str = Glib::filename_to_uri(value.ptr<char>());
+ uri = URI(FilePath(value.ptr<char>()));
}
- if (URI::is_valid(uri_str)) {
- const URI uri(uri_str);
+ if (!uri.empty()) {
op = SpecialType::PRESET;
if ((_state = block->load_preset(uri))) {
lilv_state_emit_port_values(