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