Stereo plugin
[lv2fil.git] / lv2plugin.c
blob6e340670edaa8caff371d68726fce2343c2a5a0e
1 /* -*- Mode: C ; c-basic-offset: 2 -*- */
2 /*****************************************************************************
4 * Copyright (C) 2006,2007,2008,2009 Nedko Arnaudov <nedko@arnaudov.name>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *****************************************************************************/
21 #include <stdlib.h>
22 #include <lv2.h>
24 #include "lv2filter.h"
25 #define LOG_LEVEL LOG_LEVEL_DEBUG
26 #include "log.h"
28 static LV2_Descriptor g_lv2_plugins[] =
31 .URI = LV2FILTER_MONO_URI,
32 .instantiate = lv2filter_instantiate,
33 .connect_port = lv2filter_connect_port,
34 .run = lv2filter_run,
35 .cleanup = lv2filter_cleanup,
36 .extension_data = lv2filter_extension_data
39 .URI = LV2FILTER_STEREO_URI,
40 .instantiate = lv2filter_instantiate,
41 .connect_port = lv2filter_connect_port,
42 .run = lv2filter_run,
43 .cleanup = lv2filter_cleanup,
44 .extension_data = lv2filter_extension_data
47 .URI = NULL
51 static int g_lv2_plugins_count;
53 void lv2_initialise() __attribute__((constructor));
54 void lv2_initialise()
56 const LV2_Descriptor * descr_ptr;
58 LOG_DEBUG("lv2_initialise() called.");
60 descr_ptr = g_lv2_plugins;
62 while (descr_ptr->URI != NULL)
64 g_lv2_plugins_count++;
65 descr_ptr++;
69 const LV2_Descriptor* lv2_descriptor(uint32_t index)
71 LOG_DEBUG("lv2_descriptor(%u) called.", (unsigned int)index);
73 if (index >= g_lv2_plugins_count)
75 LOG_DEBUG("plugin at index %u not found.", (unsigned int)index);
76 return NULL;
79 LOG_DEBUG("<%s> found.", g_lv2_plugins[index].URI);
80 return g_lv2_plugins + index;