From 1f9dda45a2411c35ae73bb6db7681df5f4ea7884 Mon Sep 17 00:00:00 2001 From: Hanspeter Portner Date: Fri, 5 May 2023 18:35:52 +0200 Subject: [PATCH] Make reuse compatible, use subprojects --- .builds/alpine-latest.yml | 43 + .gitignore | 5 + .gitlab-ci.yml | 5 - COPYING | 201 --- ChangeLog | 4 + LICENSES/Artistic-2.0.txt | 85 ++ LICENSES/CC0-1.0.txt | 121 ++ README.md | 6 + VERSION | 1 - gitlab-ci/generic.yml | 106 -- meson.build | 37 +- meson_options.txt | 5 + props.lv2/.gitlab-ci.yml | 2 - props.lv2/COPYING | 201 --- props.lv2/README.md | 20 - props.lv2/VERSION | 1 - props.lv2/gitlab-ci/generic.yml | 106 -- props.lv2/meson.build | 82 -- props.lv2/props.h | 1226 ----------------- props.lv2/test/chunk.bin | Bin 16 -> 0 bytes props.lv2/test/manifest.ttl.in | 28 - props.lv2/test/props.c | 323 ----- props.lv2/test/props.ttl | 151 -- props.lv2/test/props_test.c | 647 --------- screenshots/screenshot_1.png.license | 2 + ser_atom.lv2/.gitlab-ci.yml | 63 - ser_atom.lv2/COPYING | 201 --- ser_atom.lv2/README.md | 33 - ser_atom.lv2/VERSION | 1 - ser_atom.lv2/meson.build | 26 - ser_atom.lv2/ser_atom.lv2/ser_atom.h | 215 --- ser_atom.lv2/test/ser_atom_test.c | 136 -- .../shells_bells.h | 18 +- shells_bells_ui.ttl | 35 - shells_bells.c => src/shells_bells.c | 18 +- shells_bells_ui.c => src/shells_bells_ui.c | 57 +- manifest.ttl.in => ttl/manifest.ttl.in | 16 +- .../shells_bells.ttl.in | 16 +- ttl/shells_bells_ui.ttl | 23 + 39 files changed, 335 insertions(+), 3931 deletions(-) create mode 100644 .builds/alpine-latest.yml create mode 100644 .gitignore delete mode 100644 .gitlab-ci.yml delete mode 100644 COPYING create mode 100644 LICENSES/Artistic-2.0.txt create mode 100644 LICENSES/CC0-1.0.txt delete mode 100644 VERSION delete mode 100644 gitlab-ci/generic.yml delete mode 100644 props.lv2/.gitlab-ci.yml delete mode 100644 props.lv2/COPYING delete mode 100644 props.lv2/README.md delete mode 100644 props.lv2/VERSION delete mode 100644 props.lv2/gitlab-ci/generic.yml delete mode 100644 props.lv2/meson.build delete mode 100644 props.lv2/props.h delete mode 100644 props.lv2/test/chunk.bin delete mode 100644 props.lv2/test/manifest.ttl.in delete mode 100644 props.lv2/test/props.c delete mode 100644 props.lv2/test/props.ttl delete mode 100644 props.lv2/test/props_test.c create mode 100644 screenshots/screenshot_1.png.license delete mode 100644 ser_atom.lv2/.gitlab-ci.yml delete mode 100644 ser_atom.lv2/COPYING delete mode 100644 ser_atom.lv2/README.md delete mode 100644 ser_atom.lv2/VERSION delete mode 100644 ser_atom.lv2/meson.build delete mode 100644 ser_atom.lv2/ser_atom.lv2/ser_atom.h delete mode 100644 ser_atom.lv2/test/ser_atom_test.c rename shells_bells.h => shells_bells.lv2/shells_bells.h (70%) delete mode 100644 shells_bells_ui.ttl rename shells_bells.c => src/shells_bells.c (90%) rename shells_bells_ui.c => src/shells_bells_ui.c (91%) rename manifest.ttl.in => ttl/manifest.ttl.in (52%) rename shells_bells.ttl.in => ttl/shells_bells.ttl.in (84%) create mode 100644 ttl/shells_bells_ui.ttl diff --git a/.builds/alpine-latest.yml b/.builds/alpine-latest.yml new file mode 100644 index 0000000..1313115 --- /dev/null +++ b/.builds/alpine-latest.yml @@ -0,0 +1,43 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +--- + +image: alpine/latest + +packages: + - reuse + - meson + - lv2-dev + - glu-dev + - libvterm-dev + +environment: + project: shells_bells.lv2 + +tasks: + - setup: | + cd "${project}" + meson setup build \ + -Dbuildtype=release \ + -Dprefix="/tmp" \ + -Dlv2libdir="" \ + -Duse-fontconfig=disabled + - build: | + cd "${project}" + ninja -C build install + - test: | + cd "${project}" + ninja -C build test + - pack: | + cd /tmp + tar -czf artifacts.tar.gz "${project}" + +artifacts: + - /tmp/artifacts.tar.gz + +triggers: + - action: email + condition: failure + to: "" +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cfb9f13 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +tags +*.taghl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index b91d04a..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,5 +0,0 @@ -include: - - local: 'gitlab-ci/generic.yml' - -variables: - BUILD_OPTS: "-Duse-fontconfig=disabled" diff --git a/COPYING b/COPYING deleted file mode 100644 index ddb9a46..0000000 --- a/COPYING +++ /dev/null @@ -1,201 +0,0 @@ - The Artistic License 2.0 - - Copyright (c) 2000-2006, The Perl Foundation. - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble - -This license establishes the terms under which a given free software -Package may be copied, modified, distributed, and/or redistributed. -The intent is that the Copyright Holder maintains some artistic -control over the development of that Package while still keeping the -Package available as open source and free software. - -You are always permitted to make arrangements wholly outside of this -license directly with the Copyright Holder of a given Package. If the -terms of this license do not permit the full use that you propose to -make of the Package, you should contact the Copyright Holder and seek -a different licensing arrangement. - -Definitions - - "Copyright Holder" means the individual(s) or organization(s) - named in the copyright notice for the entire Package. - - "Contributor" means any party that has contributed code or other - material to the Package, in accordance with the Copyright Holder's - procedures. - - "You" and "your" means any person who would like to copy, - distribute, or modify the Package. - - "Package" means the collection of files distributed by the - Copyright Holder, and derivatives of that collection and/or of - those files. A given Package may consist of either the Standard - Version, or a Modified Version. - - "Distribute" means providing a copy of the Package or making it - accessible to anyone else, or in the case of a company or - organization, to others outside of your company or organization. - - "Distributor Fee" means any fee that you charge for Distributing - this Package or providing support for this Package to another - party. It does not mean licensing fees. - - "Standard Version" refers to the Package if it has not been - modified, or has been modified only in ways explicitly requested - by the Copyright Holder. - - "Modified Version" means the Package, if it has been changed, and - such changes were not explicitly requested by the Copyright - Holder. - - "Original License" means this Artistic License as Distributed with - the Standard Version of the Package, in its current version or as - it may be modified by The Perl Foundation in the future. - - "Source" form means the source code, documentation source, and - configuration files for the Package. - - "Compiled" form means the compiled bytecode, object code, binary, - or any other form resulting from mechanical transformation or - translation of the Source form. - - -Permission for Use and Modification Without Distribution - -(1) You are permitted to use the Standard Version and create and use -Modified Versions for any purpose without restriction, provided that -you do not Distribute the Modified Version. - - -Permissions for Redistribution of the Standard Version - -(2) You may Distribute verbatim copies of the Source form of the -Standard Version of this Package in any medium without restriction, -either gratis or for a Distributor Fee, provided that you duplicate -all of the original copyright notices and associated disclaimers. At -your discretion, such verbatim copies may or may not include a -Compiled form of the Package. - -(3) You may apply any bug fixes, portability changes, and other -modifications made available from the Copyright Holder. The resulting -Package will still be considered the Standard Version, and as such -will be subject to the Original License. - - -Distribution of Modified Versions of the Package as Source - -(4) You may Distribute your Modified Version as Source (either gratis -or for a Distributor Fee, and with or without a Compiled form of the -Modified Version) provided that you clearly document how it differs -from the Standard Version, including, but not limited to, documenting -any non-standard features, executables, or modules, and provided that -you do at least ONE of the following: - - (a) make the Modified Version available to the Copyright Holder - of the Standard Version, under the Original License, so that the - Copyright Holder may include your modifications in the Standard - Version. - - (b) ensure that installation of your Modified Version does not - prevent the user installing or running the Standard Version. In - addition, the Modified Version must bear a name that is different - from the name of the Standard Version. - - (c) allow anyone who receives a copy of the Modified Version to - make the Source form of the Modified Version available to others - under - - (i) the Original License or - - (ii) a license that permits the licensee to freely copy, - modify and redistribute the Modified Version using the same - licensing terms that apply to the copy that the licensee - received, and requires that the Source form of the Modified - Version, and of any works derived from it, be made freely - available in that license fees are prohibited but Distributor - Fees are allowed. - - -Distribution of Compiled Forms of the Standard Version -or Modified Versions without the Source - -(5) You may Distribute Compiled forms of the Standard Version without -the Source, provided that you include complete instructions on how to -get the Source of the Standard Version. Such instructions must be -valid at the time of your distribution. If these instructions, at any -time while you are carrying out such distribution, become invalid, you -must provide new instructions on demand or cease further distribution. -If you provide valid instructions or cease distribution within thirty -days after you become aware that the instructions are invalid, then -you do not forfeit any of your rights under this license. - -(6) You may Distribute a Modified Version in Compiled form without -the Source, provided that you comply with Section 4 with respect to -the Source of the Modified Version. - - -Aggregating or Linking the Package - -(7) You may aggregate the Package (either the Standard Version or -Modified Version) with other packages and Distribute the resulting -aggregation provided that you do not charge a licensing fee for the -Package. Distributor Fees are permitted, and licensing fees for other -components in the aggregation are permitted. The terms of this license -apply to the use and Distribution of the Standard or Modified Versions -as included in the aggregation. - -(8) You are permitted to link Modified and Standard Versions with -other works, to embed the Package in a larger work of your own, or to -build stand-alone binary or bytecode versions of applications that -include the Package, and Distribute the result without restriction, -provided the result does not expose a direct interface to the Package. - - -Items That are Not Considered Part of a Modified Version - -(9) Works (including, but not limited to, modules and scripts) that -merely extend or make use of the Package, do not, by themselves, cause -the Package to be a Modified Version. In addition, such works are not -considered parts of the Package itself, and are not subject to the -terms of this license. - - -General Provisions - -(10) Any use, modification, and distribution of the Standard or -Modified Versions is governed by this Artistic License. By using, -modifying or distributing the Package, you accept this license. Do not -use, modify, or distribute the Package, if you do not accept this -license. - -(11) If your Modified Version has been derived from a Modified -Version made by someone other than you, you are nevertheless required -to ensure that your Modified Version complies with the requirements of -this license. - -(12) This license does not grant you the right to use any trademark, -service mark, tradename, or logo of the Copyright Holder. - -(13) This license includes the non-exclusive, worldwide, -free-of-charge patent license to make, have made, use, offer to sell, -sell, import and otherwise transfer the Package with respect to any -patent claims licensable by the Copyright Holder that are necessarily -infringed by the Package. If you institute patent litigation -(including a cross-claim or counterclaim) against any party alleging -that the Package constitutes direct or contributory patent -infringement, then this Artistic License to you shall terminate on the -date that such litigation is filed. - -(14) Disclaimer of Warranty: -THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS -IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL -LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ChangeLog b/ChangeLog index a2fba10..2b76f9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ + # Changelog ## [0.10.0] - 14 Apr 2021 diff --git a/LICENSES/Artistic-2.0.txt b/LICENSES/Artistic-2.0.txt new file mode 100644 index 0000000..eb2e968 --- /dev/null +++ b/LICENSES/Artistic-2.0.txt @@ -0,0 +1,85 @@ +The Artistic License 2.0 + +Copyright (c) 2000-2006, The Perl Foundation. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software. + +You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement. + +Definitions + + "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package. + + "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures. + + "You" and "your" means any person who would like to copy, distribute, or modify the Package. + + "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version. + + "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization. + + "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees. + + "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder. + + "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder. + + "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future. + + "Source" form means the source code, documentation source, and configuration files for the Package. + + "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form. + +Permission for Use and Modification Without Distribution + +(1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version. + +Permissions for Redistribution of the Standard Version + +(2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package. + +(3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License. + +Distribution of Modified Versions of the Package as Source + +(4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following: + + (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version. + (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version. + (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under + + (i) the Original License or + (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed. + +Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source + +(5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license. + +(6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version. + +Aggregating or Linking the Package + +(7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation. + +(8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package. + +Items That are Not Considered Part of a Modified Version + +(9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license. + +General Provisions + +(10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license. + +(11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license. + +(12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder. + +(13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed. + +(14) Disclaimer of Warranty: +THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSES/CC0-1.0.txt b/LICENSES/CC0-1.0.txt new file mode 100644 index 0000000..0e259d4 --- /dev/null +++ b/LICENSES/CC0-1.0.txt @@ -0,0 +1,121 @@ +Creative Commons Legal Code + +CC0 1.0 Universal + + CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE + LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN + ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS + INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES + REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS + PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM + THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED + HEREUNDER. + +Statement of Purpose + +The laws of most jurisdictions throughout the world automatically confer +exclusive Copyright and Related Rights (defined below) upon the creator +and subsequent owner(s) (each and all, an "owner") of an original work of +authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for +the purpose of contributing to a commons of creative, cultural and +scientific works ("Commons") that the public can reliably and without fear +of later claims of infringement build upon, modify, incorporate in other +works, reuse and redistribute as freely as possible in any form whatsoever +and for any purposes, including without limitation commercial purposes. +These owners may contribute to the Commons to promote the ideal of a free +culture and the further production of creative, cultural and scientific +works, or to gain reputation or greater distribution for their Work in +part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any +expectation of additional consideration or compensation, the person +associating CC0 with a Work (the "Affirmer"), to the extent that he or she +is an owner of Copyright and Related Rights in the Work, voluntarily +elects to apply CC0 to the Work and publicly distribute the Work under its +terms, with knowledge of his or her Copyright and Related Rights in the +Work and the meaning and intended legal effect of CC0 on those rights. + +1. Copyright and Related Rights. A Work made available under CC0 may be +protected by copyright and related or neighboring rights ("Copyright and +Related Rights"). Copyright and Related Rights include, but are not +limited to, the following: + + i. the right to reproduce, adapt, distribute, perform, display, + communicate, and translate a Work; + ii. moral rights retained by the original author(s) and/or performer(s); +iii. publicity and privacy rights pertaining to a person's image or + likeness depicted in a Work; + iv. rights protecting against unfair competition in regards to a Work, + subject to the limitations in paragraph 4(a), below; + v. rights protecting the extraction, dissemination, use and reuse of data + in a Work; + vi. database rights (such as those arising under Directive 96/9/EC of the + European Parliament and of the Council of 11 March 1996 on the legal + protection of databases, and under any national implementation + thereof, including any amended or successor version of such + directive); and +vii. other similar, equivalent or corresponding rights throughout the + world based on applicable law or treaty, and any national + implementations thereof. + +2. Waiver. To the greatest extent permitted by, but not in contravention +of, applicable law, Affirmer hereby overtly, fully, permanently, +irrevocably and unconditionally waives, abandons, and surrenders all of +Affirmer's Copyright and Related Rights and associated claims and causes +of action, whether now known or unknown (including existing as well as +future claims and causes of action), in the Work (i) in all territories +worldwide, (ii) for the maximum duration provided by applicable law or +treaty (including future time extensions), (iii) in any current or future +medium and for any number of copies, and (iv) for any purpose whatsoever, +including without limitation commercial, advertising or promotional +purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each +member of the public at large and to the detriment of Affirmer's heirs and +successors, fully intending that such Waiver shall not be subject to +revocation, rescission, cancellation, termination, or any other legal or +equitable action to disrupt the quiet enjoyment of the Work by the public +as contemplated by Affirmer's express Statement of Purpose. + +3. Public License Fallback. Should any part of the Waiver for any reason +be judged legally invalid or ineffective under applicable law, then the +Waiver shall be preserved to the maximum extent permitted taking into +account Affirmer's express Statement of Purpose. In addition, to the +extent the Waiver is so judged Affirmer hereby grants to each affected +person a royalty-free, non transferable, non sublicensable, non exclusive, +irrevocable and unconditional license to exercise Affirmer's Copyright and +Related Rights in the Work (i) in all territories worldwide, (ii) for the +maximum duration provided by applicable law or treaty (including future +time extensions), (iii) in any current or future medium and for any number +of copies, and (iv) for any purpose whatsoever, including without +limitation commercial, advertising or promotional purposes (the +"License"). The License shall be deemed effective as of the date CC0 was +applied by Affirmer to the Work. Should any part of the License for any +reason be judged legally invalid or ineffective under applicable law, such +partial invalidity or ineffectiveness shall not invalidate the remainder +of the License, and in such case Affirmer hereby affirms that he or she +will not (i) exercise any of his or her remaining Copyright and Related +Rights in the Work or (ii) assert any associated claims and causes of +action with respect to the Work, in either case contrary to Affirmer's +express Statement of Purpose. + +4. Limitations and Disclaimers. + + a. No trademark or patent rights held by Affirmer are waived, abandoned, + surrendered, licensed or otherwise affected by this document. + b. Affirmer offers the Work as-is and makes no representations or + warranties of any kind concerning the Work, express, implied, + statutory or otherwise, including without limitation warranties of + title, merchantability, fitness for a particular purpose, non + infringement, or the absence of latent or other defects, accuracy, or + the present or absence of errors, whether or not discoverable, all to + the greatest extent permissible under applicable law. + c. Affirmer disclaims responsibility for clearing rights of other persons + that may apply to the Work or any use thereof, including without + limitation any person's Copyright and Related Rights in the Work. + Further, Affirmer disclaims responsibility for obtaining any necessary + consents, permissions or other rights required for any use of the + Work. + d. Affirmer understands and acknowledges that Creative Commons is not a + party to this document and has no duty or obligation with respect to + this CC0 or use of the Work. diff --git a/README.md b/README.md index e23fe05..79fab1f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ + ## Shells Bells ### A just-for-fun LV2 plugin bundle +[![builds.sr.ht status](https://builds.open-music-kontrollers.ch/~hp/shells_bells.lv2.svg)](https://builds.open-music-kontrollers.ch/~hp/shells_bells.lv2?) + The most limited, useless, hackable and fun plugin bundle ever. Sound the bell in the shell (or from any program forked from the latter) to send a MIDI note. diff --git a/VERSION b/VERSION deleted file mode 100644 index 4aa0906..0000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.11.15 diff --git a/gitlab-ci/generic.yml b/gitlab-ci/generic.yml deleted file mode 100644 index 5cd2abc..0000000 --- a/gitlab-ci/generic.yml +++ /dev/null @@ -1,106 +0,0 @@ -stages: - - build - - deploy - -variables: - PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig:/usr/lib/${CI_BUILD_NAME}/pkgconfig" - BUILD_OPTS : "" - -.native_template: &native_definition - stage: build - script: - - meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} build - - ninja -C build - - ninja -C build test - - ninja -C build install - - - scan-build --status-bugs meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} scanbuild - - scan-build --status-bugs ninja -C scanbuild - - scan-build --status-bugs ninja -C scanbuild test - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)-${CI_BUILD_NAME}" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}/" - -.cross_template: &cross_definition - stage: build - script: - - meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} build - - ninja -C build - - ninja -C build test - - ninja -C build install - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)-${CI_BUILD_NAME}" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}/" - -# build -.universal_linux_template_stretch: &universal_linux_definition_stretch - image: ventosus/universal-linux-gnu:stretch - <<: *cross_definition - -.universal_linux_template_buster: &universal_linux_definition_buster - image: ventosus/universal-linux-gnu:buster - <<: *native_definition - -.universal_linux_template_bullseye: &universal_linux_definition_bullseye - image: ventosus/universal-linux-gnu:bullseye - <<: *native_definition - -.arm_linux_template_stretch: &arm_linux_definition_stretch - image: ventosus/arm-linux-gnueabihf:stretch - <<: *cross_definition - -.arm_linux_template_buster: &arm_linux_definition_buster - image: ventosus/arm-linux-gnueabihf:buster - <<: *cross_definition - -.arm_linux_template_bullseye: &arm_linux_definition_bullseye - image: ventosus/arm-linux-gnueabihf:bullseye - <<: *cross_definition - -# build -x86_64-linux-gnu-stretch: - <<: *universal_linux_definition_stretch - -x86_64-linux-gnu-buster: - <<: *universal_linux_definition_buster - -x86_64-linux-gnu-bullseye: - <<: *universal_linux_definition_bullseye - -i686-linux-gnu-stretch: - <<: *universal_linux_definition_stretch - -i686-linux-gnu-buster: - <<: *universal_linux_definition_buster - -i686-linux-gnu-bullseye: - <<: *universal_linux_definition_bullseye - -arm-linux-gnueabihf-stretch: - <<: *arm_linux_definition_stretch - -arm-linux-gnueabihf-buster: - <<: *arm_linux_definition_buster - -arm-linux-gnueabihf-bullseye: - <<: *arm_linux_definition_bullseye - -aarch64-linux-gnu-stretch: - <<: *arm_linux_definition_stretch - -aarch64-linux-gnu-buster: - <<: *arm_linux_definition_buster - -aarch64-linux-gnu-bullseye: - <<: *arm_linux_definition_bullseye - -pack: - stage: deploy - script: - - echo 'packing up' - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/" diff --git a/meson.build b/meson.build index 9643ca1..2665c9a 100644 --- a/meson.build +++ b/meson.build @@ -1,11 +1,16 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + project('shells_bells.lv2', 'c', default_options : [ 'buildtype=release', 'warning_level=3', 'werror=false', - 'b_lto=false', + 'b_lto=true', 'c_std=gnu11']) d2tk = subproject('d2tk') +ser_atom_lv2 = subproject('ser_atom.lv2') +props_lv2 = subproject('props.lv2') lv2libdir = get_option('lv2libdir') build_tests = get_option('build-tests') @@ -21,6 +26,8 @@ else error('no valid UI backend given') endif +ser_atom_lv2_dep = ser_atom_lv2.get_variable('ser_atom_lv2') +props_lv2_dep = props_lv2.get_variable('props_lv2') source_root = meson.source_root() build_root = meson.build_root() @@ -32,23 +39,22 @@ cc = meson.get_compiler('c') lv2_validate = find_program('lv2_validate', native : true, required : false) sord_validate = find_program('sord_validate', native : true, required : false) lv2lint = find_program('lv2lint', required : false) +reuse = find_program('reuse', required : false) lv2_dep = dependency('lv2', version : '>=1.14.0') -dsp_deps = [lv2_dep] -ui_deps = [lv2_dep, d2tk_dep] +dsp_deps = [lv2_dep, props_lv2_dep] +ui_deps = [lv2_dep, d2tk_dep, ser_atom_lv2_dep, props_lv2_dep] -props_inc = include_directories('props.lv2') -ser_inc = include_directories('ser_atom.lv2') -inc_dir = [props_inc, ser_inc] +inc_dir = [] -dsp_srcs = ['shells_bells.c'] +dsp_srcs = [join_paths('src', 'shells_bells.c')] -ui_srcs = ['shells_bells_ui.c'] +ui_srcs = [join_paths('src', 'shells_bells_ui.c')] c_args = ['-fvisibility=hidden'] -version = run_command('cat', 'VERSION').stdout().strip().split('.') +version = get_option('version').split('.') add_project_arguments('-DSHELLS_BELLS_VERSION="' + version[0] + '.' + version[1] + '.' + version[2] + '"', language : 'c') conf_data.set('MAJOR_VERSION', version[0]) @@ -75,21 +81,21 @@ suffix = mod.full_path().strip().split('.')[-1] conf_data.set('MODULE_SUFFIX', '.' + suffix) manifest_ttl = configure_file( - input : 'manifest.ttl.in', + input : join_paths('ttl', 'manifest.ttl.in'), output : 'manifest.ttl', configuration : conf_data, install : true, install_dir : inst_dir) dsp_ttl = configure_file( - input : 'shells_bells.ttl.in', + input : join_paths('ttl', 'shells_bells.ttl.in'), output : 'shells_bells.ttl', configuration : conf_data, install : true, install_dir : inst_dir) ui_ttl = configure_file( - input : 'shells_bells_ui.ttl', + input : join_paths('ttl', 'shells_bells_ui.ttl'), output : 'shells_bells_ui.ttl', copy: true, install : true, @@ -148,4 +154,11 @@ if build_tests 'http://open-music-kontrollers.ch/lv2/shells_bells#bells' ]) endif + + if reuse.found() and not meson.is_cross_build() + test('REUSE', reuse, args : [ + '--root', source_root, + 'lint' + ]) + endif endif diff --git a/meson_options.txt b/meson_options.txt index 016e54b..7049c6b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + option('build-debug-overlay', type : 'boolean', value : false) @@ -23,3 +26,5 @@ option('use-fontconfig', option('lv2libdir', type : 'string', value : 'lib/lv2') + +option('version', type : 'string', value : '0.11.15') diff --git a/props.lv2/.gitlab-ci.yml b/props.lv2/.gitlab-ci.yml deleted file mode 100644 index 979769c..0000000 --- a/props.lv2/.gitlab-ci.yml +++ /dev/null @@ -1,2 +0,0 @@ -include: - - local: 'gitlab-ci/generic.yml' diff --git a/props.lv2/COPYING b/props.lv2/COPYING deleted file mode 100644 index ddb9a46..0000000 --- a/props.lv2/COPYING +++ /dev/null @@ -1,201 +0,0 @@ - The Artistic License 2.0 - - Copyright (c) 2000-2006, The Perl Foundation. - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble - -This license establishes the terms under which a given free software -Package may be copied, modified, distributed, and/or redistributed. -The intent is that the Copyright Holder maintains some artistic -control over the development of that Package while still keeping the -Package available as open source and free software. - -You are always permitted to make arrangements wholly outside of this -license directly with the Copyright Holder of a given Package. If the -terms of this license do not permit the full use that you propose to -make of the Package, you should contact the Copyright Holder and seek -a different licensing arrangement. - -Definitions - - "Copyright Holder" means the individual(s) or organization(s) - named in the copyright notice for the entire Package. - - "Contributor" means any party that has contributed code or other - material to the Package, in accordance with the Copyright Holder's - procedures. - - "You" and "your" means any person who would like to copy, - distribute, or modify the Package. - - "Package" means the collection of files distributed by the - Copyright Holder, and derivatives of that collection and/or of - those files. A given Package may consist of either the Standard - Version, or a Modified Version. - - "Distribute" means providing a copy of the Package or making it - accessible to anyone else, or in the case of a company or - organization, to others outside of your company or organization. - - "Distributor Fee" means any fee that you charge for Distributing - this Package or providing support for this Package to another - party. It does not mean licensing fees. - - "Standard Version" refers to the Package if it has not been - modified, or has been modified only in ways explicitly requested - by the Copyright Holder. - - "Modified Version" means the Package, if it has been changed, and - such changes were not explicitly requested by the Copyright - Holder. - - "Original License" means this Artistic License as Distributed with - the Standard Version of the Package, in its current version or as - it may be modified by The Perl Foundation in the future. - - "Source" form means the source code, documentation source, and - configuration files for the Package. - - "Compiled" form means the compiled bytecode, object code, binary, - or any other form resulting from mechanical transformation or - translation of the Source form. - - -Permission for Use and Modification Without Distribution - -(1) You are permitted to use the Standard Version and create and use -Modified Versions for any purpose without restriction, provided that -you do not Distribute the Modified Version. - - -Permissions for Redistribution of the Standard Version - -(2) You may Distribute verbatim copies of the Source form of the -Standard Version of this Package in any medium without restriction, -either gratis or for a Distributor Fee, provided that you duplicate -all of the original copyright notices and associated disclaimers. At -your discretion, such verbatim copies may or may not include a -Compiled form of the Package. - -(3) You may apply any bug fixes, portability changes, and other -modifications made available from the Copyright Holder. The resulting -Package will still be considered the Standard Version, and as such -will be subject to the Original License. - - -Distribution of Modified Versions of the Package as Source - -(4) You may Distribute your Modified Version as Source (either gratis -or for a Distributor Fee, and with or without a Compiled form of the -Modified Version) provided that you clearly document how it differs -from the Standard Version, including, but not limited to, documenting -any non-standard features, executables, or modules, and provided that -you do at least ONE of the following: - - (a) make the Modified Version available to the Copyright Holder - of the Standard Version, under the Original License, so that the - Copyright Holder may include your modifications in the Standard - Version. - - (b) ensure that installation of your Modified Version does not - prevent the user installing or running the Standard Version. In - addition, the Modified Version must bear a name that is different - from the name of the Standard Version. - - (c) allow anyone who receives a copy of the Modified Version to - make the Source form of the Modified Version available to others - under - - (i) the Original License or - - (ii) a license that permits the licensee to freely copy, - modify and redistribute the Modified Version using the same - licensing terms that apply to the copy that the licensee - received, and requires that the Source form of the Modified - Version, and of any works derived from it, be made freely - available in that license fees are prohibited but Distributor - Fees are allowed. - - -Distribution of Compiled Forms of the Standard Version -or Modified Versions without the Source - -(5) You may Distribute Compiled forms of the Standard Version without -the Source, provided that you include complete instructions on how to -get the Source of the Standard Version. Such instructions must be -valid at the time of your distribution. If these instructions, at any -time while you are carrying out such distribution, become invalid, you -must provide new instructions on demand or cease further distribution. -If you provide valid instructions or cease distribution within thirty -days after you become aware that the instructions are invalid, then -you do not forfeit any of your rights under this license. - -(6) You may Distribute a Modified Version in Compiled form without -the Source, provided that you comply with Section 4 with respect to -the Source of the Modified Version. - - -Aggregating or Linking the Package - -(7) You may aggregate the Package (either the Standard Version or -Modified Version) with other packages and Distribute the resulting -aggregation provided that you do not charge a licensing fee for the -Package. Distributor Fees are permitted, and licensing fees for other -components in the aggregation are permitted. The terms of this license -apply to the use and Distribution of the Standard or Modified Versions -as included in the aggregation. - -(8) You are permitted to link Modified and Standard Versions with -other works, to embed the Package in a larger work of your own, or to -build stand-alone binary or bytecode versions of applications that -include the Package, and Distribute the result without restriction, -provided the result does not expose a direct interface to the Package. - - -Items That are Not Considered Part of a Modified Version - -(9) Works (including, but not limited to, modules and scripts) that -merely extend or make use of the Package, do not, by themselves, cause -the Package to be a Modified Version. In addition, such works are not -considered parts of the Package itself, and are not subject to the -terms of this license. - - -General Provisions - -(10) Any use, modification, and distribution of the Standard or -Modified Versions is governed by this Artistic License. By using, -modifying or distributing the Package, you accept this license. Do not -use, modify, or distribute the Package, if you do not accept this -license. - -(11) If your Modified Version has been derived from a Modified -Version made by someone other than you, you are nevertheless required -to ensure that your Modified Version complies with the requirements of -this license. - -(12) This license does not grant you the right to use any trademark, -service mark, tradename, or logo of the Copyright Holder. - -(13) This license includes the non-exclusive, worldwide, -free-of-charge patent license to make, have made, use, offer to sell, -sell, import and otherwise transfer the Package with respect to any -patent claims licensable by the Copyright Holder that are necessarily -infringed by the Package. If you institute patent litigation -(including a cross-claim or counterclaim) against any party alleging -that the Package constitutes direct or contributory patent -infringement, then this Artistic License to you shall terminate on the -date that such litigation is filed. - -(14) Disclaimer of Warranty: -THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS -IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL -LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/props.lv2/README.md b/props.lv2/README.md deleted file mode 100644 index 08466d2..0000000 --- a/props.lv2/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Props.lv2 - -## Utility header for property based LV2 plugins - -### License - -Copyright (c) 2015 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 -. diff --git a/props.lv2/VERSION b/props.lv2/VERSION deleted file mode 100644 index 5130959..0000000 --- a/props.lv2/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.165 diff --git a/props.lv2/gitlab-ci/generic.yml b/props.lv2/gitlab-ci/generic.yml deleted file mode 100644 index 5cd2abc..0000000 --- a/props.lv2/gitlab-ci/generic.yml +++ /dev/null @@ -1,106 +0,0 @@ -stages: - - build - - deploy - -variables: - PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig:/usr/lib/${CI_BUILD_NAME}/pkgconfig" - BUILD_OPTS : "" - -.native_template: &native_definition - stage: build - script: - - meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} build - - ninja -C build - - ninja -C build test - - ninja -C build install - - - scan-build --status-bugs meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} scanbuild - - scan-build --status-bugs ninja -C scanbuild - - scan-build --status-bugs ninja -C scanbuild test - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)-${CI_BUILD_NAME}" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}/" - -.cross_template: &cross_definition - stage: build - script: - - meson --prefix="${CI_PROJECT_DIR}/${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}" -Dlv2libdir="" --cross-file "${CI_BUILD_NAME}" ${BUILD_OPTS} build - - ninja -C build - - ninja -C build test - - ninja -C build install - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)-${CI_BUILD_NAME}" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/${CI_BUILD_NAME}/" - -# build -.universal_linux_template_stretch: &universal_linux_definition_stretch - image: ventosus/universal-linux-gnu:stretch - <<: *cross_definition - -.universal_linux_template_buster: &universal_linux_definition_buster - image: ventosus/universal-linux-gnu:buster - <<: *native_definition - -.universal_linux_template_bullseye: &universal_linux_definition_bullseye - image: ventosus/universal-linux-gnu:bullseye - <<: *native_definition - -.arm_linux_template_stretch: &arm_linux_definition_stretch - image: ventosus/arm-linux-gnueabihf:stretch - <<: *cross_definition - -.arm_linux_template_buster: &arm_linux_definition_buster - image: ventosus/arm-linux-gnueabihf:buster - <<: *cross_definition - -.arm_linux_template_bullseye: &arm_linux_definition_bullseye - image: ventosus/arm-linux-gnueabihf:bullseye - <<: *cross_definition - -# build -x86_64-linux-gnu-stretch: - <<: *universal_linux_definition_stretch - -x86_64-linux-gnu-buster: - <<: *universal_linux_definition_buster - -x86_64-linux-gnu-bullseye: - <<: *universal_linux_definition_bullseye - -i686-linux-gnu-stretch: - <<: *universal_linux_definition_stretch - -i686-linux-gnu-buster: - <<: *universal_linux_definition_buster - -i686-linux-gnu-bullseye: - <<: *universal_linux_definition_bullseye - -arm-linux-gnueabihf-stretch: - <<: *arm_linux_definition_stretch - -arm-linux-gnueabihf-buster: - <<: *arm_linux_definition_buster - -arm-linux-gnueabihf-bullseye: - <<: *arm_linux_definition_bullseye - -aarch64-linux-gnu-stretch: - <<: *arm_linux_definition_stretch - -aarch64-linux-gnu-buster: - <<: *arm_linux_definition_buster - -aarch64-linux-gnu-bullseye: - <<: *arm_linux_definition_bullseye - -pack: - stage: deploy - script: - - echo 'packing up' - artifacts: - name: "${CI_PROJECT_NAME}-$(cat VERSION)" - paths: - - "${CI_PROJECT_NAME}-$(cat VERSION)/" diff --git a/props.lv2/meson.build b/props.lv2/meson.build deleted file mode 100644 index d354d89..0000000 --- a/props.lv2/meson.build +++ /dev/null @@ -1,82 +0,0 @@ -project('props.lv2', 'c', default_options : [ - 'buildtype=release', - 'warning_level=3', - 'werror=false', - 'b_lto=false', - 'c_std=c11']) - -add_project_arguments('-D_GNU_SOURCE', language : 'c') - -conf_data = configuration_data() -cc = meson.get_compiler('c') - -cp = find_program('cp') -lv2_validate = find_program('lv2_validate', native : true, required : false) -sord_validate = find_program('sord_validate', native : true, required : false) -lv2lint = find_program('lv2lint', required : false) -clone = [cp, '@INPUT@', '@OUTPUT@'] - -m_dep = cc.find_library('m') -lv2_dep = dependency('lv2', version : '>=1.14.0') - -inc_dir = [] - -inst_dir = join_paths(get_option('libdir'), 'lv2', meson.project_name()) - -dsp_srcs = [join_paths('test', 'props.c')] - -c_args = ['-fvisibility=hidden', - '-ffast-math'] - -mod = shared_module('props', dsp_srcs, - c_args : c_args, - include_directories : inc_dir, - name_prefix : '', - dependencies : [m_dep, lv2_dep], - install : true, - install_dir : inst_dir) - -version = run_command('cat', 'VERSION').stdout().strip().split('.') -conf_data.set('MAJOR_VERSION', version[0]) -conf_data.set('MINOR_VERSION', version[1]) -conf_data.set('MICRO_VERSION', version[2]) - -suffix = mod.full_path().strip().split('.')[-1] -conf_data.set('MODULE_SUFFIX', '.' + suffix) - -manifest_ttl = configure_file( - input : join_paths('test', 'manifest.ttl.in'), output : 'manifest.ttl', - configuration : conf_data, - install : true, - install_dir : inst_dir) -dsp_ttl = custom_target('props_ttl', - input : join_paths('test', 'props.ttl'), - output : 'props.ttl', - command : clone, - install : true, - install_dir : inst_dir) -custom_target('chunk_bin', - input : join_paths('test', 'chunk.bin'), - output : 'chunk.bin', - command : clone, - install : true, - install_dir : inst_dir) - -props_test = executable('props_test', - join_paths('test', 'props_test.c'), - c_args : c_args, - install : false) - -test('Test', props_test, - timeout : 240) - -if lv2_validate.found() and sord_validate.found() - test('LV2 validate', lv2_validate, - args : [manifest_ttl, dsp_ttl]) -endif - -if lv2lint.found() - test('LV2 lint', lv2lint, - args : ['-Ewarn', - 'http://open-music-kontrollers.ch/lv2/props#test']) -endif diff --git a/props.lv2/props.h b/props.lv2/props.h deleted file mode 100644 index b3905ab..0000000 --- a/props.lv2/props.h +++ /dev/null @@ -1,1226 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#ifndef _LV2_PROPS_H_ -#define _LV2_PROPS_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/***************************************************************************** - * API START - *****************************************************************************/ - -// structures -typedef struct _props_def_t props_def_t; -typedef struct _props_impl_t props_impl_t; -typedef struct _props_dyn_t props_dyn_t; -typedef struct _props_t props_t; - -typedef enum _props_dyn_ev_t { - PROPS_DYN_EV_ADD, - PROPS_DYN_EV_REM, - PROPS_DYN_EV_SET -} props_dyn_ev_t; - -// function callbacks -typedef void (*props_event_cb_t)( - void *data, - int64_t frames, - props_impl_t *impl); - -typedef void (*props_dyn_prop_cb_t)( - void *data, - props_dyn_ev_t ev, - LV2_URID subj, - LV2_URID prop, - const LV2_Atom *body); - -struct _props_def_t { - const char *property; - const char *type; - const char *access; - size_t offset; - bool hidden; - - uint32_t max_size; - props_event_cb_t event_cb; -}; - -struct _props_impl_t { - LV2_URID property; - LV2_URID type; - LV2_URID access; - - struct { - uint32_t size; - void *body; - } value; - struct { - uint32_t size; - void *body; - } stash; - - const props_def_t *def; - - atomic_int state; - bool stashing; -}; - -struct _props_dyn_t { - props_dyn_prop_cb_t prop; -}; - -struct _props_t { - struct { - LV2_URID subject; - - LV2_URID patch_get; - LV2_URID patch_set; - LV2_URID patch_put; - LV2_URID patch_patch; - LV2_URID patch_wildcard; - LV2_URID patch_add; - LV2_URID patch_remove; - LV2_URID patch_subject; - LV2_URID patch_body; - LV2_URID patch_property; - LV2_URID patch_value; - LV2_URID patch_writable; - LV2_URID patch_readable; - LV2_URID patch_sequence; - LV2_URID patch_error; - LV2_URID patch_ack; - - LV2_URID atom_int; - LV2_URID atom_long; - LV2_URID atom_float; - LV2_URID atom_double; - LV2_URID atom_bool; - LV2_URID atom_urid; - LV2_URID atom_path; - LV2_URID atom_literal; - LV2_URID atom_vector; - LV2_URID atom_object; - LV2_URID atom_sequence; - - LV2_URID state_StateChanged; - } urid; - - void *data; - - bool stashing; - atomic_bool restoring; - - uint32_t max_size; - - const props_dyn_t *dyn; - - unsigned nimpls; - props_impl_t impls [1]; -}; - -#define PROPS_T(PROPS, MAX_NIMPLS) \ - props_t (PROPS); \ - props_impl_t _impls [MAX_NIMPLS] - -// rt-safe -static inline int -props_init(props_t *props, const char *subject, - const props_def_t *defs, int nimpls, - void *value_base, void *stash_base, - LV2_URID_Map *map, void *data); - -// rt-safe -static inline void -props_dyn(props_t *props, const props_dyn_t *dyn); - -// rt-safe -static inline void -props_idle(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_Atom_Forge_Ref *ref); - -// rt-safe -static inline int -props_advance(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - const LV2_Atom_Object *obj, LV2_Atom_Forge_Ref *ref); - -// rt-safe -static inline void -props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_URID property, LV2_Atom_Forge_Ref *ref); - -// rt-safe -static inline void -props_get(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_URID property, LV2_Atom_Forge_Ref *ref); - -// rt-safe -static inline void -props_stash(props_t *props, LV2_URID property); - -// rt-safe -static inline LV2_URID -props_map(props_t *props, const char *property); - -// rt-safe -static inline const char * -props_unmap(props_t *props, LV2_URID property); - -// non-rt -static inline LV2_State_Status -props_save(props_t *props, LV2_State_Store_Function store, - LV2_State_Handle state, uint32_t flags, const LV2_Feature *const *features); - -// non-rt -static inline LV2_State_Status -props_restore(props_t *props, LV2_State_Retrieve_Function retrieve, - LV2_State_Handle state, uint32_t flags, const LV2_Feature *const *features); - -/***************************************************************************** - * API END - *****************************************************************************/ - -// enumerations -typedef enum _props_state_t { - PROP_STATE_NONE = 0, - PROP_STATE_LOCK = 1, - PROP_STATE_RESTORE = 2 -} props_state_t; - -static inline void -_props_impl_spin_lock(props_impl_t *impl, int from, int to) -{ - int expected = from; - const int desired = to; - - while(!atomic_compare_exchange_strong_explicit(&impl->state, &expected, desired, - memory_order_acquire, memory_order_acquire)) - { - // spin - } -} - -static inline bool -_props_impl_try_lock(props_impl_t *impl, int from, int to) -{ - int expected = from; - const int desired = to; - - return atomic_compare_exchange_strong_explicit(&impl->state, &expected, desired, - memory_order_acquire, memory_order_acquire); -} - -static inline void -_props_impl_unlock(props_impl_t *impl, int to) -{ - atomic_store_explicit(&impl->state, to, memory_order_release); -} - -static inline bool -_props_restoring_get(props_t *props) -{ - return atomic_exchange_explicit(&props->restoring, false, memory_order_acquire); -} - -static inline void -_props_restoring_set(props_t *props) -{ - atomic_store_explicit(&props->restoring, true, memory_order_release); -} - -static inline void -_props_qsort(props_impl_t *A, int n) -{ - if(n < 2) - return; - - const props_impl_t *p = A; - - int i = -1; - int j = n; - - while(true) - { - do { - i += 1; - } while(A[i].property < p->property); - - do { - j -= 1; - } while(A[j].property > p->property); - - if(i >= j) - break; - - const props_impl_t tmp = A[i]; - A[i] = A[j]; - A[j] = tmp; - } - - _props_qsort(A, j + 1); - _props_qsort(A + j + 1, n - j - 1); -} - -static inline props_impl_t * -_props_impl_get(props_t *props, LV2_URID property) -{ - props_impl_t *base = props->impls; - - for(int N = props->nimpls, half; N > 1; N -= half) - { - half = N/2; - props_impl_t *dst = &base[half]; - base = (dst->property > property) ? base : dst; - } - - return (base->property == property) ? base : NULL; -} - -static inline LV2_Atom_Forge_Ref -_props_patch_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - props_impl_t *impl, int32_t sequence_num) -{ - LV2_Atom_Forge_Frame obj_frame; - - LV2_Atom_Forge_Ref ref = lv2_atom_forge_frame_time(forge, frames); - - if(ref) - ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.patch_set); - { - if(props->urid.subject) // is optional - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_subject); - if(ref) - ref = lv2_atom_forge_urid(forge, props->urid.subject); - } - - if(sequence_num) // is optional - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_sequence); - if(ref) - ref = lv2_atom_forge_int(forge, sequence_num); - } - - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_property); - if(ref) - ref = lv2_atom_forge_urid(forge, impl->property); - - if(ref) - lv2_atom_forge_key(forge, props->urid.patch_value); - if(ref) - ref = lv2_atom_forge_atom(forge, impl->value.size, impl->type); - if(ref) - ref = lv2_atom_forge_write(forge, impl->value.body, impl->value.size); - } - if(ref) - lv2_atom_forge_pop(forge, &obj_frame); - - if(ref) - ref = lv2_atom_forge_frame_time(forge, frames); - if(ref) - ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.state_StateChanged); - if(ref) - lv2_atom_forge_pop(forge, &obj_frame); - - return ref; -} - -static inline LV2_Atom_Forge_Ref -_props_patch_get(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - props_impl_t *impl, int32_t sequence_num) -{ - LV2_Atom_Forge_Frame obj_frame; - - LV2_Atom_Forge_Ref ref = lv2_atom_forge_frame_time(forge, frames); - - if(ref) - ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.patch_get); - { - if(props->urid.subject) // is optional - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_subject); - if(ref) - ref = lv2_atom_forge_urid(forge, props->urid.subject); - } - - if(sequence_num) // is optional - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_sequence); - if(ref) - ref = lv2_atom_forge_int(forge, sequence_num); - } - - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_property); - if(ref) - ref = lv2_atom_forge_urid(forge, impl->property); - } - if(ref) - lv2_atom_forge_pop(forge, &obj_frame); - - return ref; -} - -static inline LV2_Atom_Forge_Ref -_props_patch_error(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - int32_t sequence_num) -{ - LV2_Atom_Forge_Frame obj_frame; - - LV2_Atom_Forge_Ref ref = lv2_atom_forge_frame_time(forge, frames); - - if(ref) - ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.patch_error); - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_sequence); - if(ref) - ref = lv2_atom_forge_int(forge, sequence_num); - } - if(ref) - lv2_atom_forge_pop(forge, &obj_frame); - - return ref; -} - -static inline LV2_Atom_Forge_Ref -_props_patch_ack(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - int32_t sequence_num) -{ - LV2_Atom_Forge_Frame obj_frame; - - LV2_Atom_Forge_Ref ref = lv2_atom_forge_frame_time(forge, frames); - - if(ref) - ref = lv2_atom_forge_object(forge, &obj_frame, 0, props->urid.patch_ack); - { - if(ref) - ref = lv2_atom_forge_key(forge, props->urid.patch_sequence); - if(ref) - ref = lv2_atom_forge_int(forge, sequence_num); - } - if(ref) - lv2_atom_forge_pop(forge, &obj_frame); - - return ref; -} - -static inline void -_props_impl_stash(props_t *props, props_impl_t *impl) -{ - if(_props_impl_try_lock(impl, PROP_STATE_NONE, PROP_STATE_LOCK)) - { - impl->stashing = false; - impl->stash.size = impl->value.size; - memcpy(impl->stash.body, impl->value.body, impl->value.size); - - _props_impl_unlock(impl, PROP_STATE_NONE); - } - else - { - impl->stashing = true; // try again later - props->stashing = true; - } -} - -static inline void -_props_impl_restore(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - props_impl_t *impl, LV2_Atom_Forge_Ref *ref) -{ - if(_props_impl_try_lock(impl, PROP_STATE_RESTORE, PROP_STATE_LOCK)) - { - impl->stashing = false; // makes no sense to stash a recently restored value - impl->value.size = impl->stash.size; - memcpy(impl->value.body, impl->stash.body, impl->stash.size); - - _props_impl_unlock(impl, PROP_STATE_NONE); - - if(*ref && !impl->def->hidden) - *ref = _props_patch_set(props, forge, frames, impl, 0); - - const props_def_t *def = impl->def; - if(def->event_cb) - def->event_cb(props->data, 0, impl); - } -} - -static inline void -_props_impl_set(props_t *props, props_impl_t *impl, LV2_URID type, - uint32_t size, const void *body) -{ - if( (impl->type == type) - && ( (impl->def->max_size == 0) || (size <= impl->def->max_size)) ) - { - impl->value.size = size; - memcpy(impl->value.body, body, size); - - _props_impl_stash(props, impl); - } -} - -static inline int -_props_impl_init(props_t *props, props_impl_t *impl, const props_def_t *def, - void *value_base, void *stash_base, LV2_URID_Map *map) -{ - if(!def->property || !def->type) - return 0; - - const LV2_URID type = map->map(map->handle, def->type); - const LV2_URID property = map->map(map->handle, def->property); - const LV2_URID access = def->access - ? map->map(map->handle, def->access) - : map->map(map->handle, LV2_PATCH__writable); - - if(!type || !property || !access) - return 0; - - impl->property = property; - impl->access = access; - impl->def = def; - impl->value.body = (uint8_t *)value_base + def->offset; - impl->stash.body = (uint8_t *)stash_base + def->offset; - - uint32_t size; - if( (type == props->urid.atom_int) - || (type == props->urid.atom_float) - || (type == props->urid.atom_bool) - || (type == props->urid.atom_urid) ) - { - size = 4; - } - else if((type == props->urid.atom_long) - || (type == props->urid.atom_double) ) - { - size = 8; - } - else if(type == props->urid.atom_literal) - { - size = sizeof(LV2_Atom_Literal_Body); - } - else if(type == props->urid.atom_vector) - { - size = sizeof(LV2_Atom_Vector_Body); - } - else if(type == props->urid.atom_object) - { - size = sizeof(LV2_Atom_Object_Body); - } - else if(type == props->urid.atom_sequence) - { - size = sizeof(LV2_Atom_Sequence_Body); - } - else - { - size = 0; // assume everything else as having size 0 - } - - impl->type = type; - impl->value.size = size; - impl->stash.size = size; - - atomic_init(&impl->state, PROP_STATE_NONE); - - // update maximal value size - const uint32_t max_size = def->max_size - ? def->max_size - : size; - - if(max_size > props->max_size) - { - props->max_size = max_size; - } - - return 1; -} - -static inline int -props_init(props_t *props, const char *subject, - const props_def_t *defs, int nimpls, - void *value_base, void *stash_base, - LV2_URID_Map *map, void *data) -{ - if(!props || !defs || !value_base || !stash_base || !map) - return 0; - - props->nimpls = nimpls; - props->data = data; - - props->urid.subject = subject ? map->map(map->handle, subject) : 0; - - props->urid.patch_get = map->map(map->handle, LV2_PATCH__Get); - props->urid.patch_set = map->map(map->handle, LV2_PATCH__Set); - props->urid.patch_put = map->map(map->handle, LV2_PATCH__Put); - props->urid.patch_patch = map->map(map->handle, LV2_PATCH__Patch); - props->urid.patch_wildcard = map->map(map->handle, LV2_PATCH__wildcard); - props->urid.patch_add = map->map(map->handle, LV2_PATCH__add); - props->urid.patch_remove = map->map(map->handle, LV2_PATCH__remove); - props->urid.patch_subject = map->map(map->handle, LV2_PATCH__subject); - props->urid.patch_body = map->map(map->handle, LV2_PATCH__body); - props->urid.patch_property = map->map(map->handle, LV2_PATCH__property); - props->urid.patch_value = map->map(map->handle, LV2_PATCH__value); - props->urid.patch_writable = map->map(map->handle, LV2_PATCH__writable); - props->urid.patch_readable = map->map(map->handle, LV2_PATCH__readable); - props->urid.patch_sequence = map->map(map->handle, LV2_PATCH__sequenceNumber); - props->urid.patch_ack = map->map(map->handle, LV2_PATCH__Ack); - props->urid.patch_error = map->map(map->handle, LV2_PATCH__Error); - - props->urid.atom_int = map->map(map->handle, LV2_ATOM__Int); - props->urid.atom_long = map->map(map->handle, LV2_ATOM__Long); - props->urid.atom_float = map->map(map->handle, LV2_ATOM__Float); - props->urid.atom_double = map->map(map->handle, LV2_ATOM__Double); - props->urid.atom_bool = map->map(map->handle, LV2_ATOM__Bool); - props->urid.atom_urid = map->map(map->handle, LV2_ATOM__URID); - props->urid.atom_path = map->map(map->handle, LV2_ATOM__Path); - props->urid.atom_literal = map->map(map->handle, LV2_ATOM__Literal); - props->urid.atom_vector = map->map(map->handle, LV2_ATOM__Vector); - props->urid.atom_object = map->map(map->handle, LV2_ATOM__Object); - props->urid.atom_sequence = map->map(map->handle, LV2_ATOM__Sequence); - - props->urid.state_StateChanged = map->map(map->handle, LV2_STATE__StateChanged); - - atomic_init(&props->restoring, false); - - int status = 1; - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - status = status - && _props_impl_init(props, impl, &defs[i], value_base, stash_base, map); - } - - _props_qsort(props->impls, props->nimpls); - - return status; -} - -static inline void -props_dyn(props_t *props, const props_dyn_t *dyn) -{ - props->dyn = dyn; -} - -static inline void -props_idle(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_Atom_Forge_Ref *ref) -{ - if(_props_restoring_get(props)) - { - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - _props_impl_restore(props, forge, frames, impl, ref); - } - } - - if(props->stashing) - { - props->stashing = false; - - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - if(impl->stashing) - _props_impl_stash(props, impl); - } - } -} - -static inline int -props_advance(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - const LV2_Atom_Object *obj, LV2_Atom_Forge_Ref *ref) -{ - if(!lv2_atom_forge_is_object_type(forge, obj->atom.type)) - { - return 0; - } - - if(obj->body.otype == props->urid.patch_get) - { - const LV2_Atom_URID *subject = NULL; - const LV2_Atom_URID *property = NULL; - const LV2_Atom_Int *sequence = NULL; - - lv2_atom_object_get(obj, - props->urid.patch_subject, &subject, - props->urid.patch_property, &property, - props->urid.patch_sequence, &sequence, - 0); - - // check for a matching optional subject - if( (subject && props->urid.subject) - && ( (subject->atom.type != props->urid.atom_urid) - || (subject->body != props->urid.subject) ) ) - { - return 0; - } - - int32_t sequence_num = 0; - if(sequence && (sequence->atom.type == props->urid.atom_int)) - { - sequence_num = sequence->body; - } - - if(!property) - { - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - if(*ref && !impl->def->hidden) - *ref = _props_patch_set(props, forge, frames, impl, sequence_num); - } - - return 1; - } - else if(property->atom.type == props->urid.atom_urid) - { - props_impl_t *impl = _props_impl_get(props, property->body); - - if(impl) - { - if(*ref && !impl->def->hidden) - *ref = _props_patch_set(props, forge, frames, impl, sequence_num); - - return 1; - } - else if(sequence_num) - { - if(*ref) - *ref = _props_patch_error(props, forge, frames, sequence_num); - } - } - else if(sequence_num) - { - if(*ref) - *ref = _props_patch_error(props, forge, frames, sequence_num); - } - } - else if(obj->body.otype == props->urid.patch_set) - { - const LV2_Atom_URID *subject = NULL; - const LV2_Atom_URID *property = NULL; - const LV2_Atom_Int *sequence = NULL; - const LV2_Atom *value = NULL; - - lv2_atom_object_get(obj, - props->urid.patch_subject, &subject, - props->urid.patch_property, &property, - props->urid.patch_sequence, &sequence, - props->urid.patch_value, &value, - 0); - - // check for a matching optional subject - if( (subject && props->urid.subject) - && ( (subject->atom.type != props->urid.atom_urid) - || (subject->body != props->urid.subject) ) ) - { - return 0; - } - - int32_t sequence_num = 0; - if(sequence && (sequence->atom.type == props->urid.atom_int)) - { - sequence_num = sequence->body; - } - - if(!property || (property->atom.type != props->urid.atom_urid) || !value) - { - if(sequence_num) - { - if(ref) - *ref = _props_patch_error(props, forge, frames, sequence_num); - } - - return 0; - } - - props_impl_t *impl = _props_impl_get(props, property->body); - if(impl) - { - _props_impl_set(props, impl, value->type, value->size, - LV2_ATOM_BODY_CONST(value)); - - // send on (e.g. to UI) - if(*ref && !impl->def->hidden) - *ref = _props_patch_set(props, forge, frames, impl, sequence_num); - - const props_def_t *def = impl->def; - if(def->event_cb) - def->event_cb(props->data, frames, impl); - - if(sequence_num) - { - if(*ref) - *ref = _props_patch_ack(props, forge, frames, sequence_num); - } - - return 1; - } - else if(props->dyn && props->dyn->prop) - { - const LV2_URID subj = subject ? subject->body : 0; - - props->dyn->prop(props->data, PROPS_DYN_EV_SET, subj, property->body, value); - - //TODO send ack - } - else if(sequence_num) - { - if(*ref) - *ref = _props_patch_error(props, forge, frames, sequence_num); - } - } - else if(obj->body.otype == props->urid.patch_put) - { - const LV2_Atom_URID *subject = NULL; - const LV2_Atom_Int *sequence = NULL; - const LV2_Atom_Object *body = NULL; - - lv2_atom_object_get(obj, - props->urid.patch_subject, &subject, - props->urid.patch_sequence, &sequence, - props->urid.patch_body, &body, - 0); - - // check for a matching optional subject - if( (subject && props->urid.subject) - && ( (subject->atom.type != props->urid.atom_urid) - || (subject->body != props->urid.subject) ) ) - { - return 0; - } - - int32_t sequence_num = 0; - if(sequence && (sequence->atom.type == props->urid.atom_int)) - { - sequence_num = sequence->body; - } - - if(!body || !lv2_atom_forge_is_object_type(forge, body->atom.type)) - { - if(sequence_num) - { - if(*ref) - *ref = _props_patch_error(props, forge, frames, sequence_num); - } - - return 0; - } - - LV2_ATOM_OBJECT_FOREACH(body, prop) - { - const LV2_URID property = prop->key; - const LV2_Atom *value = &prop->value; - - props_impl_t *impl = _props_impl_get(props, property); - if(impl) - { - _props_impl_set(props, impl, value->type, value->size, - LV2_ATOM_BODY_CONST(value)); - - // send on (e.g. to UI) - if(*ref && !impl->def->hidden) - *ref = _props_patch_set(props, forge, frames, impl, sequence_num); - - const props_def_t *def = impl->def; - if(def->event_cb) - def->event_cb(props->data, frames, impl); - } - else if(props->dyn && props->dyn->prop) - { - const LV2_URID subj = subject ? subject->body : 0; - - props->dyn->prop(props->data, PROPS_DYN_EV_SET, subj, property, value); - - //TODO send ack - } - } - - if(sequence_num) - { - if(*ref) - *ref = _props_patch_ack(props, forge, frames, sequence_num); - } - - return 1; - } - else if(obj->body.otype == props->urid.patch_patch) - { - const LV2_Atom_URID *subject = NULL; - const LV2_Atom_Int *sequence = NULL; - const LV2_Atom_Object *add = NULL; - const LV2_Atom_Object *rem = NULL; - - lv2_atom_object_get(obj, - props->urid.patch_subject, &subject, - props->urid.patch_sequence, &sequence, - props->urid.patch_add, &add, - props->urid.patch_remove, &rem, - 0); - - LV2_URID subj = 0; - if(subject && (subject->atom.type == props->urid.atom_urid)) - { - subj = subject->body; - } - - int32_t sequence_num = 0; - if(sequence && (sequence->atom.type == props->urid.atom_int)) - { - sequence_num = sequence->body; - } - - if(rem && lv2_atom_forge_is_object_type(forge, rem->atom.type)) - { - LV2_ATOM_OBJECT_FOREACH(rem, prop) - { - const LV2_URID property = prop->key; - const LV2_Atom *value = &prop->value; - - if(props->dyn && props->dyn->prop) - { - props->dyn->prop(props->data, PROPS_DYN_EV_REM, subj, property, value); - } - } - } - - if(add && lv2_atom_forge_is_object_type(forge, add->atom.type)) - { - LV2_ATOM_OBJECT_FOREACH(add, prop) - { - const LV2_URID property = prop->key; - const LV2_Atom *value = &prop->value; - - if(props->dyn && props->dyn->prop) - { - props->dyn->prop(props->data, PROPS_DYN_EV_ADD, subj, property, value); - } - } - } - - if(sequence_num && *ref) - { - *ref = _props_patch_ack(props, forge, frames, sequence_num); - } - - return 1; - } - - return 0; // did not handle a patch event -} - -static inline void -props_set(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_URID property, LV2_Atom_Forge_Ref *ref) -{ - props_impl_t *impl = _props_impl_get(props, property); - - if(impl) - { - _props_impl_stash(props, impl); - - if(*ref && !impl->def->hidden) //TODO use patch:sequenceNumber - *ref = _props_patch_set(props, forge, frames, impl, 0); - } -} - -static inline void -props_get(props_t *props, LV2_Atom_Forge *forge, uint32_t frames, - LV2_URID property, LV2_Atom_Forge_Ref *ref) -{ - props_impl_t *impl = _props_impl_get(props, property); - - if(impl) - { - if(*ref && !impl->def->hidden) //TODO use patch:sequenceNumber - *ref = _props_patch_get(props, forge, frames, impl, 0); - } -} - -static inline void -props_stash(props_t *props, LV2_URID property) -{ - props_impl_t *impl = _props_impl_get(props, property); - - if(impl) - _props_impl_stash(props, impl); -} - -static inline LV2_URID -props_map(props_t *props, const char *uri) -{ - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - if(!strcmp(impl->def->property, uri)) - return impl->property; - } - - return 0; -} - -static inline const char * -props_unmap(props_t *props, LV2_URID property) -{ - props_impl_t *impl = _props_impl_get(props, property); - - if(impl) - return impl->def->property; - - return NULL; -} - -static inline int -_copy_file(const char *to, const char *from) -{ - FILE *dst = NULL; - FILE *src = NULL; - int ch; - - dst = fopen(to, "wb"); - if(!dst) - { - return 1; - } - - src = fopen(from, "rb"); - if(!src) - { - fclose(dst); - - return 1; - } - - while( (ch = fgetc(src)) != EOF) - { - fputc(ch, dst); - } - - fclose(dst); - fclose(src); - - return 0; -} - -static inline void -_free_path(const LV2_State_Free_Path *free_path, char *path) -{ - if(free_path && free_path->free_path) - { - free_path->free_path(free_path->handle, path); - } - else - { - free(path); - } -} - -static inline LV2_State_Status -props_save(props_t *props, LV2_State_Store_Function store, - LV2_State_Handle state, uint32_t flags, const LV2_Feature *const *features) -{ - const LV2_State_Map_Path *map_path = NULL; - const LV2_State_Make_Path *make_path = NULL; - const LV2_State_Free_Path *free_path = NULL; - - // set POD flag if not already set by host - flags |= LV2_STATE_IS_POD; - - for(unsigned i = 0; features[i]; i++) - { - if(!strcmp(features[i]->URI, LV2_STATE__mapPath)) - { - map_path = features[i]->data; - } - else if(!strcmp(features[i]->URI, LV2_STATE__makePath)) - { - make_path = features[i]->data; - } - else if(!strcmp(features[i]->URI, LV2_STATE__freePath)) - { - free_path = features[i]->data; - } - } - - void *body = malloc(props->max_size); // create memory to store widest value - if(body) - { - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - if(impl->access == props->urid.patch_readable) - continue; // skip read-only, as it makes no sense to restore them - - // always clear memory - memset(body, 0x0, props->max_size); - - _props_impl_spin_lock(impl, PROP_STATE_NONE, PROP_STATE_LOCK); - - // create temporary copy of value, store() may well be blocking - const uint32_t size = impl->stash.size; - memcpy(body, impl->stash.body, size); - - _props_impl_unlock(impl, PROP_STATE_NONE); - - if( map_path && map_path->abstract_path - && (impl->type == props->urid.atom_path) ) - { - const char *path = strstr(body, "file://") == body - ? (char *)body + 7 // skip "file://" - : (char *)body; - - char *abstract = NULL; - - if( make_path && make_path->path - && (strstr(path, "/tmp") == path) ) - { - char *absolute = make_path->path(make_path->handle, basename(path)); - - if(absolute) - { - if(_copy_file(absolute, path) == 0) - { - abstract = map_path->abstract_path(map_path->handle, absolute); - } - - _free_path(free_path, absolute); - } - } - else - { - abstract = map_path->abstract_path(map_path->handle, path); - } - - if(abstract) - { - const uint32_t sz = strlen(abstract) + 1; - store(state, impl->property, abstract, sz, impl->type, flags); - - _free_path(free_path, abstract); - } - } - else // !Path - { - store(state, impl->property, body, size, impl->type, flags); - } - } - - free(body); - } - - return LV2_STATE_SUCCESS; -} - -static inline LV2_State_Status -props_restore(props_t *props, LV2_State_Retrieve_Function retrieve, - LV2_State_Handle state, uint32_t flags __attribute__((unused)), - const LV2_Feature *const *features) -{ - const LV2_State_Map_Path *map_path = NULL; - const LV2_State_Free_Path *free_path = NULL; - - for(unsigned i = 0; features[i]; i++) - { - if(!strcmp(features[i]->URI, LV2_STATE__mapPath)) - { - map_path = features[i]->data; - } - if(!strcmp(features[i]->URI, LV2_STATE__freePath)) - { - free_path = features[i]->data; - } - } - - for(unsigned i = 0; i < props->nimpls; i++) - { - props_impl_t *impl = &props->impls[i]; - - if(impl->access == props->urid.patch_readable) - continue; // skip read-only, as it makes no sense to restore them - - size_t size; - uint32_t type; - uint32_t _flags; - const void *body = retrieve(state, impl->property, &size, &type, &_flags); - - if( body - && (type == impl->type) - && ( (impl->def->max_size == 0) || (size <= impl->def->max_size) ) ) - { - if( map_path && map_path->absolute_path - && (type == props->urid.atom_path) ) - { - char *absolute = map_path->absolute_path(map_path->handle, body); - if(absolute) - { - const uint32_t sz = strlen(absolute) + 1; - - _props_impl_spin_lock(impl, PROP_STATE_NONE, PROP_STATE_LOCK); - - impl->stash.size = sz; - memcpy(impl->stash.body, absolute, sz); - - _props_impl_unlock(impl, PROP_STATE_RESTORE); - - _free_path(free_path, absolute); - } - } - else // !Path - { - _props_impl_spin_lock(impl, PROP_STATE_NONE, PROP_STATE_LOCK); - - impl->stash.size = size; - memcpy(impl->stash.body, body, size); - - _props_impl_unlock(impl, PROP_STATE_RESTORE); - } - } - } - - _props_restoring_set(props); - - return LV2_STATE_SUCCESS; -} - -#ifdef __cplusplus -} -#endif - -#endif // _LV2_PROPS_H_ diff --git a/props.lv2/test/chunk.bin b/props.lv2/test/chunk.bin deleted file mode 100644 index b66efb8adab7795606f4ebbc70be4c0a1d047a52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16 XcmZQzWMXDvWn<^yLnc0=NKq diff --git a/props.lv2/test/manifest.ttl.in b/props.lv2/test/manifest.ttl.in deleted file mode 100644 index 0ecc313..0000000 --- a/props.lv2/test/manifest.ttl.in +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2015 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. - -@prefix lv2: . -@prefix owl: . -@prefix rdfs: . - -@prefix props: . - -# Orbit Looper -props:test - a lv2:Plugin ; - lv2:minorVersion @MINOR_VERSION@ ; - lv2:microVersion @MICRO_VERSION@ ; - lv2:binary ; - rdfs:seeAlso . diff --git a/props.lv2/test/props.c b/props.lv2/test/props.c deleted file mode 100644 index 590c519..0000000 --- a/props.lv2/test/props.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include - -#include - -#include -#include - -#define PROPS_PREFIX "http://open-music-kontrollers.ch/lv2/props#" -#define PROPS_TEST_URI PROPS_PREFIX"test" - -#define MAX_NPROPS 7 -#define MAX_STRLEN 256 - -typedef struct _plugstate_t plugstate_t; -typedef struct _plughandle_t plughandle_t; - -struct _plugstate_t { - int32_t val1; - int64_t val2; - float val3; - double val4; - char val5 [MAX_STRLEN]; - char val6 [MAX_STRLEN]; - uint8_t val7 [MAX_STRLEN]; -}; - -struct _plughandle_t { - LV2_URID_Map *map; - LV2_Log_Log *log; - LV2_Log_Logger logger; - LV2_Atom_Forge forge; - LV2_Atom_Forge_Ref ref; - - PROPS_T(props, MAX_NPROPS); - plugstate_t state; - plugstate_t stash; - - struct { - LV2_URID val2; - LV2_URID val4; - } urid; - - const LV2_Atom_Sequence *event_in; - LV2_Atom_Sequence *event_out; -}; - -static void -_intercept(void *data, int64_t frames __attribute__((unused)), props_impl_t *impl) -{ - plughandle_t *handle = data; - - lv2_log_trace(&handle->logger, "SET : %s\n", impl->def->property); -} - -static void -_intercept_stat1(void *data, int64_t frames, props_impl_t *impl) -{ - plughandle_t *handle = data; - - _intercept(data, frames, impl); - - handle->state.val2 = handle->state.val1 * 2; - - props_set(&handle->props, &handle->forge, frames, handle->urid.val2, &handle->ref); -} - -static void -_intercept_stat3(void *data, int64_t frames, props_impl_t *impl) -{ - plughandle_t *handle = data; - - _intercept(data, frames, impl); - - handle->state.val4 = handle->state.val3 * 2; - - props_set(&handle->props, &handle->forge, frames, handle->urid.val4, &handle->ref); -} - -static void -_intercept_stat6(void *data, int64_t frames, props_impl_t *impl) -{ - plughandle_t *handle = data; - - _intercept(data, frames, impl); - - const char *path = strstr(handle->state.val6, "file://") - ? handle->state.val6 + 7 // skip "file://" - : handle->state.val6; - FILE *f = fopen(path, "wb"); // create empty file - if(f) - fclose(f); -} - -static const props_def_t defs [MAX_NPROPS] = { - { - .property = PROPS_PREFIX"statInt", - .offset = offsetof(plugstate_t, val1), - .type = LV2_ATOM__Int, - .event_cb = _intercept_stat1, - }, - { - .property = PROPS_PREFIX"statLong", - .access = LV2_PATCH__readable, - .offset = offsetof(plugstate_t, val2), - .type = LV2_ATOM__Long, - .event_cb = _intercept, - }, - { - .property = PROPS_PREFIX"statFloat", - .offset = offsetof(plugstate_t, val3), - .type = LV2_ATOM__Float, - .event_cb = _intercept_stat3, - }, - { - .property = PROPS_PREFIX"statDouble", - .access = LV2_PATCH__readable, - .offset = offsetof(plugstate_t, val4), - .type = LV2_ATOM__Double, - .event_cb = _intercept, - }, - { - .property = PROPS_PREFIX"statString", - .offset = offsetof(plugstate_t, val5), - .type = LV2_ATOM__String, - .event_cb = _intercept, - .max_size = MAX_STRLEN // strlen - }, - { - .property = PROPS_PREFIX"statPath", - .offset = offsetof(plugstate_t, val6), - .type = LV2_ATOM__Path, - .event_cb = _intercept_stat6, - .max_size = MAX_STRLEN // strlen - }, - { - .property = PROPS_PREFIX"statChunk", - .offset = offsetof(plugstate_t, val7), - .type = LV2_ATOM__Chunk, - .event_cb = _intercept, - .max_size = MAX_STRLEN // strlen - } -}; - -static LV2_Handle -instantiate(const LV2_Descriptor* descriptor, - double rate __attribute__((unused)), - const char *bundle_path __attribute__((unused)), - const LV2_Feature *const *features) -{ - plughandle_t *handle = calloc(1, sizeof(plughandle_t)); - if(!handle) - return NULL; - - for(unsigned i=0; features[i]; i++) - { - if(!strcmp(features[i]->URI, LV2_URID__map)) - handle->map = features[i]->data; - else if(!strcmp(features[i]->URI, LV2_LOG__log)) - handle->log = features[i]->data; - } - - if(!handle->map) - { - fprintf(stderr, - "%s: Host does not support urid:map\n", descriptor->URI); - free(handle); - return NULL; - } - if(!handle->log) - { - fprintf(stderr, - "%s: Host does not support log:log\n", descriptor->URI); - free(handle); - return NULL; - } - - lv2_log_logger_init(&handle->logger, handle->map, handle->log); - lv2_atom_forge_init(&handle->forge, handle->map); - - if(!props_init(&handle->props, descriptor->URI, - defs, MAX_NPROPS, &handle->state, &handle->stash, - handle->map, handle)) - { - lv2_log_error(&handle->logger, "failed to initialize property structure\n"); - free(handle); - return NULL; - } - - handle->urid.val2 = props_map(&handle->props, PROPS_PREFIX"statLong"); - handle->urid.val4 = props_map(&handle->props, PROPS_PREFIX"statDouble"); - - return handle; -} - -static void -connect_port(LV2_Handle instance, uint32_t port, void *data) -{ - plughandle_t *handle = (plughandle_t *)instance; - - switch(port) - { - case 0: - handle->event_in = (const LV2_Atom_Sequence *)data; - break; - case 1: - handle->event_out = (LV2_Atom_Sequence *)data; - break; - default: - break; - } -} - -static void -run(LV2_Handle instance, uint32_t nsamples __attribute__((unused))) -{ - plughandle_t *handle = instance; - - uint32_t capacity = handle->event_out->atom.size; - LV2_Atom_Forge_Frame frame; - lv2_atom_forge_set_buffer(&handle->forge, (uint8_t *)handle->event_out, capacity); - handle->ref = lv2_atom_forge_sequence_head(&handle->forge, &frame, 0); - - props_idle(&handle->props, &handle->forge, 0, &handle->ref); - - LV2_ATOM_SEQUENCE_FOREACH(handle->event_in, ev) - { - const LV2_Atom_Object *obj = (const LV2_Atom_Object *)&ev->body; - - if(handle->ref) - props_advance(&handle->props, &handle->forge, ev->time.frames, obj, &handle->ref); - } - - if(handle->ref) - lv2_atom_forge_pop(&handle->forge, &frame); - else - lv2_atom_sequence_clear(handle->event_out); -} - -static void -cleanup(LV2_Handle instance) -{ - plughandle_t *handle = instance; - - free(handle); -} - -static LV2_State_Status -_state_save(LV2_Handle instance, LV2_State_Store_Function store, - LV2_State_Handle state, uint32_t flags, - const LV2_Feature *const *features) -{ - plughandle_t *handle = (plughandle_t *)instance; - - return props_save(&handle->props, store, state, flags, features); -} - -static LV2_State_Status -_state_restore(LV2_Handle instance, LV2_State_Retrieve_Function retrieve, - LV2_State_Handle state, uint32_t flags, - const LV2_Feature *const *features) -{ - plughandle_t *handle = (plughandle_t *)instance; - - return props_restore(&handle->props, retrieve, state, flags, features); -} - -LV2_State_Interface state_iface = { - .save = _state_save, - .restore = _state_restore -}; - -static const void * -extension_data(const char *uri) -{ - if(!strcmp(uri, LV2_STATE__interface)) - return &state_iface; - return NULL; -} - -const LV2_Descriptor props_test = { - .URI = PROPS_TEST_URI, - .instantiate = instantiate, - .connect_port = connect_port, - .activate = NULL, - .run = run, - .deactivate = NULL, - .cleanup = cleanup, - .extension_data = extension_data -}; - -#ifdef _WIN32 -__declspec(dllexport) -#else -__attribute__((visibility("default"))) -#endif -const LV2_Descriptor* -lv2_descriptor(uint32_t index) -{ - switch(index) - { - case 0: - return &props_test; - default: - return NULL; - } -} diff --git a/props.lv2/test/props.ttl b/props.lv2/test/props.ttl deleted file mode 100644 index f2ce779..0000000 --- a/props.lv2/test/props.ttl +++ /dev/null @@ -1,151 +0,0 @@ -# Copyright (c) 2015 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. - -@prefix owl: . -@prefix foaf: . -@prefix doap: . -@prefix rdf: . -@prefix rdfs: . -@prefix lv2: . -@prefix atom: . -@prefix urid: . -@prefix state: . -@prefix patch: . -@prefix log: . -@prefix units: . -@prefix xsd: . - -@prefix omk: . -@prefix proj: . -@prefix props: . - -# Maintainer -omk:me - a foaf:Person ; - foaf:name "Hanspeter Portner" ; - foaf:mbox ; - foaf:homepage . - -# Project -proj:props - a doap:Project ; - doap:maintainer omk:me ; - doap:name "Props Bundle" . - -props:statInt - a lv2:Parameter ; - rdfs:range atom:Int ; - rdfs:label "statInt" ; - rdfs:comment "This is a 32-bit integer" ; - units:unit units:hz ; - lv2:minimum 0 ; - lv2:maximum 10 . - -props:statLong - a lv2:Parameter ; - rdfs:range atom:Long ; - rdfs:label "statLong" ; - rdfs:comment "This is a 64-bit integer" ; - units:unit units:khz ; - lv2:minimum 0 ; - lv2:maximum 20 . - -props:statFloat - a lv2:Parameter ; - rdfs:range atom:Float ; - rdfs:label "statFloat" ; - rdfs:comment "This is a 32-bit float" ; - units:unit units:mhz ; - lv2:minimum -0.5 ; - lv2:maximum 0.5 . - -props:statDouble - a lv2:Parameter ; - rdfs:range atom:Double ; - rdfs:label "statDouble" ; - rdfs:comment "This is a 64-bit double" ; - units:unit units:db ; - lv2:minimum -1.0 ; - lv2:maximum 1.0 . - -props:statString - a lv2:Parameter ; - rdfs:range atom:String ; - rdfs:label "statString" ; - rdfs:comment "This is a string" . - -props:statPath - a lv2:Parameter ; - rdfs:range atom:Path ; - rdfs:label "statPath" ; - rdfs:comment "This is a path" . - -props:statChunk - a lv2:Parameter ; - rdfs:range atom:Chunk; - rdfs:label "statChunk" ; - rdfs:comment "This is a chunk" . - -# Looper Test -props:test - a lv2:Plugin , - lv2:ConverterPlugin ; - doap:name "Props Test" ; - doap:license ; - lv2:project proj:props ; - lv2:requiredFeature urid:map, log:log, state:loadDefaultState ; - lv2:optionalFeature lv2:isLive, lv2:hardRTCapable, state:threadSafeRestore ; - lv2:extensionData state:interface ; - - lv2:port [ - # sink event port - a lv2:InputPort , - atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message ; - lv2:index 0 ; - lv2:symbol "event_in" ; - lv2:name "Event Input" ; - lv2:designation lv2:control ; - ] , [ - # source event port - a lv2:OutputPort , - atom:AtomPort ; - atom:bufferType atom:Sequence ; - atom:supports patch:Message ; - lv2:index 1 ; - lv2:symbol "event_out" ; - lv2:name "Event Output" ; - lv2:designation lv2:control ; - ] ; - - patch:writable - props:statInt , - props:statFloat , - props:statString , - props:statPath , - props:statChunk ; - - patch:readable - props:statLong , - props:statDouble ; - - state:state [ - props:statInt 4 ; - props:statFloat "0.4"^^xsd:float ; - props:statString "Hello world" ; - props:statPath <> ; - props:statChunk "AQIDBAUGBw=="^^xsd:base64Binary ; - ] . diff --git a/props.lv2/test/props_test.c b/props.lv2/test/props_test.c deleted file mode 100644 index 69f3b3f..0000000 --- a/props.lv2/test/props_test.c +++ /dev/null @@ -1,647 +0,0 @@ -/* - * Copyright (c) 2015 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. - */ - -#include - -#include - -#define MAX_URIDS 512 -#define STR_SIZE 32 -#define CHUNK_SIZE 16 -#define VEC_SIZE 13 - -#define PROPS_PREFIX "http://open-music-kontrollers.ch/lv2/props#" -#define PROPS_TEST_URI PROPS_PREFIX"test" - -typedef struct _plugstate_t plugstate_t; -typedef struct _urid_t urid_t; -typedef struct _handle_t handle_t; -typedef void (*test_t)(handle_t *handle); -typedef void *(*ser_atom_realloc_t)(void *data, void *buf, size_t size); -typedef void (*ser_atom_free_t)(void *data, void *buf); - -typedef struct _ser_atom_t ser_atom_t; - -struct _plugstate_t { - int32_t b32; - int32_t i32; - int64_t i64; - float f32; - double f64; - uint32_t urid; - char str [STR_SIZE]; - char uri [STR_SIZE]; - char path [STR_SIZE]; - uint8_t chunk [CHUNK_SIZE]; - LV2_Atom_Literal_Body lit; - char lit_body [STR_SIZE]; - LV2_Atom_Vector_Body vec; - int32_t vec_body [VEC_SIZE]; - LV2_Atom_Object_Body obj; //FIXME - LV2_Atom_Sequence_Body seq; //FIXME -}; - -struct _urid_t { - LV2_URID urid; - char *uri; -}; - -enum { - PROP_b32 = 0, - PROP_i32, - PROP_i64, - PROP_f32, - PROP_f64, - PROP_urid, - PROP_str, - PROP_uri, - PROP_path, - PROP_chunk, - PROP_lit, - PROP_vec, - PROP_obj, - PROP_seq, - - MAX_NPROPS -}; - -struct _handle_t { - PROPS_T(props, MAX_NPROPS); - plugstate_t state; - plugstate_t stash; - - LV2_URID_Map map; - - urid_t urids [MAX_URIDS]; - LV2_URID urid; -}; - -struct _ser_atom_t { - ser_atom_realloc_t realloc; - ser_atom_free_t free; - void *data; - - size_t size; - size_t offset; - union { - uint8_t *buf; - LV2_Atom *atom; - }; -}; - -static LV2_Atom_Forge_Ref -_ser_atom_sink(LV2_Atom_Forge_Sink_Handle handle, const void *buf, - uint32_t size) -{ - ser_atom_t *ser = handle; - const size_t needed = ser->offset + size; - - while(needed > ser->size) - { - const size_t augmented = ser->size - ? ser->size << 1 - : 1024; - uint8_t *grown = ser->realloc(ser->data, ser->buf, augmented); - if(!grown) // out-of-memory - { - return 0; - } - - ser->buf = grown; - ser->size = augmented; - } - - const LV2_Atom_Forge_Ref ref = ser->offset + 1; - memcpy(&ser->buf[ser->offset], buf, size); - ser->offset += size; - - return ref; -} - -static LV2_Atom * -_ser_atom_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) -{ - ser_atom_t *ser = handle; - - if(!ref) // invalid reference - { - return NULL; - } - - const size_t offset = ref - 1; - return (LV2_Atom *)&ser->buf[offset]; -} - -static void * -_ser_atom_realloc(void *data, void *buf, size_t size) -{ - (void)data; - - return realloc(buf, size); -} - -static void -_ser_atom_free(void *data, void *buf) -{ - (void)data; - - free(buf); -} - -static int -ser_atom_deinit(ser_atom_t *ser) -{ - if(!ser) - { - return -1; - } - - if(ser->buf) - { - ser->free(ser->data, ser->buf); - } - - ser->size = 0; - ser->offset = 0; - ser->buf = NULL; - - return 0; -} - -static int -ser_atom_funcs(ser_atom_t *ser, ser_atom_realloc_t realloc, - ser_atom_free_t free, void *data) -{ - if(!ser || !realloc || !free || ser_atom_deinit(ser)) - { - return -1; - } - - ser->realloc = realloc; - ser->free = free; - ser->data = data; - - return 0; -} - -static int -ser_atom_init(ser_atom_t *ser) -{ - if(!ser) - { - return -1; - } - - ser->size = 0; - ser->offset = 0; - ser->buf = NULL; - - return ser_atom_funcs(ser, _ser_atom_realloc, _ser_atom_free, NULL); -} - -#if 0 -static int -ser_atom_reset(ser_atom_t *ser, LV2_Atom_Forge *forge) -{ - if(!ser || !forge) - { - return -1; - } - - lv2_atom_forge_set_sink(forge, _ser_atom_sink, _ser_atom_deref, ser); - - ser->offset = 0; - - return 0; -} -#endif - -static LV2_Atom * -ser_atom_get(ser_atom_t *ser) -{ - if(!ser) - { - return NULL; - } - - return ser->atom; -} - -static LV2_URID -_map(LV2_URID_Map_Handle instance, const char *uri) -{ - handle_t *handle = instance; - - urid_t *itm; - for(itm=handle->urids; itm->urid; itm++) - { - if(!strcmp(itm->uri, uri)) - return itm->urid; - } - - assert(handle->urid + 1 < MAX_URIDS); - - // create new - itm->urid = ++handle->urid; - itm->uri = strdup(uri); - - return itm->urid; -} - -static const props_def_t defs [MAX_NPROPS] = { - [PROP_b32] = { - .property = PROPS_PREFIX"b32", - .offset = offsetof(plugstate_t, b32), - .type = LV2_ATOM__Bool - }, - [PROP_i32] = { - .property = PROPS_PREFIX"i32", - .offset = offsetof(plugstate_t, i32), - .type = LV2_ATOM__Int - }, - [PROP_i64] = { - .property = PROPS_PREFIX"i64", - .offset = offsetof(plugstate_t, i64), - .type = LV2_ATOM__Long - }, - [PROP_f32] = { - .property = PROPS_PREFIX"f32", - .offset = offsetof(plugstate_t, f32), - .type = LV2_ATOM__Float - }, - [PROP_f64] = { - .property = PROPS_PREFIX"f64", - .offset = offsetof(plugstate_t, f64), - .type = LV2_ATOM__Double - }, - [PROP_urid] = { - .property = PROPS_PREFIX"urid", - .offset = offsetof(plugstate_t, urid), - .type = LV2_ATOM__URID - }, - [PROP_str] = { - .property = PROPS_PREFIX"str", - .offset = offsetof(plugstate_t, str), - .type = LV2_ATOM__String, - .max_size = STR_SIZE - }, - [PROP_uri] = { - .property = PROPS_PREFIX"uri", - .offset = offsetof(plugstate_t, uri), - .type = LV2_ATOM__URI, - .max_size = STR_SIZE - }, - [PROP_path] = { - .property = PROPS_PREFIX"path", - .offset = offsetof(plugstate_t, path), - .type = LV2_ATOM__Path, - .max_size = STR_SIZE - }, - [PROP_chunk] = { - .property = PROPS_PREFIX"chunk", - .offset = offsetof(plugstate_t, chunk), - .type = LV2_ATOM__Chunk, - .max_size = CHUNK_SIZE - }, - [PROP_lit] = { - .property = PROPS_PREFIX"lit", - .offset = offsetof(plugstate_t, lit), - .type = LV2_ATOM__Literal, - .max_size = sizeof(LV2_Atom_Literal_Body) + STR_SIZE - }, - [PROP_vec] = { - .property = PROPS_PREFIX"vec", - .offset = offsetof(plugstate_t, vec), - .type = LV2_ATOM__Literal, - .max_size = sizeof(LV2_Atom_Vector_Body) + VEC_SIZE*sizeof(int32_t) - }, - [PROP_obj] = { - .property = PROPS_PREFIX"obj", - .offset = offsetof(plugstate_t, obj), - .type = LV2_ATOM__Object, - .max_size = sizeof(LV2_Atom_Object_Body) + 0 //FIXME - }, - [PROP_seq] = { - .property = PROPS_PREFIX"seq", - .offset = offsetof(plugstate_t, seq), - .type = LV2_ATOM__Sequence, - .max_size = sizeof(LV2_Atom_Sequence_Body) + 0 //FIXME - } -}; - -static void -_test_1(handle_t *handle) -{ - assert(handle); - - props_t *props = &handle->props; - plugstate_t *state = &handle->state; - plugstate_t *stash = &handle->stash; - LV2_URID_Map *map = &handle->map; - - for(unsigned i = 0; i < MAX_NPROPS; i++) - { - const props_def_t *def = &defs[i]; - - const LV2_URID property = props_map(props, def->property); - assert(property != 0); - assert(property == map->map(map->handle, def->property)); - - assert(strcmp(props_unmap(props, property), def->property) == 0); - - props_impl_t *impl = _props_impl_get(props, property); - assert(impl); - - const LV2_URID type = map->map(map->handle, def->type); - const LV2_URID access = map->map(map->handle, def->access - ? def->access : LV2_PATCH__writable); - - assert(impl->property == property); - assert(impl->type == type); - assert(impl->access == access); - - assert(impl->def == def); - - assert(atomic_load(&impl->state) == PROP_STATE_NONE); - assert(impl->stashing == false); - - switch(i) - { - case PROP_b32: - { - assert(impl->value.size == sizeof(state->b32)); - assert(impl->value.body == &state->b32); - - assert(impl->stash.size == sizeof(stash->b32)); - assert(impl->stash.body == &stash->b32); - } break; - case PROP_i32: - { - assert(impl->value.size == sizeof(state->i32)); - assert(impl->value.body == &state->i32); - - assert(impl->stash.size == sizeof(stash->i32)); - assert(impl->stash.body == &stash->i32); - } break; - case PROP_i64: - { - assert(impl->value.size == sizeof(state->i64)); - assert(impl->value.body == &state->i64); - - assert(impl->stash.size == sizeof(stash->i64)); - assert(impl->stash.body == &stash->i64); - } break; - case PROP_f32: - { - assert(impl->value.size == sizeof(state->f32)); - assert(impl->value.body == &state->f32); - - assert(impl->stash.size == sizeof(stash->f32)); - assert(impl->stash.body == &stash->f32); - } break; - case PROP_f64: - { - assert(impl->value.size == sizeof(state->f64)); - assert(impl->value.body == &state->f64); - - assert(impl->stash.size == sizeof(stash->f64)); - assert(impl->stash.body == &stash->f64); - } break; - case PROP_urid: - { - assert(impl->value.size == sizeof(state->urid)); - assert(impl->value.body == &state->urid); - - assert(impl->stash.size == sizeof(stash->urid)); - assert(impl->stash.body == &stash->urid); - } break; - case PROP_str: - { - assert(impl->value.size == 0); - assert(impl->value.body == &state->str); - - assert(impl->stash.size == 0); - assert(impl->stash.body == &stash->str); - } break; - case PROP_uri: - { - assert(impl->value.size == 0); - assert(impl->value.body == &state->uri); - - assert(impl->stash.size == 0); - assert(impl->stash.body == &stash->uri); - } break; - case PROP_path: - { - assert(impl->value.size == 0); - assert(impl->value.body == &state->path); - - assert(impl->stash.size == 0); - assert(impl->stash.body == &stash->path); - } break; - case PROP_chunk: - { - assert(impl->value.size == 0); - assert(impl->value.body == &state->chunk); - - assert(impl->stash.size == 0); - assert(impl->stash.body == &stash->chunk); - } break; - case PROP_lit: - { - assert(impl->value.size == sizeof(state->lit)); - assert(impl->value.body == &state->lit); - - assert(impl->stash.size == sizeof(stash->lit)); - assert(impl->stash.body == &stash->lit); - } break; - case PROP_vec: - { - assert(impl->value.size == sizeof(state->vec)); - assert(impl->value.body == &state->vec); - - assert(impl->stash.size == sizeof(stash->vec)); - assert(impl->stash.body == &stash->vec); - } break; - case PROP_obj: - { - assert(impl->value.size == sizeof(state->obj)); - assert(impl->value.body == &state->obj); - - assert(impl->stash.size == sizeof(stash->obj)); - assert(impl->stash.body == &stash->obj); - } break; - case PROP_seq: - { - assert(impl->value.size == sizeof(state->seq)); - assert(impl->value.body == &state->seq); - - assert(impl->stash.size == sizeof(stash->seq)); - assert(impl->stash.body == &stash->seq); - } break; - default: - { - assert(false); - } break; - } - } -} - -static void -_test_2(handle_t *handle) -{ - assert(handle); - - props_t *props = &handle->props; - plugstate_t *state = &handle->state; - plugstate_t *stash = &handle->stash; - LV2_URID_Map *map = &handle->map; - - LV2_Atom_Forge forge; - LV2_Atom_Forge_Frame frame; - LV2_Atom_Forge_Ref ref; - ser_atom_t ser; - - lv2_atom_forge_init(&forge, map); - assert(ser_atom_init(&ser) == 0); - - lv2_atom_forge_set_sink(&forge, _ser_atom_sink, _ser_atom_deref, &ser); - - ref = lv2_atom_forge_sequence_head(&forge, &frame, 0); - assert(ref); - - props_idle(props, &forge, 0, &ref); - assert(ref); - - const LV2_URID property = props_map(props, defs[0].property); - assert(property); - - state->b32 = true; - - props_set(props, &forge, 1, property, &ref); - assert(ref); - - state->b32 = false; - - lv2_atom_forge_pop(&forge, &frame); - - const LV2_Atom_Sequence *seq = (const LV2_Atom_Sequence *)ser_atom_get(&ser); - assert(seq); - - unsigned nevs = 0; - LV2_ATOM_SEQUENCE_FOREACH(seq, ev) - { - const LV2_Atom *atom = &ev->body; - - assert(ev->time.frames == 1); - assert(atom->type == forge.Object); - - const LV2_Atom_Object *obj = (const LV2_Atom_Object *)atom; - assert(obj->body.id == 0); - - if(obj->body.otype == props->urid.state_StateChanged) - { - continue; - } - - assert(obj->body.otype == props->urid.patch_set); - - unsigned nprops = 0; - LV2_ATOM_OBJECT_FOREACH(obj, prop) - { - assert(prop->context == 0); - - if(prop->key == props->urid.patch_subject) - { - const LV2_Atom_URID *val = (const LV2_Atom_URID *)&prop->value; - - assert(val->atom.type == forge.URID); - assert(val->atom.size == sizeof(uint32_t)); - assert(val->body == props->urid.subject); - - nprops |= 0x1; - } - else if(prop->key == props->urid.patch_property) - { - const LV2_Atom_URID *val = (const LV2_Atom_URID *)&prop->value; - - assert(val->atom.type == forge.URID); - assert(val->atom.size == sizeof(uint32_t)); - assert(val->body == property); - - nprops |= 0x2; - } - else if(prop->key == props->urid.patch_value) - { - const LV2_Atom_Bool *val = (const LV2_Atom_Bool *)&prop->value; - - assert(val->atom.type == forge.Bool); - assert(val->atom.size == sizeof(int32_t)); - assert(val->body == true); - - nprops |= 0x4; - } - else - { - assert(false); - } - } - assert(nprops == 0x7); - - assert(props_advance(props, &forge, ev->time.frames, obj, &ref) == 1); - - assert(state->b32 == true); - assert(stash->b32 == true); - - nevs |= 0x1; - } - assert(nevs == 0x1); - - assert(ser_atom_deinit(&ser) == 0); -} - -static const test_t tests [] = { - _test_1, - _test_2, - NULL -}; - -int -main(int argc __attribute__((unused)), char **argv __attribute__((unused))) -{ - static handle_t handle; - - for(const test_t *test = tests; *test; test++) - { - memset(&handle, 0, sizeof(handle)); - - handle.map.handle = &handle; - handle.map.map = _map; - - assert(props_init(&handle.props, PROPS_PREFIX"subj", defs, MAX_NPROPS, - &handle.state, &handle.stash, &handle.map, NULL) == 1); - - (*test)(&handle); - } - - for(urid_t *itm=handle.urids; itm->urid; itm++) - { - free(itm->uri); - } - - return 0; -} diff --git a/screenshots/screenshot_1.png.license b/screenshots/screenshot_1.png.license new file mode 100644 index 0000000..20f496d --- /dev/null +++ b/screenshots/screenshot_1.png.license @@ -0,0 +1,2 @@ +SPDX-FileCopyrightText: Hanspeter Portner +SPDX-License-Identifier: CC0-1.0 diff --git a/ser_atom.lv2/.gitlab-ci.yml b/ser_atom.lv2/.gitlab-ci.yml deleted file mode 100644 index 4f9e16f..0000000 --- a/ser_atom.lv2/.gitlab-ci.yml +++ /dev/null @@ -1,63 +0,0 @@ -stages: - - test - -.variables_template: &variables_definition - variables: - BASE_NAME: "ser_atom.lv2" - PKG_CONFIG_PATH: "/opt/lv2/lib/pkgconfig:/opt/${CI_BUILD_NAME}/lib/pkgconfig:/usr/lib/${CI_BUILD_NAME}/pkgconfig" - -.common_template: &common_definition - <<: *variables_definition - stage: test - -.build_template: &build_definition - <<: *common_definition - script: - - meson --cross-file "${CI_BUILD_NAME}" build - - ninja -C build - -.test_template: &test_definition - <<: *common_definition - script: - - meson --cross-file "${CI_BUILD_NAME}" build - - ninja -C build - - cd build - - meson test --verbose --wrap "${CI_BUILD_NAME}.wrap" - -.universal_linux_template: &universal_linux_definition - image: ventosus/universal-linux-gnu - <<: *test_definition - -.arm_linux_template: &arm_linux_definition - image: ventosus/arm-linux-gnueabihf - <<: *test_definition - -.universal_w64_template: &universal_w64_definition - image: ventosus/universal-w64-mingw32 - <<: *test_definition - -.universal_apple_template: &universal_apple_definition - image: ventosus/universal-apple-darwin - <<: *build_definition - -# building in docker -x86_64-linux-gnu: - <<: *universal_linux_definition - -i686-linux-gnu: - <<: *universal_linux_definition - -arm-linux-gnueabihf: - <<: *arm_linux_definition - -aarch64-linux-gnu: - <<: *arm_linux_definition - -x86_64-w64-mingw32: - <<: *universal_w64_definition - -i686-w64-mingw32: - <<: *universal_w64_definition - -universal-apple-darwin: - <<: *universal_apple_definition diff --git a/ser_atom.lv2/COPYING b/ser_atom.lv2/COPYING deleted file mode 100644 index ddb9a46..0000000 --- a/ser_atom.lv2/COPYING +++ /dev/null @@ -1,201 +0,0 @@ - The Artistic License 2.0 - - Copyright (c) 2000-2006, The Perl Foundation. - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -Preamble - -This license establishes the terms under which a given free software -Package may be copied, modified, distributed, and/or redistributed. -The intent is that the Copyright Holder maintains some artistic -control over the development of that Package while still keeping the -Package available as open source and free software. - -You are always permitted to make arrangements wholly outside of this -license directly with the Copyright Holder of a given Package. If the -terms of this license do not permit the full use that you propose to -make of the Package, you should contact the Copyright Holder and seek -a different licensing arrangement. - -Definitions - - "Copyright Holder" means the individual(s) or organization(s) - named in the copyright notice for the entire Package. - - "Contributor" means any party that has contributed code or other - material to the Package, in accordance with the Copyright Holder's - procedures. - - "You" and "your" means any person who would like to copy, - distribute, or modify the Package. - - "Package" means the collection of files distributed by the - Copyright Holder, and derivatives of that collection and/or of - those files. A given Package may consist of either the Standard - Version, or a Modified Version. - - "Distribute" means providing a copy of the Package or making it - accessible to anyone else, or in the case of a company or - organization, to others outside of your company or organization. - - "Distributor Fee" means any fee that you charge for Distributing - this Package or providing support for this Package to another - party. It does not mean licensing fees. - - "Standard Version" refers to the Package if it has not been - modified, or has been modified only in ways explicitly requested - by the Copyright Holder. - - "Modified Version" means the Package, if it has been changed, and - such changes were not explicitly requested by the Copyright - Holder. - - "Original License" means this Artistic License as Distributed with - the Standard Version of the Package, in its current version or as - it may be modified by The Perl Foundation in the future. - - "Source" form means the source code, documentation source, and - configuration files for the Package. - - "Compiled" form means the compiled bytecode, object code, binary, - or any other form resulting from mechanical transformation or - translation of the Source form. - - -Permission for Use and Modification Without Distribution - -(1) You are permitted to use the Standard Version and create and use -Modified Versions for any purpose without restriction, provided that -you do not Distribute the Modified Version. - - -Permissions for Redistribution of the Standard Version - -(2) You may Distribute verbatim copies of the Source form of the -Standard Version of this Package in any medium without restriction, -either gratis or for a Distributor Fee, provided that you duplicate -all of the original copyright notices and associated disclaimers. At -your discretion, such verbatim copies may or may not include a -Compiled form of the Package. - -(3) You may apply any bug fixes, portability changes, and other -modifications made available from the Copyright Holder. The resulting -Package will still be considered the Standard Version, and as such -will be subject to the Original License. - - -Distribution of Modified Versions of the Package as Source - -(4) You may Distribute your Modified Version as Source (either gratis -or for a Distributor Fee, and with or without a Compiled form of the -Modified Version) provided that you clearly document how it differs -from the Standard Version, including, but not limited to, documenting -any non-standard features, executables, or modules, and provided that -you do at least ONE of the following: - - (a) make the Modified Version available to the Copyright Holder - of the Standard Version, under the Original License, so that the - Copyright Holder may include your modifications in the Standard - Version. - - (b) ensure that installation of your Modified Version does not - prevent the user installing or running the Standard Version. In - addition, the Modified Version must bear a name that is different - from the name of the Standard Version. - - (c) allow anyone who receives a copy of the Modified Version to - make the Source form of the Modified Version available to others - under - - (i) the Original License or - - (ii) a license that permits the licensee to freely copy, - modify and redistribute the Modified Version using the same - licensing terms that apply to the copy that the licensee - received, and requires that the Source form of the Modified - Version, and of any works derived from it, be made freely - available in that license fees are prohibited but Distributor - Fees are allowed. - - -Distribution of Compiled Forms of the Standard Version -or Modified Versions without the Source - -(5) You may Distribute Compiled forms of the Standard Version without -the Source, provided that you include complete instructions on how to -get the Source of the Standard Version. Such instructions must be -valid at the time of your distribution. If these instructions, at any -time while you are carrying out such distribution, become invalid, you -must provide new instructions on demand or cease further distribution. -If you provide valid instructions or cease distribution within thirty -days after you become aware that the instructions are invalid, then -you do not forfeit any of your rights under this license. - -(6) You may Distribute a Modified Version in Compiled form without -the Source, provided that you comply with Section 4 with respect to -the Source of the Modified Version. - - -Aggregating or Linking the Package - -(7) You may aggregate the Package (either the Standard Version or -Modified Version) with other packages and Distribute the resulting -aggregation provided that you do not charge a licensing fee for the -Package. Distributor Fees are permitted, and licensing fees for other -components in the aggregation are permitted. The terms of this license -apply to the use and Distribution of the Standard or Modified Versions -as included in the aggregation. - -(8) You are permitted to link Modified and Standard Versions with -other works, to embed the Package in a larger work of your own, or to -build stand-alone binary or bytecode versions of applications that -include the Package, and Distribute the result without restriction, -provided the result does not expose a direct interface to the Package. - - -Items That are Not Considered Part of a Modified Version - -(9) Works (including, but not limited to, modules and scripts) that -merely extend or make use of the Package, do not, by themselves, cause -the Package to be a Modified Version. In addition, such works are not -considered parts of the Package itself, and are not subject to the -terms of this license. - - -General Provisions - -(10) Any use, modification, and distribution of the Standard or -Modified Versions is governed by this Artistic License. By using, -modifying or distributing the Package, you accept this license. Do not -use, modify, or distribute the Package, if you do not accept this -license. - -(11) If your Modified Version has been derived from a Modified -Version made by someone other than you, you are nevertheless required -to ensure that your Modified Version complies with the requirements of -this license. - -(12) This license does not grant you the right to use any trademark, -service mark, tradename, or logo of the Copyright Holder. - -(13) This license includes the non-exclusive, worldwide, -free-of-charge patent license to make, have made, use, offer to sell, -sell, import and otherwise transfer the Package with respect to any -patent claims licensable by the Copyright Holder that are necessarily -infringed by the Package. If you institute patent litigation -(including a cross-claim or counterclaim) against any party alleging -that the Package constitutes direct or contributory patent -infringement, then this Artistic License to you shall terminate on the -date that such litigation is filed. - -(14) Disclaimer of Warranty: -THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS -IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED -WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR -NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL -LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL -DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/ser_atom.lv2/README.md b/ser_atom.lv2/README.md deleted file mode 100644 index 00e0e03..0000000 --- a/ser_atom.lv2/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# ser_atom.lv2 - -## General purpose LV2 atom forge serializer - -### Build Status - -[![build status](https://gitlab.com/OpenMusicKontrollers/ser_atom.lv2/badges/master/build.svg)](https://gitlab.com/OpenMusicKontrollers/ser_atom.lv2/commits/master) - -### Build / test - - git clone https://git.open-music-kontrollers.ch/lv2/ser_atom.lv2 - cd ser_atom.lv2 - meson build - cd build - ninja -j4 - ninja test - -### License - -Copyright (c) 2018 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 -. diff --git a/ser_atom.lv2/VERSION b/ser_atom.lv2/VERSION deleted file mode 100644 index 1a03094..0000000 --- a/ser_atom.lv2/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1.9 diff --git a/ser_atom.lv2/meson.build b/ser_atom.lv2/meson.build deleted file mode 100644 index 4360ca5..0000000 --- a/ser_atom.lv2/meson.build +++ /dev/null @@ -1,26 +0,0 @@ -project('ser_atom.lv2', 'c', default_options : [ - 'buildtype=release', - 'warning_level=3', - 'werror=true', - 'b_lto=false', - 'c_std=c11']) - -version = run_command('cat', 'VERSION').stdout().strip() - -add_project_arguments('-D_GNU_SOURCE', language : 'c') - -conf_data = configuration_data() -cc = meson.get_compiler('c') - -lv2_dep = dependency('lv2') -deps = [lv2_dep] - -c_args = [] - -ser_atom_test = executable('ser_atom_test', - join_paths('test', 'ser_atom_test.c'), - c_args : c_args, - dependencies : deps, - install : false) - -test('Test', ser_atom_test) diff --git a/ser_atom.lv2/ser_atom.lv2/ser_atom.h b/ser_atom.lv2/ser_atom.lv2/ser_atom.h deleted file mode 100644 index 7357e65..0000000 --- a/ser_atom.lv2/ser_atom.lv2/ser_atom.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright (c) 2018 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. - */ - -#ifndef _SER_ATOM_H -#define _SER_ATOM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include -#include - -#include - -#ifndef SER_ATOM_API -# define SER_ATOM_API static -#endif - -typedef void *(*ser_atom_realloc_t)(void *data, void *buf, size_t size); -typedef void (*ser_atom_free_t)(void *data, void *buf); - -typedef struct _ser_atom_t ser_atom_t; - -SER_ATOM_API int -ser_atom_init(ser_atom_t *ser); - -SER_ATOM_API int -ser_atom_funcs(ser_atom_t *ser, ser_atom_realloc_t realloc, - ser_atom_free_t free, void *data); - -SER_ATOM_API int -ser_atom_reset(ser_atom_t *ser, LV2_Atom_Forge *forge); - -SER_ATOM_API LV2_Atom * -ser_atom_get(ser_atom_t *ser); - -SER_ATOM_API int -ser_atom_deinit(ser_atom_t *ser); - -#ifdef SER_ATOM_IMPLEMENTATION - -struct _ser_atom_t { - ser_atom_realloc_t realloc; - ser_atom_free_t free; - void *data; - - size_t size; - size_t offset; - union { - uint8_t *buf; - LV2_Atom *atom; - }; -}; - -static LV2_Atom_Forge_Ref -_ser_atom_sink(LV2_Atom_Forge_Sink_Handle handle, const void *buf, - uint32_t size) -{ - ser_atom_t *ser = handle; - const size_t needed = ser->offset + size; - - while(needed > ser->size) - { - const size_t augmented = ser->size - ? ser->size << 1 - : 1024; - uint8_t *grown = ser->realloc(ser->data, ser->buf, augmented); - if(!grown) // out-of-memory - { - return 0; - } - - ser->buf = grown; - ser->size = augmented; - } - - const LV2_Atom_Forge_Ref ref = ser->offset + 1; - memcpy(&ser->buf[ser->offset], buf, size); - ser->offset += size; - - return ref; -} - -static LV2_Atom * -_ser_atom_deref(LV2_Atom_Forge_Sink_Handle handle, LV2_Atom_Forge_Ref ref) -{ - ser_atom_t *ser = handle; - - if(!ref) // invalid reference - { - return NULL; - } - - const size_t offset = ref - 1; - return (LV2_Atom *)&ser->buf[offset]; -} - -static void * -_ser_atom_realloc(void *data, void *buf, size_t size) -{ - (void)data; - - return realloc(buf, size); -} - -static void -_ser_atom_free(void *data, void *buf) -{ - (void)data; - - free(buf); -} - -SER_ATOM_API int -ser_atom_funcs(ser_atom_t *ser, ser_atom_realloc_t realloc, - ser_atom_free_t free, void *data) -{ - if(!ser || !realloc || !free || ser_atom_deinit(ser)) - { - return -1; - } - - ser->realloc = realloc; - ser->free = free; - ser->data = data; - - return 0; -} - -SER_ATOM_API int -ser_atom_init(ser_atom_t *ser) -{ - if(!ser) - { - return -1; - } - - ser->size = 0; - ser->offset = 0; - ser->buf = NULL; - - return ser_atom_funcs(ser, _ser_atom_realloc, _ser_atom_free, NULL); -} - -SER_ATOM_API int -ser_atom_reset(ser_atom_t *ser, LV2_Atom_Forge *forge) -{ - if(!ser || !forge) - { - return -1; - } - - lv2_atom_forge_set_sink(forge, _ser_atom_sink, _ser_atom_deref, ser); - - ser->offset = 0; - - return 0; -} - -SER_ATOM_API LV2_Atom * -ser_atom_get(ser_atom_t *ser) -{ - if(!ser) - { - return NULL; - } - - return ser->atom; -} - -SER_ATOM_API int -ser_atom_deinit(ser_atom_t *ser) -{ - if(!ser) - { - return -1; - } - - if(ser->buf) - { - ser->free(ser->data, ser->buf); - } - - ser->size = 0; - ser->offset = 0; - ser->buf = NULL; - - return 0; -} - -#endif // SER_ATOM_IMPLEMENTATION - -#ifdef __cplusplus -} -#endif - -#endif //_SER_ATOM_H diff --git a/ser_atom.lv2/test/ser_atom_test.c b/ser_atom.lv2/test/ser_atom_test.c deleted file mode 100644 index 00898f0..0000000 --- a/ser_atom.lv2/test/ser_atom_test.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2018 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. - */ - -#include -#include -#include - -#define SER_ATOM_IMPLEMENTATION -#include - -#define MAX_ITEMS 0x100000 - -static uint32_t -_map(void *data, const char *uri) -{ - (void)uri; - - uint32_t *urid = data; - - return ++(*urid); -} - -static void * -_realloc(void *data, void *buf, size_t size) -{ - (void)data; - (void)buf; - (void)size; - - return NULL; -} - -static void -_free(void *data, void *buf) -{ - (void)data; - (void)buf; -} - -int -main(int argc, char **argv) -{ - (void)argc; - (void)argv; - - ser_atom_t ser; - LV2_Atom_Forge forge; - - uint32_t urid = 0; - LV2_URID_Map map = { - .handle = &urid, - .map = _map - }; - - lv2_atom_forge_init(&forge, &map); - - assert(ser_atom_init(NULL) != 0); - assert(ser_atom_init(&ser) == 0); - - assert(ser.size == 0); - assert(ser.offset == 0); - assert(ser.buf == NULL); - - assert(ser_atom_funcs(NULL, NULL, NULL, NULL) != 0); - assert(ser_atom_funcs(&ser, _realloc, _free, NULL) == 0); - assert(ser_atom_reset(&ser, &forge) == 0); - assert(lv2_atom_forge_bool(&forge, true) == 0); - _free(NULL, NULL); - - assert(ser_atom_init(&ser) == 0); - - assert(ser.realloc == _ser_atom_realloc); - assert(ser.free == _ser_atom_free); - assert(ser.data == NULL); - - assert(ser.size == 0); - assert(ser.offset == 0); - assert(ser.buf == NULL); - - assert(ser_atom_reset(NULL, &forge) != 0); - assert(ser_atom_reset(&ser, NULL) != 0); - assert(ser_atom_reset(NULL, NULL) != 0); - assert(ser_atom_reset(&ser, &forge) == 0); - - LV2_Atom_Forge_Frame frame; - int64_t i; - - assert(lv2_atom_forge_tuple(&forge, &frame) != 0); - for(i = 0; i < MAX_ITEMS; i++) - { - assert(lv2_atom_forge_long(&forge, i) != 0); - } - lv2_atom_forge_pop(&forge, &frame); - - i = 0; - LV2_ATOM_TUPLE_FOREACH((const LV2_Atom_Tuple *)ser.buf, atom) - { - assert(atom->size == sizeof(int64_t)); - assert(atom->type == forge.Long); - - const int64_t *i64 = LV2_ATOM_BODY_CONST(atom); - assert(*i64 == i++); - } - - const size_t tot_size = MAX_ITEMS*sizeof(LV2_Atom_Long) + sizeof(LV2_Atom_Tuple); - assert(ser.offset == tot_size); - assert(ser.size >= tot_size); - - assert(lv2_atom_forge_deref(&forge, 0) == NULL); - - assert(ser_atom_get(NULL) == NULL); - assert(ser_atom_get(&ser) == ser.atom); - - assert(ser_atom_deinit(NULL) != 0); - assert(ser_atom_deinit(&ser) == 0); - - assert(ser.size == 0); - assert(ser.offset == 0); - assert(ser.buf == NULL); - - return 0; -} diff --git a/shells_bells.h b/shells_bells.lv2/shells_bells.h similarity index 70% rename from shells_bells.h rename to shells_bells.lv2/shells_bells.h index 1a81da6..ceeeea5 100644 --- a/shells_bells.h +++ b/shells_bells.lv2/shells_bells.h @@ -1,18 +1,6 @@ /* - * Copyright (c) 2019-2021 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. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #ifndef _SHELLS_BELLS_LV2_H @@ -37,7 +25,7 @@ #include #include -#include +#include #define SHELLS_BELLS_URI "http://open-music-kontrollers.ch/lv2/shells_bells" #define SHELLS_BELLS_PREFIX SHELLS_BELLS_URI "#" diff --git a/shells_bells_ui.ttl b/shells_bells_ui.ttl deleted file mode 100644 index 396a9ad..0000000 --- a/shells_bells_ui.ttl +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (c) 2019-2021 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. - -@prefix lv2: . -@prefix ui: . -@prefix atom: . -@prefix ui: . -@prefix urid: . -@prefix log: . -@prefix opts: . - -@prefix shells_bells: . - -shells_bells:ui - ui:portNotification [ - ui:plugin shells_bells:bells ; - lv2:symbol "notify" ; - ui:protocol atom:eventTransfer ; - ] ; - lv2:requiredFeature ui:idleInterface, urid:map, ui:parent ; - lv2:optionalFeature ui:resize, opts:options, log:log ; - opts:supportedOption ui:scaleFactor ; - lv2:extensionData ui:idleInterface, ui:resize . diff --git a/shells_bells.c b/src/shells_bells.c similarity index 90% rename from shells_bells.c rename to src/shells_bells.c index 6643981..dc3caef 100644 --- a/shells_bells.c +++ b/src/shells_bells.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2019-2021 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. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -27,7 +15,7 @@ #include #include -#include +#include typedef struct _plughandle_t plughandle_t; diff --git a/shells_bells_ui.c b/src/shells_bells_ui.c similarity index 91% rename from shells_bells_ui.c rename to src/shells_bells_ui.c index f87da10..e3f9b91 100644 --- a/shells_bells_ui.c +++ b/src/shells_bells_ui.c @@ -1,18 +1,6 @@ /* - * Copyright (c) 2019-2021 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. + * SPDX-FileCopyrightText: Hanspeter Portner + * SPDX-License-Identifier: Artistic-2.0 */ #include @@ -27,10 +15,9 @@ #include #include -#include -#include +#include +#include -#define SER_ATOM_IMPLEMENTATION #include #include @@ -146,11 +133,6 @@ static void _message_set_key(plughandle_t *handle, LV2_URID key) { ser_atom_t ser; - props_impl_t *impl = _props_impl_get(&handle->props, key); - if(!impl) - { - return; - } ser_atom_init(&ser); ser_atom_reset(&ser, &handle->forge); @@ -171,11 +153,6 @@ static void _message_get(plughandle_t *handle, LV2_URID key) { ser_atom_t ser; - props_impl_t *impl = _props_impl_get(&handle->props, key); - if(!impl) - { - return; - } ser_atom_init(&ser); ser_atom_reset(&ser, &handle->forge); @@ -504,7 +481,6 @@ instantiate(const LV2UI_Descriptor *descriptor, return NULL; void *parent = NULL; - LV2UI_Resize *host_resize = NULL; LV2_Options_Option *opts = NULL; for(int i=0; features[i]; i++) { @@ -512,10 +488,6 @@ instantiate(const LV2UI_Descriptor *descriptor, { parent = features[i]->data; } - else if(!strcmp(features[i]->URI, LV2_UI__resize)) - { - host_resize = features[i]->data; - } else if(!strcmp(features[i]->URI, LV2_URID__map)) { handle->map = features[i]->data; @@ -641,11 +613,6 @@ instantiate(const LV2UI_Descriptor *descriptor, handle->state.font_height = 16; _update_font_height(handle); - if(host_resize) - { - host_resize->ui_resize(host_resize->handle, w, h); - } - _message_get(handle, handle->urid_channel); _message_get(handle, handle->urid_note); _message_get(handle, handle->urid_velocity); @@ -710,25 +677,13 @@ static const LV2UI_Idle_Interface idle_ext = { .idle = _idle }; -static int -_resize(LV2UI_Handle instance, int width, int height) -{ - plughandle_t *handle = instance; - - return d2tk_frontend_set_size(handle->dpugl, width, height); -} - -static const LV2UI_Resize resize_ext = { - .ui_resize = _resize -}; - static const void * extension_data(const char *uri) { if(!strcmp(uri, LV2_UI__idleInterface)) + { return &idle_ext; - else if(!strcmp(uri, LV2_UI__resize)) - return &resize_ext; + } return NULL; } diff --git a/manifest.ttl.in b/ttl/manifest.ttl.in similarity index 52% rename from manifest.ttl.in rename to ttl/manifest.ttl.in index 5ea91f5..5236c13 100644 --- a/manifest.ttl.in +++ b/ttl/manifest.ttl.in @@ -1,17 +1,5 @@ -# Copyright (c) 2019-2021 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. +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: Artistic-2.0 @prefix lv2: . @prefix owl: . diff --git a/shells_bells.ttl.in b/ttl/shells_bells.ttl.in similarity index 84% rename from shells_bells.ttl.in rename to ttl/shells_bells.ttl.in index 0b4be30..d464942 100644 --- a/shells_bells.ttl.in +++ b/ttl/shells_bells.ttl.in @@ -1,17 +1,5 @@ -# Copyright (c) 2019-2021 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. +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: Artistic-2.0 @prefix owl: . @prefix xsd: . diff --git a/ttl/shells_bells_ui.ttl b/ttl/shells_bells_ui.ttl new file mode 100644 index 0000000..a724cad --- /dev/null +++ b/ttl/shells_bells_ui.ttl @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: Artistic-2.0 + +@prefix lv2: . +@prefix ui: . +@prefix atom: . +@prefix ui: . +@prefix urid: . +@prefix log: . +@prefix opts: . + +@prefix shells_bells: . + +shells_bells:ui + ui:portNotification [ + ui:plugin shells_bells:bells ; + lv2:symbol "notify" ; + ui:protocol atom:eventTransfer ; + ] ; + lv2:requiredFeature ui:idleInterface, urid:map, ui:parent ; + lv2:optionalFeature opts:options, log:log ; + opts:supportedOption ui:scaleFactor ; + lv2:extensionData ui:idleInterface . -- 2.38.5