-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGmpiApiCommon.h
144 lines (119 loc) · 3.7 KB
/
GmpiApiCommon.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#pragma once
#ifndef _GMPI_API_COMMON_H_INCLUDED // ignore source file in multiple locations.
#define _GMPI_API_COMMON_H_INCLUDED
/*
GMPI - Generalized Music Plugin Interface specification.
Copyright 2007-2024 Jeff McClintock.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <cstdint>
#include <cstring>
// Platform specific definitions.
#if defined __BORLANDC__
#pragma -a8
#elif defined(_WIN32) || defined(__FLAT__) || defined (CBUILDER)
#pragma pack(push,8)
#endif
#ifndef DECLSPEC_NOVTABLE
#if defined(__cplusplus) && defined(_MSC_VER)
#define DECLSPEC_NOVTABLE __declspec(novtable)
#else
#define DECLSPEC_NOVTABLE
#endif
#endif
namespace gmpi
{
enum class ReturnCode : int32_t
{
Ok = 0, // Success.
Handled = 1, // Success, no further handing required.
Fail = -1, // General failure.
Unhandled = -1, // Event not handled.
NoSupport = -2, // Interface not supported.
Cancel = -3, // Async operation cancelled.
};
enum class PinDirection : int32_t
{
In,
Out,
};
enum class PinDatatype : int32_t
{
Enum,
String,
Midi,
Float64,
Bool,
Audio,
Float32,
Int32 = 8,
Int64,
Blob,
};
namespace api
{
enum class PluginSubtype : int32_t
{
Audio = 0, // An audio processor object.
Editor = 2, // A graphical editor object.
Controller = 4, // A controller object.
};
struct Guid
{
uint32_t data1;
uint16_t data2;
uint16_t data3;
uint8_t data4[8];
};
// Helper for comparing GUIDs
inline bool operator==(Guid const& left, Guid const& right)
{
return !std::memcmp(&left, &right, sizeof(left));
}
// INTERFACE 'IUnknown'
struct DECLSPEC_NOVTABLE IUnknown
{
virtual ReturnCode queryInterface(const Guid* iid, void** returnInterface) = 0;
virtual int32_t addRef() = 0;
virtual int32_t release() = 0;
// {00000000-0000-C000-0000-000000000046}
inline static const Guid guid =
{ 0x00000000, 0x0000, 0xC000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46} };
};
// INTERFACE 'IString'
struct DECLSPEC_NOVTABLE IString : public IUnknown
{
virtual ReturnCode setData(const char* data, int32_t size) = 0;
virtual int32_t getSize() = 0;
virtual const char* getData() = 0;
// {AB8FFB21-44FF-42B7-8885-29431399E7E4}
inline static const Guid guid =
{ 0xAB8FFB21, 0x44FF, 0x42B7, { 0x88, 0x85, 0x29, 0x43, 0x13, 0x99, 0xE7, 0xE4} };
};
// INTERFACE 'IPluginFactory'
struct DECLSPEC_NOVTABLE IPluginFactory : public IUnknown
{
virtual ReturnCode createInstance(const char* id, PluginSubtype subtype, void** returnInterface) = 0;
virtual ReturnCode getPluginInformation(int32_t index, IString* returnXml) = 0;
// {31DC1CD9-6BDF-412A-B758-B2E5CD1D8870}
inline static const Guid guid =
{ 0x31DC1CD9, 0x6BDF, 0x412A, { 0xB7, 0x58, 0xB2, 0xE5, 0xCD, 0x1D, 0x88, 0x70} };
};
} // namespace api
} // namespace gmpi
// Platform specific definitions.
#if defined __BORLANDC__
#pragma -a-
#elif defined(_WIN32) || defined(__FLAT__) || defined (CBUILDER)
#pragma pack(pop)
#endif
#endif // _GMPI_API_COMMON_H_