aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/eg-sampler.lv2')
-rw-r--r--plugins/eg-sampler.lv2/sampler.c10
-rw-r--r--plugins/eg-sampler.lv2/sampler_ui.c8
-rw-r--r--plugins/eg-sampler.lv2/uris.h68
-rw-r--r--plugins/eg-sampler.lv2/zix/common.h2
-rw-r--r--plugins/eg-sampler.lv2/zix/ring.c2
-rw-r--r--plugins/eg-sampler.lv2/zix/ring.h2
-rw-r--r--plugins/eg-sampler.lv2/zix/sem.h2
-rw-r--r--plugins/eg-sampler.lv2/zix/thread.h2
8 files changed, 48 insertions, 48 deletions
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index 043f629..d098114 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -149,7 +149,7 @@ handle_set_message(Sampler* plugin,
const LV2_Atom_Object* obj)
{
/* Get file path from message */
- const LV2_Atom* file_path = get_msg_file_path(&plugin->uris, obj);
+ const LV2_Atom* file_path = read_set_file(&plugin->uris, obj);
if (!file_path) {
return false;
}
@@ -411,9 +411,9 @@ run(LV2_Handle instance,
/* Send a notification that we're using a new sample. */
lv2_atom_forge_audio_time(&plugin->forge, 0, 0);
- write_set_filename_msg(&plugin->forge, uris,
- plugin->sample->path,
- plugin->sample->path_len);
+ write_set_file(&plugin->forge, uris,
+ plugin->sample->path,
+ plugin->sample->path_len);
} else {
fprintf(stderr, "Unknown message from worker\n");
@@ -488,7 +488,7 @@ extension_data(const char* uri)
}
static const LV2_Descriptor descriptor = {
- SAMPLER_URI,
+ EG_SAMPLER_URI,
instantiate,
connect_port,
NULL, // activate,
diff --git a/plugins/eg-sampler.lv2/sampler_ui.c b/plugins/eg-sampler.lv2/sampler_ui.c
index 2c039a5..619db50 100644
--- a/plugins/eg-sampler.lv2/sampler_ui.c
+++ b/plugins/eg-sampler.lv2/sampler_ui.c
@@ -1,6 +1,6 @@
/*
LV2 Sampler Example Plugin UI
- Copyright 2011 David Robillard <d@drobilla.net>
+ Copyright 2011-2012 David Robillard <d@drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -79,8 +79,8 @@ on_load_clicked(GtkWidget* widget,
uint8_t obj_buf[OBJ_BUF_SIZE];
lv2_atom_forge_set_buffer(&ui->forge, obj_buf, OBJ_BUF_SIZE);
- LV2_Atom* msg = write_set_filename_msg(&ui->forge, &ui->uris,
- filename, strlen(filename));
+ LV2_Atom* msg = write_set_file(&ui->forge, &ui->uris,
+ filename, strlen(filename));
ui->write(ui->controller, 0, lv2_atom_total_size(msg),
ui->uris.atom_eventTransfer,
@@ -158,7 +158,7 @@ port_event(LV2UI_Handle handle,
LV2_Atom* atom = (LV2_Atom*)buffer;
if (atom->type == ui->uris.atom_Blank) {
LV2_Atom_Object* obj = (LV2_Atom_Object*)atom;
- const LV2_Atom* file_uri = get_msg_file_path(&ui->uris, obj);
+ const LV2_Atom* file_uri = read_set_file(&ui->uris, obj);
if (!file_uri) {
fprintf(stderr, "Unknown message sent to UI.\n");
return;
diff --git a/plugins/eg-sampler.lv2/uris.h b/plugins/eg-sampler.lv2/uris.h
index 97cefca..5ef0b9c 100644
--- a/plugins/eg-sampler.lv2/uris.h
+++ b/plugins/eg-sampler.lv2/uris.h
@@ -1,6 +1,6 @@
/*
LV2 Sampler Example Plugin
- Copyright 2011 David Robillard <d@drobilla.net>
+ Copyright 2011-2012 David Robillard <d@drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -20,14 +20,12 @@
#include "lv2/lv2plug.in/ns/ext/state/state.h"
-#define NS_ATOM "http://lv2plug.in/ns/ext/atom#"
-#define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+#define LV2_MIDI__MidiEvent "http://lv2plug.in/ns/ext/midi#MidiEvent"
-#define SAMPLER_URI "http://lv2plug.in/plugins/eg-sampler"
-#define MIDI_EVENT_URI "http://lv2plug.in/ns/ext/midi#MidiEvent"
-#define FILE_URI SAMPLER_URI "#file"
-#define APPLY_SAMPLE_URI SAMPLER_URI "#applySample"
-#define FREE_SAMPLE_URI SAMPLER_URI "#freeSample"
+#define EG_SAMPLER_URI "http://lv2plug.in/plugins/eg-sampler"
+#define EG_SAMPLER__file EG_SAMPLER_URI "#file"
+#define EG_SAMPLER__applySample EG_SAMPLER_URI "#applySample"
+#define EG_SAMPLER__freeSample EG_SAMPLER_URI "#freeSample"
typedef struct {
LV2_URID atom_Blank;
@@ -49,10 +47,10 @@ map_sampler_uris(LV2_URID_Map* map, SamplerURIs* uris)
uris->atom_Path = map->map(map->handle, LV2_ATOM__Path);
uris->atom_Resource = map->map(map->handle, LV2_ATOM__Resource);
uris->atom_eventTransfer = map->map(map->handle, LV2_ATOM__eventTransfer);
- uris->eg_applySample = map->map(map->handle, APPLY_SAMPLE_URI);
- uris->eg_file = map->map(map->handle, FILE_URI);
- uris->eg_freeSample = map->map(map->handle, FREE_SAMPLE_URI);
- uris->midi_Event = map->map(map->handle, MIDI_EVENT_URI);
+ uris->eg_applySample = map->map(map->handle, EG_SAMPLER__applySample);
+ uris->eg_file = map->map(map->handle, EG_SAMPLER__file);
+ uris->eg_freeSample = map->map(map->handle, EG_SAMPLER__freeSample);
+ uris->midi_Event = map->map(map->handle, LV2_MIDI__MidiEvent);
uris->msg_Set = map->map(map->handle, LV2_MESSAGE__Set);
uris->msg_body = map->map(map->handle, LV2_MESSAGE__body);
}
@@ -64,19 +62,21 @@ is_object_type(const SamplerURIs* uris, LV2_URID type)
|| type == uris->atom_Blank;
}
+/**
+ * Write a message like the following to @p forge:
+ * [
+ * a msg:Set ;
+ * msg:body [
+ * eg-sampler:file </home/me/foo.wav> ;
+ * ] ;
+ * ]
+ */
static inline LV2_Atom*
-write_set_filename_msg(LV2_Atom_Forge* forge,
- const SamplerURIs* uris,
- const char* filename,
- const size_t filename_len)
+write_set_file(LV2_Atom_Forge* forge,
+ const SamplerURIs* uris,
+ const char* filename,
+ const size_t filename_len)
{
- /* Send [
- * a msg:Set ;
- * msg:body [
- * eg-sampler:filename </home/me/foo.wav> ;
- * ] ;
- * ]
- */
LV2_Atom_Forge_Frame set_frame;
LV2_Atom* set = (LV2_Atom*)lv2_atom_forge_blank(
forge, &set_frame, 1, uris->msg_Set);
@@ -94,19 +94,19 @@ write_set_filename_msg(LV2_Atom_Forge* forge,
return set;
}
+/**
+ * Get the file path from a message like:
+ * [
+ * a msg:Set ;
+ * msg:body [
+ * eg-sampler:file </home/me/foo.wav> ;
+ * ] ;
+ * ]
+ */
static inline const LV2_Atom*
-get_msg_file_path(const SamplerURIs* uris,
- const LV2_Atom_Object* obj)
+read_set_file(const SamplerURIs* uris,
+ const LV2_Atom_Object* obj)
{
- /* Message should look like this:
- * [
- * a msg:Set ;
- * msg:body [
- * eg-sampler:file </home/me/foo.wav> ;
- * ] ;
- * ]
- */
-
if (obj->type != uris->msg_Set) {
fprintf(stderr, "Ignoring unknown message type %d\n", obj->type);
return NULL;
diff --git a/plugins/eg-sampler.lv2/zix/common.h b/plugins/eg-sampler.lv2/zix/common.h
index 59e1f55..f113cfe 100644
--- a/plugins/eg-sampler.lv2/zix/common.h
+++ b/plugins/eg-sampler.lv2/zix/common.h
@@ -1,5 +1,5 @@
/*
- Copyright 2011 David Robillard <http://drobilla.net>
+ Copyright 2011-2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/plugins/eg-sampler.lv2/zix/ring.c b/plugins/eg-sampler.lv2/zix/ring.c
index 0e40515..29d415c 100644
--- a/plugins/eg-sampler.lv2/zix/ring.c
+++ b/plugins/eg-sampler.lv2/zix/ring.c
@@ -1,5 +1,5 @@
/*
- Copyright 2011 David Robillard <http://drobilla.net>
+ Copyright 2011-2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/plugins/eg-sampler.lv2/zix/ring.h b/plugins/eg-sampler.lv2/zix/ring.h
index ea673fe..dd45769 100644
--- a/plugins/eg-sampler.lv2/zix/ring.h
+++ b/plugins/eg-sampler.lv2/zix/ring.h
@@ -1,5 +1,5 @@
/*
- Copyright 2011 David Robillard <http://drobilla.net>
+ Copyright 2011-2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/plugins/eg-sampler.lv2/zix/sem.h b/plugins/eg-sampler.lv2/zix/sem.h
index 0b2bbb1..d536c99 100644
--- a/plugins/eg-sampler.lv2/zix/sem.h
+++ b/plugins/eg-sampler.lv2/zix/sem.h
@@ -1,5 +1,5 @@
/*
- Copyright 2012 David Robillard <http://drobilla.net>
+ Copyright 2012-2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
diff --git a/plugins/eg-sampler.lv2/zix/thread.h b/plugins/eg-sampler.lv2/zix/thread.h
index ff5a727..602b701 100644
--- a/plugins/eg-sampler.lv2/zix/thread.h
+++ b/plugins/eg-sampler.lv2/zix/thread.h
@@ -1,5 +1,5 @@
/*
- Copyright 2012 David Robillard <http://drobilla.net>
+ Copyright 2012-2012 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above