aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/eg-amp.lv2/amp.c12
-rw-r--r--plugins/eg-sampler.lv2/sampler.c22
-rw-r--r--plugins/eg-synth.lv2/synth.c15
3 files changed, 24 insertions, 25 deletions
diff --git a/plugins/eg-amp.lv2/amp.c b/plugins/eg-amp.lv2/amp.c
index 7f7cacc..86f7a81 100644
--- a/plugins/eg-amp.lv2/amp.c
+++ b/plugins/eg-amp.lv2/amp.c
@@ -41,9 +41,9 @@ typedef enum {
/** Plugin instance. */
typedef struct {
// Port buffers
- float* gain;
- float* input;
- float* output;
+ const float* gain;
+ const float* input;
+ float* output;
} Amp;
/** Create a new plugin instance. */
@@ -68,10 +68,10 @@ connect_port(LV2_Handle instance,
switch ((PortIndex)port) {
case AMP_GAIN:
- amp->gain = (float*)data;
+ amp->gain = (const float*)data;
break;
case AMP_INPUT:
- amp->input = (float*)data;
+ amp->input = (const float*)data;
break;
case AMP_OUTPUT:
amp->output = (float*)data;
@@ -92,7 +92,7 @@ activate(LV2_Handle instance)
static void
run(LV2_Handle instance, uint32_t n_samples)
{
- Amp* amp = (Amp*)instance;
+ const Amp* amp = (const Amp*)instance;
const float gain = *(amp->gain);
const float* const input = amp->input;
diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c
index a94518b..3415dcb 100644
--- a/plugins/eg-sampler.lv2/sampler.c
+++ b/plugins/eg-sampler.lv2/sampler.c
@@ -51,9 +51,9 @@
#include "./uris.h"
enum {
- SAMPLER_CONTROL = 0,
- SAMPLER_RESPONSE = 1,
- SAMPLER_OUT = 2
+ SAMPLER_CONTROL = 0,
+ SAMPLER_NOTIFY = 1,
+ SAMPLER_OUT = 2
};
static const char* default_sample_file = "click.wav";
@@ -78,9 +78,9 @@ typedef struct {
Sample* sample;
/* Ports */
- float* output_port;
- LV2_Atom_Sequence* control_port;
- LV2_Atom_Sequence* notify_port;
+ const LV2_Atom_Sequence* control_port;
+ LV2_Atom_Sequence* notify_port;
+ float* output_port;
/* Forge frame for notify port (for writing worker replies). */
LV2_Atom_Forge_Frame notify_frame;
@@ -201,7 +201,7 @@ work(LV2_Handle instance,
const LV2_Atom* atom = (const LV2_Atom*)data;
if (atom->type == self->uris.eg_freeSample) {
/* Free old sample */
- SampleMessage* msg = (SampleMessage*)data;
+ const SampleMessage* msg = (const SampleMessage*)data;
free_sample(self, msg->sample);
} else {
/* Handle set message (load sample). */
@@ -214,7 +214,7 @@ work(LV2_Handle instance,
}
/* Load sample. */
- Sample* sample = load_sample(self, LV2_ATOM_BODY(file_path));
+ Sample* sample = load_sample(self, LV2_ATOM_BODY_CONST(file_path));
if (sample) {
/* Loaded sample, send it to run() to be applied. */
respond(handle, sizeof(sample), &sample);
@@ -245,7 +245,7 @@ work_response(LV2_Handle instance,
self->schedule->schedule_work(self->schedule->handle, sizeof(msg), &msg);
/* Install the new sample */
- self->sample = *(Sample**)data;
+ self->sample = *(Sample*const*)data;
/* Send a notification that we're using a new sample. */
lv2_atom_forge_frame_time(&self->forge, self->frame_offset);
@@ -264,9 +264,9 @@ connect_port(LV2_Handle instance,
Sampler* self = (Sampler*)instance;
switch (port) {
case SAMPLER_CONTROL:
- self->control_port = (LV2_Atom_Sequence*)data;
+ self->control_port = (const LV2_Atom_Sequence*)data;
break;
- case SAMPLER_RESPONSE:
+ case SAMPLER_NOTIFY:
self->notify_port = (LV2_Atom_Sequence*)data;
break;
case SAMPLER_OUT:
diff --git a/plugins/eg-synth.lv2/synth.c b/plugins/eg-synth.lv2/synth.c
index d969057..758989b 100644
--- a/plugins/eg-synth.lv2/synth.c
+++ b/plugins/eg-synth.lv2/synth.c
@@ -45,9 +45,8 @@ typedef struct {
float phase;
// Port buffers
- float* freq;
- float* input;
- float* output;
+ const float* freq;
+ float* output;
} Synth;
/** Create a new plugin instance. */
@@ -58,10 +57,10 @@ instantiate(const LV2_Descriptor* descriptor,
const LV2_Feature* const* features)
{
Synth* self = (Synth*)malloc(sizeof(Synth));
-
- // Store the sample rate so it is available in run()
- self->sample_rate = rate;
-
+ if (self) {
+ // Store the sample rate so it is available in run()
+ self->sample_rate = rate;
+ }
return (LV2_Handle)self;
}
@@ -75,7 +74,7 @@ connect_port(LV2_Handle instance,
switch ((PortIndex)port) {
case SYNTH_FREQ:
- self->freq = (float*)data;
+ self->freq = (const float*)data;
break;
case SYNTH_OUTPUT:
self->output = (float*)data;