1 | //filter-slfi-helloworld.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012-2014 |
---|
5 | * |
---|
6 | * This file is part of roard a part of RoarAudio, |
---|
7 | * a cross-platform sound system for both, home and professional use. |
---|
8 | * See README for details. |
---|
9 | * |
---|
10 | * This file is free software; you can redistribute it and/or modify |
---|
11 | * it under the terms of the GNU General Public License version 3 |
---|
12 | * as published by the Free Software Foundation. |
---|
13 | * |
---|
14 | * RoarAudio is distributed in the hope that it will be useful, |
---|
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | * GNU General Public License for more details. |
---|
18 | * |
---|
19 | * You should have received a copy of the GNU General Public License |
---|
20 | * along with this software; see the file COPYING. If not, write to |
---|
21 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, |
---|
22 | * Boston, MA 02110-1301, USA. |
---|
23 | * |
---|
24 | */ |
---|
25 | |
---|
26 | #include <roaraudio.h> |
---|
27 | #include <libroarlight/libroarlight.h> |
---|
28 | |
---|
29 | static int __update(struct roar_slfi_inst * inst, uint8_t * universe, ssize_t size_of_universe, int32_t usecspassed, const uint8_t * event, size_t eventlen) { |
---|
30 | (void)inst, (void)usecspassed, (void)event, (void)eventlen; |
---|
31 | |
---|
32 | if ( size_of_universe >= 2 ) |
---|
33 | universe[1] = universe[0]/2; |
---|
34 | return 0; |
---|
35 | } |
---|
36 | |
---|
37 | static const struct roar_slfi_filter filter[1] = { |
---|
38 | { |
---|
39 | .name = "helloworld", |
---|
40 | .description = "example SLFI filter", |
---|
41 | .flags = ROAR_SLFI_FLAG_ON_UPDATE, |
---|
42 | .init = NULL, |
---|
43 | .uninit = NULL, |
---|
44 | .update = __update, |
---|
45 | .ctl = NULL |
---|
46 | } |
---|
47 | }; |
---|
48 | |
---|
49 | ROAR_DL_PLUGIN_REG_SLFI(filter); |
---|
50 | |
---|
51 | // This is the plugin control block. |
---|
52 | ROAR_DL_PLUGIN_START(filter_slfi_helloworld) { |
---|
53 | // Here we set the name and vendor of our plugin. |
---|
54 | // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV(). |
---|
55 | ROAR_DL_PLUGIN_META_PRODUCT_NIV("filter-slfi-helloworld", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); |
---|
56 | |
---|
57 | // This sets the version of your plugin. |
---|
58 | ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); |
---|
59 | |
---|
60 | // This sets the license of your plugin. |
---|
61 | // If there is no tag for the license you use you can just |
---|
62 | // use ROAR_DL_PLUGIN_META_LICENSE(). |
---|
63 | ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); |
---|
64 | |
---|
65 | // This sets the author and contact infos. |
---|
66 | // There are several other macros to do this with other parameters. |
---|
67 | // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation. |
---|
68 | ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); |
---|
69 | |
---|
70 | // This sets the description for your plugin. |
---|
71 | ROAR_DL_PLUGIN_META_DESC("This plugin acts as simple example for SLFI plugins."); |
---|
72 | |
---|
73 | // Load filters. |
---|
74 | ROAR_DL_PLUGIN_REG_FNFUNC(ROAR_DL_FN_FILTER); |
---|
75 | |
---|
76 | // This is the end of the control block. |
---|
77 | } ROAR_DL_PLUGIN_END |
---|
78 | |
---|
79 | //ll |
---|