Browse Source

add tests, add cv gate and trigger ins

master
Alexandros Theodotou 2 years ago
parent
commit
9045faac1b
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 65
      meson.build
  2. 0
      src/manifest.ttl.in
  3. 78
      src/meson.build
  4. 26
      src/zlfo.c
  5. 2
      src/zlfo_common.h
  6. 30
      src/zlfo_ttl_gen.c
  7. 20
      src/zlfo_ui.c
  8. 0
      src/zlfo_ui_theme.h
  9. 2
      subprojects/ztoolkit.wrap
  10. 37
      tests/meson.build

65
meson.build

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
# Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
# Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of ZLFO
#
@ -85,6 +85,7 @@ ztoolkit_dep = dependency( @@ -85,6 +85,7 @@ ztoolkit_dep = dependency(
# cflags
common_cflags = cc.get_supported_arguments([
'-fvisibility=hidden',
'-Wformat=2',
'-Wno-missing-field-initializers',
'-Wno-unused-parameter',
@ -160,65 +161,9 @@ add_project_arguments ( @@ -160,65 +161,9 @@ add_project_arguments (
language: [ 'c' ]
)
zlfo_dsp_lib = shared_library (
'zlfo_dsp',
name_prefix: '',
sources: [
'zlfo.c',
],
dependencies: zlfo_deps,
include_directories: '.',
install: true,
install_dir: zlfodir,
)
zlfo_ui_lib = shared_library (
'zlfo_ui',
name_prefix: '',
sources: [
'zlfo_ui.c',
],
dependencies: [
zlfo_deps,
ztoolkit_dep,
dependency('glib-2.0'),
],
include_directories: '.',
install: true,
install_dir: zlfodir,
)
# create and install manifest ttl
manifest_ttl = configure_file (
input: 'manifest.ttl.in',
output: 'manifest.ttl',
configuration: zlfo_cdata,
)
install_data (
manifest_ttl,
install_dir: zlfodir,
)
# create and install zlfo ttl
lv2_ttl_gen = executable (
'lv2_ttl_gen',
sources: [
'zlfo_ttl_gen.c',
],
include_directories: '.',
c_args: common_cflags,
install: false,
)
zlfo_ttl = custom_target (
'zlfo.ttl',
output: 'zlfo.ttl',
input: [ lv2_ttl_gen, zlfo_config_h ],
command: [
lv2_ttl_gen, '@OUTPUT@' ],
install: true,
install_dir: zlfodir,
)
# install resources
install_subdir (
'resources', install_dir: zlfodir)
subdir('src')
subdir('tests')

0
manifest.ttl.in → src/manifest.ttl.in

78
src/meson.build

@ -0,0 +1,78 @@ @@ -0,0 +1,78 @@
# Copyright (C) 2020 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of ZLFO
#
# ZLFO is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ZLFO 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ZLFO. If not, see <https://www.gnu.org/licenses/>.
zlfo_dsp_lib = shared_library (
'zlfo_dsp',
name_prefix: '',
sources: [
'zlfo.c',
],
dependencies: zlfo_deps,
include_directories: [ '.', '..' ],
install: true,
install_dir: zlfodir,
)
zlfo_ui_lib = shared_library (
'zlfo_ui',
name_prefix: '',
sources: [
'zlfo_ui.c',
],
dependencies: [
zlfo_deps,
ztoolkit_dep,
dependency('glib-2.0'),
],
include_directories: [ '.', '..' ],
install: true,
install_dir: zlfodir,
)
# create and install manifest ttl
manifest_ttl = configure_file (
input: 'manifest.ttl.in',
output: 'manifest.ttl',
configuration: zlfo_cdata,
)
install_data (
manifest_ttl,
install_dir: zlfodir,
)
# create and install zlfo ttl
lv2_ttl_gen = executable (
'lv2_ttl_gen',
sources: [
'zlfo_ttl_gen.c',
],
include_directories: [ '.', '..' ],
c_args: common_cflags,
install: false,
)
zlfo_ttl = custom_target (
'zlfo.ttl',
output: 'zlfo.ttl',
input: [ lv2_ttl_gen, zlfo_config_h ],
command: [
lv2_ttl_gen, '@OUTPUT@' ],
install: true,
install_dir: zlfodir,
)
# used for tests
zlfo_build_dir = meson.current_build_dir ()

26
zlfo.c → src/zlfo.c

@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
/*
* Copyright (C) 2019 Alexandros Theodotou <alex at zrythm dot org>
* Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
*
* This file is part of ZPlugins
* This file is part of ZLFO
*
* ZPlugins is free software: you can redistribute it and/or modify
* ZLFO is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* ZPlugins is distributed in the hope that it will be useful,
* ZLFO 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
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU General Affero Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* along with ZLFO. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
#include "lv2/log/log.h"
#include "lv2/core/lv2.h"
const float PI = (float) M_PI;
static const float PI = (float) M_PI;
typedef struct ZLFO
{
@ -39,6 +39,8 @@ typedef struct ZLFO @@ -39,6 +39,8 @@ typedef struct ZLFO
LV2_Atom_Sequence* notify;
const float * gate;
const float * trigger;
const float * cv_gate;
const float * cv_trigger;
const float * freq;
const float * shift;
const float * range_min;
@ -165,6 +167,18 @@ connect_port ( @@ -165,6 +167,18 @@ connect_port (
self->notify =
(LV2_Atom_Sequence *) data;
break;
case ZLFO_CV_GATE:
self->cv_gate = (const float *) data;
break;
case ZLFO_CV_TRIGGER:
self->cv_trigger = (const float *) data;
break;
case ZLFO_GATE:
self->gate = (const float *) data;
break;
case ZLFO_TRIGGER:
self->trigger = (const float *) data;
break;
case ZLFO_FREQ:
self->freq = (const float *) data;
break;

2
zlfo_common.h → src/zlfo_common.h

@ -70,6 +70,8 @@ typedef enum PortIndex @@ -70,6 +70,8 @@ typedef enum PortIndex
/** Plugin to UI communication. */
ZLFO_NOTIFY,
ZLFO_CV_GATE,
ZLFO_CV_TRIGGER,
ZLFO_GATE,
ZLFO_TRIGGER,
ZLFO_SYNC_RATE,

30
zlfo_ttl_gen.c → src/zlfo_ttl_gen.c

@ -99,7 +99,27 @@ int main ( @@ -99,7 +99,27 @@ int main (
lv2:symbol \"notify\" ;\n\
lv2:name \"Notify\" ;\n\
rdfs:comment \"Plugin to GUI communication\" ;\n\
] , [\n");
] , [\n\
a lv2:InputPort ,\n\
lv2:CVPort ;\n\
lv2:index 2 ;\n\
lv2:symbol \"cv_gate\" ;\n\
lv2:name \"Gate\" ;\n\
rdfs:comment \"CV gate\" ;\n\
lv2:default %f ;\n\
lv2:minimum %f ;\n\
lv2:maximum %f ;\n\
] , [\n\
a lv2:InputPort ,\n\
lv2:CVPort ;\n\
lv2:index 3 ;\n\
lv2:symbol \"cv_trigger\" ;\n\
lv2:name \"Trigger\" ;\n\
rdfs:comment \"CV trigger\" ;\n\
lv2:default %f ;\n\
lv2:minimum %f ;\n\
lv2:maximum %f ;\n\
] , [\n", 0.0, -1.0, 1.0, 0.0, -1.0, 1.0);
/* write input controls */
int index = ZLFO_GATE;
@ -344,9 +364,11 @@ int main ( @@ -344,9 +364,11 @@ int main (
"<" LFO_UI_URI ">\n\
a ui:X11UI ;\n\
lv2:requiredFeature urid:map ;\n\
lv2:optionalFeature log:log ;\n\
lv2:optionalFeature ui:noUserResize ;\n\
lv2:extensionData ui:idleInterface ;\n\
lv2:optionalFeature log:log ,\n\
ui:idleInterface,\n\
ui:noUserResize ;\n\
lv2:extensionData ui:idleInterface ,\n\
ui:showInterface ;\n\
ui:portNotification [\n\
ui:plugin \"" LFO_URI "\" ;\n\
lv2:symbol \"notify\" ;\n\

20
zlfo_ui.c → src/zlfo_ui.c

@ -158,6 +158,10 @@ typedef enum WaveMode @@ -158,6 +158,10 @@ typedef enum WaveMode
typedef struct ZLfoUi
{
/** Port values. */
float gate;
int trigger;
float cv_gate;
float cv_trigger;
float freq;
float shift;
float range_min;
@ -2004,6 +2008,22 @@ port_event ( @@ -2004,6 +2008,22 @@ port_event (
case ZLFO_FREQ:
self->freq = * (const float *) buffer;
break;
case ZLFO_CV_GATE:
self->cv_gate =
* (const float *) buffer;
break;
case ZLFO_CV_TRIGGER:
self->cv_trigger =
* (const float *) buffer;
break;
case ZLFO_GATE:
self->gate =
* (const float *) buffer;
break;
case ZLFO_TRIGGER:
self->trigger =
(int) * (const float *) buffer;
break;
case ZLFO_SHIFT:
self->shift = * (const float *) buffer;
break;

0
zlfo_ui_theme.h → src/zlfo_ui_theme.h

2
subprojects/ztoolkit.wrap

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
[wrap-git]
url = https://git.zrythm.org/git/ztoolkit
revision = 4f99c80ace84818eac8477b11cd0a785223f5d15
revision = 371c2bc8d3853ab12f8ec06c4e41156842ad0a43

37
tests/meson.build

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
# Copyright (C) 2019-2020 Alexandros Theodotou <alex at zrythm dot org>
#
# This file is part of ZLFO
#
# ZLFO is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ZLFO 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
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with ZLFO. If not, see <https://www.gnu.org/licenses/>.
lv2lint = find_program ('lv2lint', required: false)
lv2_validate = find_program (
'lv2_validate', required: false)
sord_validate = find_program (
'sord_validate', required: false)
if (lv2lint.found())
test (
'LV2 lint', lv2lint,
env: ['LV2_PATH=' + zlfo_build_dir + '/'],
args: [
'-I', zlfo_build_dir + '/',
zlfo_cdata.get ('LFO_URI')])
endif
if lv2_validate.found() and sord_validate.found()
test (
'LV2 validate', lv2_validate,
args: zlfo_ttl)
endif
Loading…
Cancel
Save