source: roaraudio/plugins/universal/helloworld.c @ 5483:39ed701a5718

Last change on this file since 5483:39ed701a5718 was 5483:39ed701a5718, checked in by phi, 12 years ago

support setting a non-default greeting

File size: 2.7 KB
Line 
1//helloworld.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2012
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
28// A simple function printing our message.
29static int hw_init (struct roar_dl_librarypara * para) {
30 const char * text = "Hello world!";
31 struct roar_keyval * arg;
32
33 (void)para; // We ignore all parameters passed to us.
34
35 if ( para != NULL && para->argv != NULL ) {
36  arg = roar_keyval_lookup(para->argv, "text", para->argc, 0);
37  if ( arg != NULL && arg->value != NULL )
38   text = arg->value;
39 }
40
41 roar_vio_printf(roar_stdout, "%s\n", text);
42
43 return 0;
44}
45
46// This struct contains the AppSched pointers.
47static struct roar_dl_appsched sched = {
48 .init   = hw_init,
49 .free   = NULL,
50 .update = NULL,
51 .tick   = NULL,
52 .wait   = NULL
53};
54
55// This is the plugin control block.
56ROAR_DL_PLUGIN_START(helloworld) {
57 // Here we set the name and vendor of our plugin.
58 // If you have no Vendor ID you need to use ROAR_DL_PLUGIN_META_PRODUCT_NV().
59 ROAR_DL_PLUGIN_META_PRODUCT_NIV("helloworld", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
60
61 // This sets the version of your plugin.
62 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
63
64 // This sets the license of your plugin.
65 // If there is no tag for the license you use you can just
66 // use ROAR_DL_PLUGIN_META_LICENSE().
67 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
68
69 // This sets the author and contact infos.
70 // There are several other macros to do this with other parameters.
71 // See ROAR_DL_PLUGIN_META_CONTACT*() in the header or documentation.
72 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
73
74 // This sets the description for your plugin.
75 ROAR_DL_PLUGIN_META_DESC("This plugin prints the string \"Hello world!\".");
76
77 // Here the AppSched block from above is registered.
78 ROAR_DL_PLUGIN_REG_APPSCHED(&sched);
79
80// This is the end of the control block.
81} ROAR_DL_PLUGIN_END
82
83//ll
Note: See TracBrowser for help on using the repository browser.