diff options
Diffstat (limited to 'include/suil/suil.h')
-rw-r--r-- | include/suil/suil.h | 108 |
1 files changed, 62 insertions, 46 deletions
diff --git a/include/suil/suil.h b/include/suil/suil.h index ec2ea5e..ba55a91 100644 --- a/include/suil/suil.h +++ b/include/suil/suil.h @@ -1,18 +1,5 @@ -/* - Copyright 2011-2017 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 - copyright notice and this permission notice appear in all copies. - - THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -*/ +// Copyright 2011-2017 David Robillard <d@drobilla.net> +// SPDX-License-Identifier: ISC /// @file suil.h Public API for Suil @@ -24,6 +11,7 @@ #include <stdbool.h> #include <stdint.h> +// SUIL_LIB_IMPORT and SUIL_LIB_EXPORT mark the entry points of shared libraries #ifdef _WIN32 # define SUIL_LIB_IMPORT __declspec(dllimport) # define SUIL_LIB_EXPORT __declspec(dllexport) @@ -32,14 +20,15 @@ # define SUIL_LIB_EXPORT __attribute__((visibility("default"))) #endif -#ifndef SUIL_STATIC -# ifdef SUIL_INTERNAL +// SUIL_API exposes symbols in the public API +#ifndef SUIL_API +# ifdef SUIL_STATIC +# define SUIL_API +# elif defined(SUIL_INTERNAL) # define SUIL_API SUIL_LIB_EXPORT # else # define SUIL_API SUIL_LIB_IMPORT # endif -#else -# define SUIL_API #endif #ifdef __cplusplus @@ -47,27 +36,14 @@ extern "C" { #endif /** - @defgroup suil Suil + @defgroup suil Suil C API @{ */ /** - UI host descriptor. - - This contains the various functions that a plugin UI may use to communicate - with the plugin. It is passed to suil_instance_new() to provide these - functions to the UI. + @defgroup suil_callbacks Callbacks + @{ */ -typedef struct SuilHostImpl SuilHost; - -/// An instance of an LV2 plugin UI -typedef struct SuilInstanceImpl SuilInstance; - -/// Opaque pointer to a UI handle -typedef void* SuilHandle; - -/// Opaque pointer to a UI widget -typedef void* SuilWidget; /** UI controller. @@ -112,6 +88,12 @@ typedef void (*SuilTouchFunc)( // uint32_t port_index, bool grabbed); +/** + @} + @defgroup suil_library Library + @{ +*/ + /// Initialization argument typedef enum { SUIL_ARG_NONE } SuilArg; @@ -128,6 +110,37 @@ void suil_init(int* argc, char*** argv, SuilArg key, ...); /** + Check if suil can wrap a UI type. + + @param host_type_uri The URI of the desired widget type of the host, + corresponding to the `type_uri` parameter of suil_instance_new(). + + @param ui_type_uri The URI of the UI widget type. + + @return 0 if wrapping is unsupported, otherwise the quality of the wrapping + where 1 is the highest quality (direct native embedding with no wrapping) + and increasing values are of a progressively lower quality and/or stability. +*/ +SUIL_API +unsigned +suil_ui_supported(const char* host_type_uri, const char* ui_type_uri); + +/** + @} + @defgroup suil_host Host + @{ +*/ + +/** + UI host descriptor. + + This contains the various functions that a plugin UI may use to communicate + with the plugin. It is passed to suil_instance_new() to provide these + functions to the UI. +*/ +typedef struct SuilHostImpl SuilHost; + +/** Create a new UI host descriptor. @param write_func Function to send a value to a plugin port. @@ -159,20 +172,22 @@ void suil_host_free(SuilHost* host); /** - Check if suil can wrap a UI type. + @} +*/ - @param host_type_uri The URI of the desired widget type of the host, - corresponding to the `type_uri` parameter of suil_instance_new(). +/** + @defgroup suil_instance Instance + @{ +*/ - @param ui_type_uri The URI of the UI widget type. +/// An instance of an LV2 plugin UI +typedef struct SuilInstanceImpl SuilInstance; - @return 0 if wrapping is unsupported, otherwise the quality of the wrapping - where 1 is the highest quality (direct native embedding with no wrapping) - and increasing values are of a progressively lower quality and/or stability. -*/ -SUIL_API -unsigned -suil_ui_supported(const char* host_type_uri, const char* ui_type_uri); +/// Opaque pointer to a UI handle +typedef void* SuilHandle; + +/// Opaque pointer to a UI widget +typedef void* SuilWidget; /** Instantiate a UI for an LV2 plugin. @@ -277,6 +292,7 @@ suil_instance_extension_data(SuilInstance* instance, const char* uri); /** @} + @} */ #ifdef __cplusplus |