1 /*
2  * Copyright (C) 2020-2021 Alexandros Theodotou <alex at zrythm dot org>
3  *
4  * This file is part of Zrythm
5  *
6  * Zrythm is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Zrythm is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with Zrythm.  If not, see <https://www.gnu.org/licenses/>.
18  */
19 
20 /**
21  * \file
22  *
23  * Carla discovery.
24  */
25 
26 #ifndef __PLUGINS_CARLA_DISCOVERY_H__
27 #define __PLUGINS_CARLA_DISCOVERY_H__
28 
29 #include "zrythm-config.h"
30 
31 #ifdef HAVE_CARLA
32 
33 #include "plugins/plugin_descriptor.h"
34 #include "settings/plugin_settings.h"
35 
36 #include <CarlaUtils.h>
37 
38 typedef struct PluginDescriptor PluginDescriptor;
39 
40 /**
41  * @addtogroup plugins
42  *
43  * @{
44  */
45 
46 /**
47  * Returns the absolute path to carla-discovery-*
48  * as a newly allocated string.
49  */
50 char *
51 z_carla_discovery_get_discovery_path (
52   PluginArchitecture arch);
53 
54 /**
55  * Runs carla discovery for the given arch with the
56  * given arguments and returns the output as a
57  * newly allocated string.
58  */
59 char *
60 z_carla_discovery_run (
61   PluginArchitecture arch,
62   const char *       arg1,
63   const char *       arg2);
64 
65 /**
66  * Create a descriptor using carla discovery.
67  *
68  * @path Path to the plugin bundle.
69  * @arch Architecture.
70  * @protocol Protocol.
71  *
72  * @return A newly allocated array of newly
73  *   allocated PluginDescriptor's.
74  */
75 PluginDescriptor **
76 z_carla_discovery_create_descriptors_from_file (
77   const char *       path,
78   PluginArchitecture arch,
79   PluginProtocol     protocol);
80 
81 /**
82  * Create a descriptor for the given AU plugin.
83  */
84 PluginDescriptor *
85 z_carla_discovery_create_au_descriptor_from_info (
86   const CarlaCachedPluginInfo * info);
87 
88 /**
89  * Create a descriptor for the given AU plugin.
90  */
91 PluginDescriptor *
92 z_carla_discovery_create_au_descriptor_from_string (
93   const char * all_plugins,
94   int          idx);
95 
96 /**
97  * Parses plugin info into a new NULL-terminated
98  * PluginDescriptor array.
99  *
100  * @param plugin_path Identifier to use for
101  *   debugging.
102  *
103  * @return A newly allocated array of newly allocated
104  *   descriptors, or NULL if no descriptors found.
105  */
106 PluginDescriptor **
107 z_carla_discovery_parse_plugin_info (
108   const char * plugin_path,
109   char *       results);
110 
111 /**
112  * @}
113  */
114 
115 #endif
116 #endif
117