1 /*
2   Copyright (C) 2012 David Robillard <d@drobilla.net>
3 
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8 
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   GNU General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with this program; if not, write to the Free Software
16   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 #include "cs_chorus.h"
20 #include "plugin_lv2.h"
21 
22 #include "lv2/core/lv2.h"
23 
24 #include <cstddef>
25 #include <cstdint>
26 
27 extern "C" {
28 
29 static LV2_Handle
instantiate1(const LV2_Descriptor * descriptor,double rate,const char * bundle_path,const LV2_Feature * const * features)30 instantiate1(const LV2_Descriptor*     descriptor,
31              double                    rate,
32              const char*               bundle_path,
33              const LV2_Feature* const* features)
34 {
35 	return new Ladspa_CS_chorus1(rate);
36 }
37 
38 static LV2_Handle
instantiate2(const LV2_Descriptor * descriptor,double rate,const char * bundle_path,const LV2_Feature * const * features)39 instantiate2(const LV2_Descriptor*     descriptor,
40              double                    rate,
41              const char*               bundle_path,
42              const LV2_Feature* const* features)
43 {
44 	return new Ladspa_CS_chorus2(rate);
45 }
46 
47 static LV2_Handle
instantiate3(const LV2_Descriptor * descriptor,double rate,const char * bundle_path,const LV2_Feature * const * features)48 instantiate3(const LV2_Descriptor*     descriptor,
49              double                    rate,
50              const char*               bundle_path,
51              const LV2_Feature* const* features)
52 {
53 	return new Ladspa_CS_chorus3(rate);
54 }
55 
56 static const LV2_Descriptor descriptors[3] = {
57 	{ "http://drobilla.net/plugins/fomp/cs_chorus1",
58 	  instantiate1,
59 	  connect_port,
60 	  activate,
61 	  run,
62 	  deactivate,
63 	  cleanup,
64 	  NULL },
65 	{ "http://drobilla.net/plugins/fomp/cs_chorus2",
66 	  instantiate2,
67 	  connect_port,
68 	  activate,
69 	  run,
70 	  deactivate,
71 	  cleanup,
72 	  NULL },
73 	{ "http://drobilla.net/plugins/fomp/triple_chorus",
74 	  instantiate3,
75 	  connect_port,
76 	  activate,
77 	  run,
78 	  deactivate,
79 	  cleanup,
80 	  NULL },
81 };
82 
83 LV2_SYMBOL_EXPORT
84 const LV2_Descriptor*
lv2_descriptor(uint32_t index)85 lv2_descriptor(uint32_t index)
86 {
87 	if (index < 3) {
88 		return &descriptors[index];
89 	}
90 	return NULL;
91 }
92 
93 }  // extern "C"
94