aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg05-scope.lv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2013-12-24 16:49:44 +0000
committerDavid Robillard <d@drobilla.net>2013-12-24 16:49:44 +0000
commita6521f912b24bcf40c204303139eb2a104d5f85d (patch)
treefa101a658cc926b5387e9896667ca6658a5a62d1 /plugins/eg05-scope.lv2
parent391dd35265d03f3d4ebfcc2e2da28e2db6c75306 (diff)
downloadlv2-a6521f912b24bcf40c204303139eb2a104d5f85d.tar.xz
Fix several const violations.
Diffstat (limited to 'plugins/eg05-scope.lv2')
-rw-r--r--plugins/eg05-scope.lv2/examploscope.c13
-rw-r--r--plugins/eg05-scope.lv2/examploscope_ui.c32
2 files changed, 23 insertions, 22 deletions
diff --git a/plugins/eg05-scope.lv2/examploscope.c b/plugins/eg05-scope.lv2/examploscope.c
index 13281ab..ff64866 100644
--- a/plugins/eg05-scope.lv2/examploscope.c
+++ b/plugins/eg05-scope.lv2/examploscope.c
@@ -242,13 +242,14 @@ run(LV2_Handle handle, uint32_t n_samples)
// Process incoming events from GUI
if (self->control) {
- LV2_Atom_Event* ev = lv2_atom_sequence_begin(&(self->control)->body);
+ const LV2_Atom_Event* ev = lv2_atom_sequence_begin(
+ &(self->control)->body);
// For each incoming message...
while (!lv2_atom_sequence_is_end(
&self->control->body, self->control->atom.size, ev)) {
// If the event is an atom:Blank object
if (ev->body.type == self->uris.atom_Blank) {
- const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)&ev->body;
if (obj->body.otype == self->uris.ui_On) {
// If the object is a ui-on, the UI was activated
self->ui_active = true;
@@ -264,10 +265,10 @@ run(LV2_Handle handle, uint32_t n_samples)
self->uris.ui_amp, &amp,
0);
if (spp) {
- self->ui_spp = ((LV2_Atom_Int*)spp)->body;
+ self->ui_spp = ((const LV2_Atom_Int*)spp)->body;
}
if (amp) {
- self->ui_amp = ((LV2_Atom_Float*)amp)->body;
+ self->ui_amp = ((const LV2_Atom_Float*)amp)->body;
}
}
}
@@ -343,14 +344,14 @@ state_restore(LV2_Handle instance,
const void* spp = retrieve(
handle, self->uris.ui_spp, &size, &type, &valflags);
if (spp && size == sizeof(uint32_t) && type == self->uris.atom_Int) {
- self->ui_spp = *((uint32_t*)spp);
+ self->ui_spp = *((const uint32_t*)spp);
self->send_settings_to_ui = true;
}
const void* amp = retrieve(
handle, self->uris.ui_amp, &size, &type, &valflags);
if (amp && size == sizeof(float) && type == self->uris.atom_Float) {
- self->ui_amp = *((float*)amp);
+ self->ui_amp = *((const float*)amp);
self->send_settings_to_ui = true;
}
diff --git a/plugins/eg05-scope.lv2/examploscope_ui.c b/plugins/eg05-scope.lv2/examploscope_ui.c
index ffbe573..3e014f0 100644
--- a/plugins/eg05-scope.lv2/examploscope_ui.c
+++ b/plugins/eg05-scope.lv2/examploscope_ui.c
@@ -527,10 +527,10 @@ cleanup(LV2UI_Handle handle)
}
static int
-recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
+recv_raw_audio(EgScopeUI* ui, const LV2_Atom_Object* obj)
{
- LV2_Atom* chan_val = NULL;
- LV2_Atom* data_val = NULL;
+ const LV2_Atom* chan_val = NULL;
+ const LV2_Atom* data_val = NULL;
const int n_props = lv2_atom_object_get(
obj,
ui->uris.channelID, &chan_val,
@@ -546,8 +546,8 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
}
// Get the values we need from the body of the property value atoms
- const int32_t chn = ((LV2_Atom_Int*)chan_val)->body;
- LV2_Atom_Vector* vec = (LV2_Atom_Vector*)data_val;
+ const int32_t chn = ((const LV2_Atom_Int*)chan_val)->body;
+ const LV2_Atom_Vector* vec = (const LV2_Atom_Vector*)data_val;
if (vec->body.child_type != ui->uris.atom_Float) {
return 1; // Vector has incorrect element type
}
@@ -557,7 +557,7 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
/ sizeof(float));
// Float elements immediately follow the vector body header
- const float* data = (float*)(&vec->body + 1);
+ const float* data = (const float*)(&vec->body + 1);
// Update display
update_scope(ui, chn, n_elem, data);
@@ -565,11 +565,11 @@ recv_raw_audio(EgScopeUI* ui, LV2_Atom_Object* obj)
}
static int
-recv_ui_state(EgScopeUI* ui, LV2_Atom_Object* obj)
+recv_ui_state(EgScopeUI* ui, const LV2_Atom_Object* obj)
{
- LV2_Atom* spp_val = NULL;
- LV2_Atom* amp_val = NULL;
- LV2_Atom* rate_val = NULL;
+ const LV2_Atom* spp_val = NULL;
+ const LV2_Atom* amp_val = NULL;
+ const LV2_Atom* rate_val = NULL;
const int n_props = lv2_atom_object_get(
obj,
ui->uris.ui_spp, &spp_val,
@@ -587,9 +587,9 @@ recv_ui_state(EgScopeUI* ui, LV2_Atom_Object* obj)
}
// Get the values we need from the body of the property value atoms
- const int32_t spp = ((LV2_Atom_Int*)spp_val)->body;
- const float amp = ((LV2_Atom_Float*)amp_val)->body;
- const float rate = ((LV2_Atom_Float*)rate_val)->body;
+ const int32_t spp = ((const LV2_Atom_Int*)spp_val)->body;
+ const float amp = ((const LV2_Atom_Float*)amp_val)->body;
+ const float rate = ((const LV2_Atom_Float*)rate_val)->body;
// Update UI
gtk_spin_button_set_value(GTK_SPIN_BUTTON(ui->spb_speed), spp);
@@ -614,8 +614,8 @@ port_event(LV2UI_Handle handle,
uint32_t format,
const void* buffer)
{
- EgScopeUI* ui = (EgScopeUI*)handle;
- LV2_Atom* atom = (LV2_Atom*)buffer;
+ EgScopeUI* ui = (EgScopeUI*)handle;
+ const LV2_Atom* atom = (const LV2_Atom*)buffer;
/* Check type of data received
* - format == 0: Control port event (float)
@@ -623,7 +623,7 @@ port_event(LV2UI_Handle handle,
*/
if (format == ui->uris.atom_eventTransfer &&
atom->type == ui->uris.atom_Blank) {
- LV2_Atom_Object* obj = (LV2_Atom_Object*)atom;
+ const LV2_Atom_Object* obj = (const LV2_Atom_Object*)atom;
if (obj->body.otype == ui->uris.RawAudio) {
recv_raw_audio(ui, obj);
} else if (obj->body.otype == ui->uris.ui_State) {