1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
/* BSE - Better Sound Engine -*-mode: c;-*-
* Copyright (C) 2002 Tim Janik
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License should ship along
* with this library; if not, see http://www.gnu.org/copyleft/.
*/
#include <bse/bseplugin.h>
#include <bse/bseprocedure.h>
#include <bse/bsecontainer.h>
AUTHORS = "Tim Janik <timj@gtk.org>";
LICENSE = "GNU Lesser General Public License";
METHOD (BseContainer, list-children) {
HELP = _("Retrieve all immediate children of a container");
IN = bse_param_spec_object ("container", NULL, NULL, BSE_TYPE_CONTAINER, SFI_PARAM_STANDARD);
OUT = bse_param_spec_boxed ("item_list", NULL, NULL, BSE_TYPE_ITEM_SEQ, SFI_PARAM_STANDARD);
} BODY (BseProcedureClass *proc,
const GValue *in_values,
GValue *out_values)
{
/* extract parameter values */
BseContainer *container = bse_value_get_object (in_values++);
/* check parameters */
if (!BSE_IS_CONTAINER (container))
return BSE_ERROR_PROC_PARAM_INVAL;
/* set output parameters */
bse_value_take_boxed (out_values++, bse_container_list_children (container));
return BSE_ERROR_NONE;
}
METHOD (BseContainer, lookup-item) {
HELP = ("Find an immediate child of a container from its uname (the uname "
"is the name of the item, unique between all immediate children of a container).");
IN = bse_param_spec_object ("container", "Container", "The Container", BSE_TYPE_CONTAINER, SFI_PARAM_STANDARD);
IN = sfi_pspec_string ("uname", "UName", "Unique item name", NULL, SFI_PARAM_STANDARD);
OUT = bse_param_spec_object ("item", "Item", "The item named by uname", BSE_TYPE_ITEM, SFI_PARAM_STANDARD);
} BODY (BseProcedureClass *proc,
const GValue *in_values,
GValue *out_values)
{
/* extract parameter values */
BseContainer *container = bse_value_get_object (in_values++);
gchar *uname = sfi_value_get_string (in_values++);
/* check parameters */
if (!BSE_IS_CONTAINER (container) || !uname)
return BSE_ERROR_PROC_PARAM_INVAL;
/* set output parameters */
bse_value_set_object (out_values++, bse_container_lookup_item (container, uname));
return BSE_ERROR_NONE;
}
METHOD (BseContainer, get-item) {
HELP = "Retrieve a containers immediate child from it's sequential id.";
IN = bse_param_spec_object ("container", NULL, NULL, BSE_TYPE_CONTAINER, SFI_PARAM_STANDARD);
IN = sfi_pspec_string ("item_type", NULL, "Type of the item to retrieve",
NULL, SFI_PARAM_STANDARD);
IN = sfi_pspec_int ("seq_id", NULL, "Sequential ID",
0, 0, G_MAXINT, 1, SFI_PARAM_STANDARD);
OUT = bse_param_spec_object ("item", NULL, "The item with seqid as requested", BSE_TYPE_ITEM, SFI_PARAM_STANDARD);
} BODY (BseProcedureClass *proc,
const GValue *in_values,
GValue *out_values)
{
/* extract parameter values */
BseContainer *container = bse_value_get_object (in_values++);
const gchar *type_name = sfi_value_get_string (in_values++);
guint seqid = sfi_value_get_int (in_values++);
GType type = type_name ? g_type_from_name (type_name) : 0;
/* check parameters */
if (!BSE_IS_CONTAINER (container) || !g_type_is_a (type, BSE_TYPE_ITEM))
return BSE_ERROR_PROC_PARAM_INVAL;
/* set output parameters */
bse_value_set_object (out_values++, bse_container_get_item (container, type, seqid));
return BSE_ERROR_NONE;
}
|