1 /*
2  * travesty, pure C VST3-compatible interface
3  * Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any purpose with
6  * or without fee is hereby granted, provided that the above copyright notice and this
7  * permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10  * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11  * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #pragma once
18 
19 #include "base.h"
20 
21 #include "align_push.h"
22 
23 /**
24  * attribute list
25  */
26 
27 struct v3_attribute_list {
28 	struct v3_funknown;
29 
30 	v3_result (V3_API* set_int)(void* self, const char* id, int64_t value);
31 	v3_result (V3_API* get_int)(void* self, const char* id, int64_t* value);
32 	v3_result (V3_API* set_float)(void* self, const char* id, double value);
33 	v3_result (V3_API* get_float)(void* self, const char* id, double* value);
34 	v3_result (V3_API* set_string)(void* self, const char* id, const int16_t* string);
35 	v3_result (V3_API* get_string)(void* self, const char* id, int16_t* string, uint32_t size);
36 	v3_result (V3_API* set_binary)(void* self, const char* id, const void* data, uint32_t size);
37 	v3_result (V3_API* get_binary)(void* self, const char* id, const void** data, uint32_t* size);
38 };
39 
40 static constexpr const v3_tuid v3_attribute_list_iid =
41 	V3_ID(0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4);
42 
43 /**
44  * message
45  */
46 
47 struct v3_message {
48 	struct v3_funknown;
49 
50 	const char* (V3_API* get_message_id)(void* self);
51 	void (V3_API* set_message_id)(void* self, const char* id);
52 	v3_attribute_list** (V3_API* get_attributes)(void* self);
53 };
54 
55 static constexpr const v3_tuid v3_message_iid =
56 	V3_ID(0x936F033B, 0xC6C047DB, 0xBB0882F8, 0x13C1E613);
57 
58 /**
59  * connection point
60  */
61 
62 struct v3_connection_point {
63 	struct v3_funknown;
64 
65 	v3_result (V3_API* connect)(void* self, struct v3_connection_point** other);
66 	v3_result (V3_API* disconnect)(void* self, struct v3_connection_point** other);
67 	v3_result (V3_API* notify)(void* self, struct v3_message** message);
68 };
69 
70 static constexpr const v3_tuid v3_connection_point_iid =
71 	V3_ID(0x70A4156F, 0x6E6E4026, 0x989148BF, 0xAA60D8D1);
72 
73 #ifdef __cplusplus
74 
75 /**
76  * C++ variants
77  */
78 
79 struct v3_attribute_list_cpp : v3_funknown {
80 	v3_attribute_list attrlist;
81 };
82 
83 struct v3_message_cpp : v3_funknown {
84 	v3_message msg;
85 };
86 
87 struct v3_connection_point_cpp : v3_funknown {
88 	v3_connection_point point;
89 };
90 
91 #endif
92 
93 #include "align_pop.h"
94