aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-01-18 11:09:43 +0100
committerGravatar Hanspeter Portner <dev@open-music-kontrollers.ch>2019-01-18 11:09:43 +0100
commit1cb4f59708279c8fba18eb670baed759a535a72b (patch)
treea396aa1aefe763d19274002099ceb303abb2013d
parent4d842a379e2eef48fb4258e8871fb12e2a9eaa1d (diff)
downloadsynthpod-1cb4f59708279c8fba18eb670baed759a535a72b.zip
synthpod-1cb4f59708279c8fba18eb670baed759a535a72b.tar.gz
synthpod-1cb4f59708279c8fba18eb670baed759a535a72b.tar.bz2
synthpod-1cb4f59708279c8fba18eb670baed759a535a72b.tar.xz
nsmc: convert into header-only library.
-rw-r--r--VERSION2
-rw-r--r--bin/meson.build3
-rw-r--r--bin/nsmc.h57
-rw-r--r--bin/synthpod_bin.h2
-rw-r--r--meson.build3
-rw-r--r--nsmc/nsmc.h (renamed from bin/nsmc.c)80
6 files changed, 76 insertions, 71 deletions
diff --git a/VERSION b/VERSION
index 3bdb678..22bee49 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.1.5889
+0.1.5891
diff --git a/bin/meson.build b/bin/meson.build
index 8917d58..e69a252 100644
--- a/bin/meson.build
+++ b/bin/meson.build
@@ -1,5 +1,4 @@
-bin_srcs = ['synthpod_bin.c',
- 'nsmc.c']
+bin_srcs = ['synthpod_bin.c']
bin = static_library('synthpod_bin', bin_srcs,
include_directories : bin_incs,
diff --git a/bin/nsmc.h b/bin/nsmc.h
deleted file mode 100644
index a50b602..0000000
--- a/bin/nsmc.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Hanspeter Portner (dev@open-music-kontrollers.ch)
- *
- * This is free software: you can redistribute it and/or modify
- * it under the terms of the Artistic License 2.0 as published by
- * The Perl Foundation.
- *
- * This source is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Artistic License 2.0 for more details.
- *
- * You should have received a copy of the Artistic License 2.0
- * along the source as a COPYING file. If not, obtain it from
- * http://www.perlfoundation.org/artistic_license_2_0.
- */
-
-typedef struct _nsmc_t nsmc_t;
-typedef struct _nsmc_driver_t nsmc_driver_t;
-
-typedef int (*nsmc_open_t)(const char *path, const char *name,
- const char *id, void *data);
-typedef int (*nsmc_save_t)(void *data);
-typedef int (*nsmc_show_t)(void *data);
-typedef int (*nsmc_hide_t)(void *data);
-
-struct _nsmc_driver_t {
- nsmc_open_t open;
- nsmc_save_t save;
- nsmc_show_t show;
- nsmc_hide_t hide;
-};
-
-nsmc_t *
-nsmc_new(const char *exe, const char *path,
- const nsmc_driver_t *driver, void *data);
-
-void
-nsmc_free(nsmc_t *nsm);
-
-void
-nsmc_run(nsmc_t *nsm);
-
-void
-nsmc_opened(nsmc_t *nsm, int status);
-
-void
-nsmc_shown(nsmc_t *nsm);
-
-void
-nsmc_hidden(nsmc_t *nsm);
-
-void
-nsmc_saved(nsmc_t *nsm, int status);
-
-bool
-nsmc_managed(nsmc_t *nsm);
diff --git a/bin/synthpod_bin.h b/bin/synthpod_bin.h
index b01590f..8b535a3 100644
--- a/bin/synthpod_bin.h
+++ b/bin/synthpod_bin.h
@@ -38,6 +38,8 @@
#include <sandbox_master.h>
#include <synthpod_common.h>
+
+#define NSMC_IMPLEMENTATION
#include <nsmc.h>
#include <lv2/lv2plug.in/ns/ext/urid/urid.h>
diff --git a/meson.build b/meson.build
index fca657b..ac39a96 100644
--- a/meson.build
+++ b/meson.build
@@ -23,9 +23,10 @@ netatom_incs = include_directories('netatom.lv2')
props_incs = include_directories('props.lv2')
pugl_incs = include_directories('pugl')
jackey_incs = include_directories('jackey')
+nsmc_incs = include_directories('nsmc')
self_incs = include_directories('')
-bin_incs = [inc_incs, app_incs, xpress_incs, osc_incs, canvas_incs, extui_incs, ardour_incs, varchunk_incs, crossclock_incs, lfrtm_incs, mapper_incs, sbox_incs, props_incs, pugl_incs, jackey_incs, self_incs]
+bin_incs = [inc_incs, app_incs, xpress_incs, osc_incs, canvas_incs, extui_incs, ardour_incs, varchunk_incs, crossclock_incs, lfrtm_incs, mapper_incs, sbox_incs, props_incs, pugl_incs, jackey_incs, nsmc_incs, self_incs]
static_link = meson.is_cross_build() and false #FIXME
diff --git a/bin/nsmc.c b/nsmc/nsmc.h
index 06d6516..138749e 100644
--- a/bin/nsmc.c
+++ b/nsmc/nsmc.h
@@ -15,6 +15,60 @@
* http://www.perlfoundation.org/artistic_license_2_0.
*/
+#ifndef _NSMC_H
+#define _NSMC_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef NSMC_API
+# define NSMC_API static
+#endif
+
+typedef struct _nsmc_t nsmc_t;
+typedef struct _nsmc_driver_t nsmc_driver_t;
+
+typedef int (*nsmc_open_t)(const char *path, const char *name,
+ const char *id, void *data);
+typedef int (*nsmc_save_t)(void *data);
+typedef int (*nsmc_show_t)(void *data);
+typedef int (*nsmc_hide_t)(void *data);
+
+struct _nsmc_driver_t {
+ nsmc_open_t open;
+ nsmc_save_t save;
+ nsmc_show_t show;
+ nsmc_hide_t hide;
+};
+
+NSMC_API nsmc_t *
+nsmc_new(const char *exe, const char *path,
+ const nsmc_driver_t *driver, void *data);
+
+NSMC_API void
+nsmc_free(nsmc_t *nsm);
+
+NSMC_API void
+nsmc_run(nsmc_t *nsm);
+
+NSMC_API void
+nsmc_opened(nsmc_t *nsm, int status);
+
+NSMC_API void
+nsmc_shown(nsmc_t *nsm);
+
+NSMC_API void
+nsmc_hidden(nsmc_t *nsm);
+
+NSMC_API void
+nsmc_saved(nsmc_t *nsm, int status);
+
+NSMC_API bool
+nsmc_managed(nsmc_t *nsm);
+
+#ifdef NSMC_IMPLEMENTATION
+
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
@@ -26,8 +80,6 @@
#include <varchunk.h>
-#include <nsmc.h>
-
typedef void (*osc_cb_t)(LV2_OSC_Reader *reader, nsmc_t *nsm);
typedef struct _osc_msg_t osc_msg_t;
@@ -280,7 +332,7 @@ static const LV2_OSC_Driver driver = {
.read_adv = _send_adv
};
-nsmc_t *
+NSMC_API nsmc_t *
nsmc_new(const char *exe, const char *path,
const nsmc_driver_t *nsm_driver, void *data)
{
@@ -355,7 +407,7 @@ nsmc_new(const char *exe, const char *path,
return nsm;
}
-void
+NSMC_API void
nsmc_free(nsmc_t *nsm)
{
if(nsm)
@@ -382,7 +434,7 @@ nsmc_free(nsmc_t *nsm)
}
}
-void
+NSMC_API void
nsmc_run(nsmc_t *nsm)
{
if(!nsm)
@@ -421,7 +473,7 @@ nsmc_run(nsmc_t *nsm)
}
}
-void
+NSMC_API void
nsmc_opened(nsmc_t *nsm, int status)
{
if(!nsm)
@@ -457,7 +509,7 @@ nsmc_opened(nsmc_t *nsm, int status)
}
}
-void
+NSMC_API void
nsmc_shown(nsmc_t *nsm)
{
if(!nsm)
@@ -484,7 +536,7 @@ nsmc_shown(nsmc_t *nsm)
}
}
-void
+NSMC_API void
nsmc_hidden(nsmc_t *nsm)
{
if(!nsm)
@@ -511,7 +563,7 @@ nsmc_hidden(nsmc_t *nsm)
}
}
-void
+NSMC_API void
nsmc_saved(nsmc_t *nsm, int status)
{
if(!nsm)
@@ -547,8 +599,16 @@ nsmc_saved(nsmc_t *nsm, int status)
}
}
-bool
+NSMC_API bool
nsmc_managed(nsmc_t *nsm)
{
return nsm->managed;
}
+
+#endif /* NSMC_IMPLEMENTATION */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_NSMC_H */