commit 9cd8bf0f17f1ebc2d19cc769f667c2ea77cc01ad
parent 90f6add649b3652f003247f4371d08cddb4ab7ab
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date: Mon, 17 Oct 2016 10:18:00 +0200
Many updates
Diffstat:
5 files changed, 152 insertions(+), 97 deletions(-)
diff --git a/include/clap/clap.h b/include/clap/clap.h
@@ -212,6 +212,7 @@ struct clap_event
struct clap_event *next; // linked list, NULL on end
enum clap_event_type type;
int64_t time; // offset from the first sample in the process block
+ int32_t port; // event port id
union {
struct clap_event_note note;
@@ -248,7 +249,8 @@ struct clap_process
/* Linked list of events
* The plugin must not modify those events. */
- struct clap_event *events;
+ struct clap_event *in_events;
+ struct clap_event *out_events;
};
//////////
diff --git a/include/clap/ext/audio-ports.h b/include/clap/ext/audio-ports.h
@@ -0,0 +1,95 @@
+#ifndef CLAP_EXT_AUDIO_PORTS_H
+# define CLAP_EXT_AUDIO_PORTS_H
+
+# include "../clap.h"
+
+# define CLAP_EXT_AUDIO_PORTS "clap/audio-ports"
+
+enum clap_audio_port_channel_mapping
+{
+ CLAP_AUDIO_PORT_UNSPECIFIED = 0,
+ CLAP_AUDIO_PORT_MONO = 1,
+
+ // left, right
+ CLAP_AUDIO_PORT_STEREO = 2,
+
+ // front left, front right, center, low, surround left, surround right
+ // surround back left, surround back right
+ CLAP_AUDIO_PORT_SURROUND = 3,
+};
+
+enum clap_audio_port_role
+{
+ CLAP_AUDIO_PORT_INOUT = 0,
+ CLAP_AUDIO_PORT_SIDECHAIN = 1,
+ CLAP_AUDIO_PORT_MODULATION = 2,
+};
+
+struct clap_audio_port_info
+{
+ int32_t id;
+ bool is_input;
+ int32_t channel_count;
+ enum clap_audio_port_channel_mapping channel_mapping;
+ enum clap_audio_port_role role;
+ char name[CLAP_NAME_SIZE];
+
+ /* If true, then this is a virtual port which can be cloned
+ * and connected multiple times.
+ * Only useful for input ports. */
+ bool is_cloneable;
+};
+
+struct clap_audio_port
+{
+ int32_t channel_count;
+ enum clap_audio_port_channel_mapping channel_mapping;
+ float **data;
+};
+
+/* The audio ports configuration has to be done while the plugin is
+ * deactivated. */
+struct clap_plugin_audio_ports
+{
+ /* number of ports, including inputs and outputs */
+ int32_t (*get_count)(struct clap_plugin *plugin);
+
+ /* get info about about an audio port. */
+ void (*get_info)(struct clap_plugin *plugin,
+ int32_t index,
+ struct clap_audio_port_info *info);
+
+ /* Connect the given port to the plugin's port at index.
+ * user_name is the name of the peer port given by the host/user.
+ * It can be useful especialy for repeatable ports.
+ * Returns the id of the port. In case of repeatable port,
+ * make sure that each connected port has a different id.
+ * Returns -1 if the connection failed. */
+ int32_t (*connect)(struct clap_plugin *plugin,
+ int32_t port_id,
+ const struct clap_audio_port *port,
+ const char *user_name);
+
+ void (*disconnect)(struct clap_plugin *plugin,
+ int32_t port_id);
+
+ /* Returns the absolute port latency in samples. */
+ int32_t (*get_latency)(struct clap_plugin *plugin,
+ int32_t port_id);
+};
+
+struct clap_host_audio_ports
+{
+ /* Tell the host that the plugin ports has changed.
+ * The host shall deactivate the plugin and then
+ * scan the ports again. */
+ void (*changed)(struct clap_host *host,
+ struct clap_plugin *plugin);
+
+ /* Tell the host that the latency changed. The host should
+ * call get_port_latency on each ports. */
+ void (*latency_changed)(struct clap_host *host,
+ struct clap_plugin *plugin);
+};
+
+#endif /* !CLAP_EXT_PORT_H */
diff --git a/include/clap/ext/event-ports.h b/include/clap/ext/event-ports.h
@@ -0,0 +1,46 @@
+#ifndef CLAP_EVENT_PORTS_H
+# define CLAP_EVENT_PORTS_H
+
+# include "../clap.h"
+
+# define CLAP_EXT_EVENT_PORTS "clap/event-ports"
+
+struct clap_audio_port_info
+{
+ int32_t id;
+ bool is_input;
+ char name[CLAP_NAME_SIZE];
+
+ /* If true, then this is a virtual port which can be cloned
+ * and connected multiple times.
+ * Only useful for input ports. */
+ bool is_cloneable;
+};
+
+struct clap_plugin_event_ports
+{
+ /* number of ports, including inputs and outputs */
+ int32_t (*get_count)(struct clap_plugin *plugin);
+
+ /* get info about about an event port. */
+ void (*get_info)(struct clap_plugin *plugin,
+ int32_t index,
+ struct clap_event_port_info *info);
+
+ /* Clones a clonable port.
+ * On success returns a unique port id, for the cloned port.
+ * On failure, returns -1.
+ * user_name is a string provided by the host to tell the
+ * plugin how to name the new cloned port.
+ */
+ int32_t (*clone_port)(struct clap_plugin *plugin,
+ int32_t port_id,
+ const char *user_name);
+
+ /* When the host is done with a cloned port, it can call
+ * release_port() to release the resources. */
+ int32_t (*release_port)(struct clap_plugin *plugin,
+ int32_t port_id);
+};
+
+#endif /* !EVENT_PORTS_H */
diff --git a/include/clap/ext/ports.h b/include/clap/ext/ports.h
@@ -1,94 +0,0 @@
-#ifndef CLAP_EXT_AUDIO_PORTS_H
-# define CLAP_EXT_AUDIO_PORTS_H
-
-# include "../clap.h"
-
-# define CLAP_EXT_AUDIO_PORTS "clap/audio-ports"
-
-enum clap_audio_port_channel_mapping
-{
- CLAP_AUDIO_PORT_UNSPECIFIED = 0,
- CLAP_AUDIO_PORT_MONO = 1,
-
- // left, right
- CLAP_AUDIO_PORT_STEREO = 2,
-
- // front left, front right, center, low, surround left, surround right
- // surround back left, surround back right
- CLAP_AUDIO_PORT_SURROUND = 3,
-};
-
-enum clap_audio_port_role
-{
- CLAP_AUDIO_PORT_INOUT = 0,
- CLAP_AUDIO_PORT_SIDECHAIN = 1,
- CLAP_AUDIO_PORT_MODULATION = 2,
-};
-
-struct clap_audio_port_info
-{
- int32_t id;
- bool is_input;
- int32_t channel_count;
- enum clap_audio_port_channel_mapping channel_mapping;
- enum clap_audio_port_role role;
- char name[CLAP_NAME_SIZE];
-
- /* If false, then the port can be connected only once.
- * If true, then this is a virtual port which can be cloned
- * and connected multiple times. */
- bool is_repeatable;
-};
-
-struct clap_audio_port
-{
- int32_t channel_count;
- enum clap_audio_port_channel_mapping channel_mapping;
- float **data;
-};
-
-/* The audio ports configuration has to be done while the plugin is
- * deactivated. */
-struct clap_plugin_audio_ports
-{
- /* number of ports, including inputs and outputs */
- int32_t (*get_count)(struct clap_plugin *plugin);
-
- void (*get_info)(struct clap_plugin *plugin,
- int32_t index,
- struct clap_audio_port_info *info);
-
- /* Connect the given port to the plugin's port at index.
- * user_name is the name of the peer port given by the host/user.
- * It can be useful especialy for repeatable ports.
- * Returns the id of the port. In case of repeatable port,
- * make sure that each connected port has a different id.
- * Returns -1 if the connection failed. */
- int32_t (*connect)(struct clap_plugin *plugin,
- int32_t port_id,
- const struct clap_audio_port *port,
- const char *user_name);
-
- void (*disconnect)(struct clap_plugin *plugin,
- int32_t port_id);
-
- /* Returns the absolute port latency in samples. */
- int32_t (*get_latency)(struct clap_plugin *plugin,
- int32_t port_id);
-};
-
-struct clap_host_audio_ports
-{
- /* Tell the host that the plugin ports has changed.
- * The host shall deactivate the plugin and then
- * scan the ports again. */
- void (*changed)(struct clap_host *host,
- struct clap_plugin *plugin);
-
- /* Tell the host that the latency changed. The host should
- * call get_port_latency on each ports. */
- void (*latency_changed)(struct clap_host *host,
- struct clap_plugin *plugin);
-};
-
-#endif /* !CLAP_EXT_PORT_H */
diff --git a/spec.rst b/spec.rst
@@ -565,10 +565,16 @@ clap/ext/state.h
.. include:: include/clap/ext/state.h
:code: c
-clap/ext/ports.h
+clap/ext/audio-ports.h
----------------
-.. include:: include/clap/ext/ports.h
+.. include:: include/clap/ext/audio-ports.h
+ :code: c
+
+clap/ext/event-ports.h
+----------------
+
+.. include:: include/clap/ext/event-ports.h
:code: c
clap/ext/params.h