aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-scope.lv2
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/eg-scope.lv2')
-rw-r--r--plugins/eg-scope.lv2/examploscope.c35
-rw-r--r--plugins/eg-scope.lv2/examploscope_ui.c50
-rw-r--r--plugins/eg-scope.lv2/meson.build14
-rw-r--r--plugins/eg-scope.lv2/uris.h8
4 files changed, 57 insertions, 50 deletions
diff --git a/plugins/eg-scope.lv2/examploscope.c b/plugins/eg-scope.lv2/examploscope.c
index e3bb53b..5cdb610 100644
--- a/plugins/eg-scope.lv2/examploscope.c
+++ b/plugins/eg-scope.lv2/examploscope.c
@@ -2,17 +2,17 @@
// Copyright 2013 Robin Gareus <robin@gareus.org>
// SPDX-License-Identifier: ISC
-#include "./uris.h"
-
-#include "lv2/atom/atom.h"
-#include "lv2/atom/forge.h"
-#include "lv2/atom/util.h"
-#include "lv2/core/lv2.h"
-#include "lv2/core/lv2_util.h"
-#include "lv2/log/log.h"
-#include "lv2/log/logger.h"
-#include "lv2/state/state.h"
-#include "lv2/urid/urid.h"
+#include "uris.h"
+
+#include <lv2/atom/atom.h>
+#include <lv2/atom/forge.h>
+#include <lv2/atom/util.h>
+#include <lv2/core/lv2.h>
+#include <lv2/core/lv2_util.h>
+#include <lv2/log/log.h>
+#include <lv2/log/logger.h>
+#include <lv2/state/state.h>
+#include <lv2/urid/urid.h>
#include <stdbool.h>
#include <stdint.h>
@@ -169,11 +169,11 @@ connect_port(LV2_Handle handle, uint32_t port, void* data)
http://lv2plug.in/ns/ext/atom#Float[Float].
*/
static void
-tx_rawaudio(LV2_Atom_Forge* forge,
- ScoLV2URIs* uris,
- const int32_t channel,
- const size_t n_samples,
- const float* data)
+tx_rawaudio(LV2_Atom_Forge* forge,
+ const ScoLV2URIs* uris,
+ const int32_t channel,
+ const size_t n_samples,
+ const float* data)
{
LV2_Atom_Forge_Frame frame;
@@ -398,8 +398,7 @@ static const LV2_Descriptor descriptor_stereo = {SCO_URI "#Stereo",
cleanup,
extension_data};
-LV2_SYMBOL_EXPORT
-const LV2_Descriptor*
+LV2_SYMBOL_EXPORT const LV2_Descriptor*
lv2_descriptor(uint32_t index)
{
switch (index) {
diff --git a/plugins/eg-scope.lv2/examploscope_ui.c b/plugins/eg-scope.lv2/examploscope_ui.c
index 1c82d44..4f366aa 100644
--- a/plugins/eg-scope.lv2/examploscope_ui.c
+++ b/plugins/eg-scope.lv2/examploscope_ui.c
@@ -1,14 +1,14 @@
// Copyright 2013 Robin Gareus <robin@gareus.org>
// SPDX-License-Identifier: ISC
-#include "./uris.h"
+#include "uris.h"
-#include "lv2/atom/atom.h"
-#include "lv2/atom/forge.h"
-#include "lv2/atom/util.h"
-#include "lv2/core/lv2.h"
-#include "lv2/ui/ui.h"
-#include "lv2/urid/urid.h"
+#include <lv2/atom/atom.h>
+#include <lv2/atom/forge.h>
+#include <lv2/atom/util.h>
+#include <lv2/core/lv2.h>
+#include <lv2/ui/ui.h>
+#include <lv2/urid/urid.h>
#include <cairo.h>
#include <gdk/gdk.h>
@@ -110,6 +110,8 @@ send_ui_state(LV2UI_Handle handle)
lv2_atom_total_size(msg),
ui->uris.atom_eventTransfer,
msg);
+
+ lv2_atom_forge_set_buffer(&ui->forge, NULL, 0);
}
/** Notify backend that UI is closed. */
@@ -134,6 +136,8 @@ send_ui_disable(LV2UI_Handle handle)
lv2_atom_total_size(msg),
ui->uris.atom_eventTransfer,
msg);
+
+ lv2_atom_forge_set_buffer(&ui->forge, NULL, 0);
}
/**
@@ -167,7 +171,7 @@ send_ui_enable(LV2UI_Handle handle)
static gboolean
on_cfg_changed(GtkWidget* widget, gpointer data)
{
- EgScopeUI* ui = (EgScopeUI*)data;
+ const EgScopeUI* ui = (const EgScopeUI*)data;
if (!ui->updating) {
// Only send UI state if the change is from user interaction
send_ui_state(data);
@@ -206,6 +210,7 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data)
assert(start < DAWIDTH);
assert(end <= DAWIDTH);
assert(start < end);
+ assert(ui->n_channels <= 2U);
for (uint32_t c = 0; c < ui->n_channels; ++c) {
ScoChan* chn = &ui->chn[c];
@@ -219,10 +224,10 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data)
* - (DAHEIGHT / 2) * (VAL) * (GAIN)
* )
*/
- const float chn_y_offset = DAHEIGHT * c + DAHEIGHT * 0.5f - 0.5f;
- const float chn_y_scale = DAHEIGHT * 0.5f * gain;
+ const float chn_y_offset = (DAHEIGHT * c) + (DAHEIGHT * 0.5f) - 0.5f;
+ const float chn_y_scale = (DAHEIGHT * 0.5f) * gain;
-#define CYPOS(VAL) (chn_y_offset - (VAL)*chn_y_scale)
+#define CYPOS(VAL) (chn_y_offset - ((VAL) * chn_y_scale))
cairo_save(cr);
@@ -292,15 +297,15 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data)
// Channel separator
if (c > 0) {
cairo_set_source_rgba(cr, .5, .5, .5, 1.0);
- cairo_move_to(cr, 0, DAHEIGHT * c - .5);
- cairo_line_to(cr, DAWIDTH, DAHEIGHT * c - .5);
+ cairo_move_to(cr, 0, (DAHEIGHT * c) - .5);
+ cairo_line_to(cr, DAWIDTH, (DAHEIGHT * c) - .5);
cairo_stroke(cr);
}
// Zero scale line
cairo_set_source_rgba(cr, .3, .3, .7, .5);
- cairo_move_to(cr, 0, DAHEIGHT * (c + .5) - .5);
- cairo_line_to(cr, DAWIDTH, DAHEIGHT * (c + .5) - .5);
+ cairo_move_to(cr, 0, (DAHEIGHT * (c + .5)) - .5);
+ cairo_line_to(cr, DAWIDTH, (DAHEIGHT * (c + .5)) - .5);
cairo_stroke(cr);
}
@@ -327,12 +332,12 @@ on_expose_event(GtkWidget* widget, GdkEventExpose* ev, gpointer data)
and https://github.com/x42/sisco.lv2
*/
static int
-process_channel(EgScopeUI* ui,
- ScoChan* chn,
- const size_t n_elem,
- float const* data,
- uint32_t* idx_start,
- uint32_t* idx_end)
+process_channel(const EgScopeUI* ui,
+ ScoChan* chn,
+ const size_t n_elem,
+ float const* data,
+ uint32_t* idx_start,
+ uint32_t* idx_end)
{
int overflow = 0;
*idx_start = chn->idx;
@@ -655,8 +660,7 @@ static const LV2UI_Descriptor descriptor = {SCO_URI "#ui",
port_event,
NULL};
-LV2_SYMBOL_EXPORT
-const LV2UI_Descriptor*
+LV2_SYMBOL_EXPORT const LV2UI_Descriptor*
lv2ui_descriptor(uint32_t index)
{
return index == 0 ? &descriptor : NULL;
diff --git a/plugins/eg-scope.lv2/meson.build b/plugins/eg-scope.lv2/meson.build
index 773a3d0..84e17ba 100644
--- a/plugins/eg-scope.lv2/meson.build
+++ b/plugins/eg-scope.lv2/meson.build
@@ -6,10 +6,12 @@ ui_sources = files('examploscope_ui.c')
bundle_name = 'eg-scope.lv2'
data_filenames = ['manifest.ttl.in', 'examploscope.ttl.in']
-gtk2_dep = dependency('gtk+-2.0',
- include_type: 'system',
- required: get_option('plugins'),
- version: '>= 2.18.0')
+gtk2_dep = dependency(
+ 'gtk+-2.0',
+ include_type: 'system',
+ required: get_option('plugins'),
+ version: '>= 2.18.0',
+)
module = shared_library(
'examploscope',
@@ -17,6 +19,7 @@ module = shared_library(
c_args: c_suppressions,
dependencies: [lv2_dep, m_dep],
gnu_symbol_visibility: 'hidden',
+ implicit_include_directories: false,
install: true,
install_dir: lv2dir / bundle_name,
name_prefix: '',
@@ -25,7 +28,7 @@ module = shared_library(
config = configuration_data(
{
'LIB_EXT': '.' + module.full_path().split('.')[-1],
- }
+ },
)
foreach filename : data_filenames
@@ -53,6 +56,7 @@ if gtk2_dep.found()
c_args: c_suppressions,
dependencies: [lv2_dep, gtk2_dep],
gnu_symbol_visibility: 'hidden',
+ implicit_include_directories: false,
install: true,
install_dir: lv2dir / bundle_name,
name_prefix: '',
diff --git a/plugins/eg-scope.lv2/uris.h b/plugins/eg-scope.lv2/uris.h
index e2becae..d9d94be 100644
--- a/plugins/eg-scope.lv2/uris.h
+++ b/plugins/eg-scope.lv2/uris.h
@@ -4,9 +4,9 @@
#ifndef SCO_URIS_H
#define SCO_URIS_H
-#include "lv2/atom/atom.h"
-#include "lv2/parameters/parameters.h"
-#include "lv2/urid/urid.h"
+#include <lv2/atom/atom.h>
+#include <lv2/parameters/parameters.h>
+#include <lv2/urid/urid.h>
#define SCO_URI "http://lv2plug.in/plugins/eg-scope"
@@ -18,7 +18,7 @@ typedef struct {
LV2_URID atom_eventTransfer;
LV2_URID param_sampleRate;
- /* URIs defined for this plugin. It is best to re-use existing URIs as
+ /* URIs defined for this plugin. It is best to reuse existing URIs as
much as possible, but plugins may need more vocabulary specific to their
needs. These are used as types and properties for plugin:UI
communication, as well as for saving state. */