Signed-off-by: falkTX <falktx@falktx.com>tags/v2.4.1
@@ -0,0 +1,9 @@ | |||
This folder contains a pure C VST3-compatible interface, codenamed "travesty". | |||
Name is a play on words from morphing "vestige" (the good old free VST2 reverse-engineered header file) and "three". | |||
The main target is to be able to create VST3-compatible plugins without a bloated SDK. | |||
Everything that is required for plugins fits in a few small header files as presented here. | |||
Also being able to build VST3-compatible plugins in pure C code, something not possible with the original SDK. | |||
Please note this project is still a work in progress. | |||
Use at your own risk, and please report any issues to https://github.com/DISTRHO/DPF/. |
@@ -0,0 +1,38 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#if defined(__APPLE__) | |||
# if defined(__clang__) | |||
# pragma clang diagnostic push | |||
# pragma clang diagnostic ignored "-Wpragma-pack" | |||
# elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
# pragma GCC diagnostic push | |||
# pragma GCC diagnostic ignored "-Wunknown-warning-option" | |||
# pragma GCC diagnostic ignored "-Wpragma-pack" | |||
# endif | |||
#endif | |||
#if defined(__APPLE__) || defined(_WIN32) | |||
# pragma pack(pop) | |||
#endif | |||
#if defined(__APPLE__) | |||
# if defined(__clang__) | |||
# pragma clang diagnostic pop | |||
# elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
# pragma GCC diagnostic pop | |||
# endif | |||
#endif |
@@ -0,0 +1,44 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#if defined(__APPLE__) | |||
# if defined(__clang__) | |||
# pragma clang diagnostic push | |||
# pragma clang diagnostic ignored "-Wunknown-warning-option" | |||
# pragma clang diagnostic ignored "-Wpragma-pack" | |||
# elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 460 | |||
# pragma GCC diagnostic push | |||
# pragma GCC diagnostic ignored "-Wunknown-warning-option" | |||
# pragma GCC diagnostic ignored "-Wpragma-pack" | |||
# endif | |||
# if defined(__LP64__) || defined(_LP64) | |||
# pragma pack(push, 16) | |||
# else | |||
# pragma pack(push, 1) | |||
# endif | |||
#elif defined(_WIN32) | |||
# pragma pack(push) | |||
# if defined(_WIN64) || defined(_M_ARM64) | |||
# pragma pack(16) | |||
# else | |||
# pragma pack(8) | |||
# endif | |||
#endif |
@@ -0,0 +1,265 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
#include "events.h" | |||
#include "align_push.h" | |||
/** | |||
* speakers | |||
*/ | |||
typedef uint64_t v3_speaker_arrangement; | |||
enum { | |||
V3_SPEAKER_L = 1 << 0, | |||
V3_SPEAKER_R = 1 << 1, | |||
V3_SPEAKER_M = 1 << 19 | |||
}; | |||
/** | |||
* process setup | |||
*/ | |||
enum v3_process_mode { | |||
V3_REALTIME, | |||
V3_PREFETCH, | |||
V3_OFFLINE | |||
}; | |||
static inline | |||
const char* v3_process_mode_str(int32_t d) | |||
{ | |||
switch (d) | |||
{ | |||
case V3_REALTIME: | |||
return "V3_REALTIME"; | |||
case V3_PREFETCH: | |||
return "V3_PREFETCH"; | |||
case V3_OFFLINE: | |||
return "V3_OFFLINE"; | |||
default: | |||
return "[unknown]"; | |||
} | |||
} | |||
enum { | |||
V3_SAMPLE_32, | |||
V3_SAMPLE_64 | |||
}; | |||
static inline | |||
const char* v3_sample_size_str(int32_t d) | |||
{ | |||
switch (d) | |||
{ | |||
case V3_SAMPLE_32: | |||
return "V3_SAMPLE_32"; | |||
case V3_SAMPLE_64: | |||
return "V3_SAMPLE_64"; | |||
default: | |||
return "[unknown]"; | |||
} | |||
} | |||
struct v3_process_setup { | |||
int32_t process_mode; | |||
int32_t symbolic_sample_size; | |||
int32_t max_block_size; | |||
double sample_rate; | |||
}; | |||
/** | |||
* param changes | |||
*/ | |||
struct v3_param_value_queue { | |||
struct v3_funknown; | |||
v3_param_id (V3_API* get_param_id)(void* self); | |||
int32_t (V3_API* get_point_count)(void* self); | |||
v3_result (V3_API* get_point)(void* self, int32_t idx, int32_t* sample_offset, double* value); | |||
v3_result (V3_API* add_point)(void* self, int32_t sample_offset, double value, int32_t* idx); | |||
}; | |||
static constexpr const v3_tuid v3_param_value_queue_iid = | |||
V3_ID(0x01263A18, 0xED074F6F, 0x98C9D356, 0x4686F9BA); | |||
struct v3_param_changes { | |||
struct v3_funknown; | |||
int32_t (V3_API* get_param_count)(void* self); | |||
struct v3_param_value_queue** (V3_API* get_param_data)(void* self, int32_t idx); | |||
struct v3_param_value_queue** (V3_API* add_param_data)(void* self, v3_param_id* id, int32_t* index); | |||
}; | |||
static constexpr const v3_tuid v3_param_changes_iid = | |||
V3_ID(0xA4779663, 0x0BB64A56, 0xB44384A8, 0x466FEB9D); | |||
/** | |||
* process context | |||
*/ | |||
struct v3_frame_rate { | |||
uint32_t fps; | |||
uint32_t flags; | |||
}; | |||
struct v3_chord { | |||
uint8_t key_note; | |||
uint8_t root_note; | |||
int16_t chord_mask; | |||
}; | |||
enum { | |||
V3_PROCESS_CTX_PLAYING = 1 << 1, | |||
V3_PROCESS_CTX_CYCLE_ACTIVE = 1 << 2, | |||
V3_PROCESS_CTX_RECORDING = 1 << 3, | |||
V3_PROCESS_CTX_SYSTEM_TIME_VALID = 1 << 8, | |||
V3_PROCESS_CTX_PROJECT_TIME_VALID = 1 << 9, | |||
V3_PROCESS_CTX_TEMPO_VALID = 1 << 10, | |||
V3_PROCESS_CTX_BAR_POSITION_VALID = 1 << 11, | |||
V3_PROCESS_CTX_CYCLE_VALID = 1 << 12, | |||
V3_PROCESS_CTX_TIME_SIG_VALID = 1 << 13, | |||
V3_PROCESS_CTX_SMPTE_VALID = 1 << 14, | |||
V3_PROCESS_CTX_NEXT_CLOCK_VALID = 1 << 15, | |||
V3_PROCESS_CTX_CONT_TIME_VALID = 1 << 17, | |||
V3_PROCESS_CTX_CHORD_VALID = 1 << 18 | |||
}; | |||
struct v3_process_context { | |||
uint32_t state; | |||
double sample_rate; | |||
int64_t project_time_in_samples; // with loop | |||
int64_t system_time_ns; | |||
int64_t continuous_time_in_samples; // without loop | |||
double project_time_quarters; | |||
double bar_position_quarters; | |||
double cycle_start_quarters; | |||
double cycle_end_quarters; | |||
double bpm; | |||
int32_t time_sig_numerator; | |||
int32_t time_sig_denom; | |||
struct v3_chord chord; | |||
int32_t smpte_offset_subframes; | |||
struct v3_frame_rate frame_rate; | |||
int32_t samples_to_next_clock; | |||
}; | |||
/** | |||
* process context requirements | |||
*/ | |||
enum { | |||
V3_PROCESS_CTX_NEED_SYSTEM_TIME = 1 << 0, | |||
V3_PROCESS_CTX_NEED_CONTINUOUS_TIME = 1 << 1, | |||
V3_PROCESS_CTX_NEED_PROJECT_TIME = 1 << 2, | |||
V3_PROCESS_CTX_NEED_BAR_POSITION = 1 << 3, | |||
V3_PROCESS_CTX_NEED_CYCLE = 1 << 4, | |||
V3_PROCESS_CTX_NEED_NEXT_CLOCK = 1 << 5, | |||
V3_PROCESS_CTX_NEED_TEMPO = 1 << 6, | |||
V3_PROCESS_CTX_NEED_TIME_SIG = 1 << 7, | |||
V3_PROCESS_CTX_NEED_CHORD = 1 << 8, | |||
V3_PROCESS_CTX_NEED_FRAME_RATE = 1 << 9, | |||
V3_PROCESS_CTX_NEED_TRANSPORT_STATE = 1 << 10 | |||
}; | |||
struct v3_process_context_requirements { | |||
struct v3_funknown; | |||
uint32_t (V3_API* get_process_context_requirements)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_process_context_requirements_iid = | |||
V3_ID(0x2A654303, 0xEF764E3D, 0x95B5FE83, 0x730EF6D0); | |||
/** | |||
* process data and context | |||
*/ | |||
struct v3_audio_bus_buffers { | |||
int32_t num_channels; | |||
uint64_t channel_silence_bitset; | |||
union { | |||
float** channel_buffers_32; | |||
double** channel_buffers_64; | |||
}; | |||
}; | |||
struct v3_process_data { | |||
int32_t process_mode; | |||
int32_t symbolic_sample_size; | |||
int32_t nframes; | |||
int32_t num_input_buses; | |||
int32_t num_output_buses; | |||
struct v3_audio_bus_buffers* inputs; | |||
struct v3_audio_bus_buffers* outputs; | |||
struct v3_param_changes** input_params; | |||
struct v3_param_changes** output_params; | |||
struct v3_event_list** input_events; | |||
struct v3_event_list** output_events; | |||
struct v3_process_context* ctx; | |||
}; | |||
/** | |||
* audio processor | |||
*/ | |||
struct v3_audio_processor { | |||
struct v3_funknown; | |||
v3_result (V3_API* set_bus_arrangements)(void* self, v3_speaker_arrangement* inputs, int32_t num_inputs, | |||
v3_speaker_arrangement* outputs, int32_t num_outputs); | |||
v3_result (V3_API* get_bus_arrangement)(void* self, int32_t bus_direction, int32_t idx, v3_speaker_arrangement*); | |||
v3_result (V3_API* can_process_sample_size)(void* self, int32_t symbolic_sample_size); | |||
uint32_t (V3_API* get_latency_samples)(void* self); | |||
v3_result (V3_API* setup_processing)(void* self, struct v3_process_setup* setup); | |||
v3_result (V3_API* set_processing)(void* self, v3_bool state); | |||
v3_result (V3_API* process)(void* self, struct v3_process_data* data); | |||
uint32_t (V3_API* get_tail_samples)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_audio_processor_iid = | |||
V3_ID(0x42043F99, 0xB7DA453C, 0xA569E79D, 0x9AAEC33D); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_param_value_queue_cpp : v3_funknown { | |||
v3_param_value_queue queue; | |||
}; | |||
struct v3_param_changes_cpp : v3_funknown { | |||
v3_param_changes changes; | |||
}; | |||
struct v3_process_context_requirements_cpp : v3_funknown { | |||
v3_process_context_requirements req; | |||
}; | |||
struct v3_audio_processor_cpp : v3_funknown { | |||
v3_audio_processor proc; | |||
}; | |||
#endif | |||
#include "align_pop.h" |
@@ -0,0 +1,213 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include <stdbool.h> | |||
#include <stdint.h> | |||
#include <string.h> | |||
/** | |||
* deal with C vs C++ differences | |||
*/ | |||
#ifdef __cplusplus | |||
/** | |||
* cast object into its proper C++ type. | |||
* this is needed because `struct v3_funknown;` on a C++ class does not inherit `v3_funknown`'s fields. | |||
* we can use this as a little helper for keeping both C and C++ compatiblity. | |||
* specialized templated calls are defined where required | |||
* (that is, object inherits from something other than `v3_funknown`) | |||
* | |||
* example usage: `v3_cpp_obj(obj)->method(obj, args...);` | |||
*/ | |||
template<class T> static inline | |||
constexpr T* v3_cpp_obj(T** obj) | |||
{ | |||
/** | |||
* this ugly piece of code is required due to C++ assuming `reinterpret_cast` by default, | |||
* but we need everything to be `static_cast` for it to be `constexpr` compatible. | |||
*/ | |||
return static_cast<T*>(static_cast<void*>(static_cast<uint8_t*>(static_cast<void*>(*obj)) + sizeof(void*)*3)); | |||
} | |||
#else | |||
# ifndef constexpr | |||
# define constexpr | |||
# endif | |||
#endif | |||
/** | |||
* various types | |||
*/ | |||
typedef int32_t v3_result; | |||
typedef int16_t v3_str_128[128]; | |||
typedef uint8_t v3_bool; | |||
typedef uint32_t v3_param_id; | |||
/** | |||
* low-level ABI nonsense | |||
*/ | |||
typedef uint8_t v3_tuid[16]; | |||
static inline | |||
bool v3_tuid_match(const v3_tuid a, const v3_tuid b) | |||
{ | |||
return memcmp(a, b, sizeof(v3_tuid)) == 0; | |||
} | |||
#if defined(_WIN32) | |||
# define V3_COM_COMPAT 1 | |||
# define V3_API __stdcall | |||
#else | |||
# define V3_COM_COMPAT 0 | |||
# define V3_API | |||
#endif | |||
#if V3_COM_COMPAT | |||
enum { | |||
V3_NO_INTERFACE = 0x80004002L, | |||
V3_OK = 0, | |||
V3_TRUE = 0, | |||
V3_FALSE = 1, | |||
V3_INVALID_ARG = 0x80070057L, | |||
V3_NOT_IMPLEMENTED = 0x80004001L, | |||
V3_INTERNAL_ERR = 0x80004005L, | |||
V3_NOT_INITIALIZED = 0x8000FFFFL, | |||
V3_NOMEM = 0x8007000EL | |||
}; | |||
# define V3_ID(a, b, c, d) { \ | |||
((a) & 0x000000FF), \ | |||
((a) & 0x0000FF00) >> 8, \ | |||
((a) & 0x00FF0000) >> 16, \ | |||
((a) & 0xFF000000) >> 24, \ | |||
\ | |||
((b) & 0x00FF0000) >> 16, \ | |||
((b) & 0xFF000000) >> 24, \ | |||
((b) & 0x000000FF), \ | |||
((b) & 0x0000FF00) >> 8, \ | |||
\ | |||
((c) & 0xFF000000) >> 24, \ | |||
((c) & 0x00FF0000) >> 16, \ | |||
((c) & 0x0000FF00) >> 8, \ | |||
((c) & 0x000000FF), \ | |||
\ | |||
((d) & 0xFF000000) >> 24, \ | |||
((d) & 0x00FF0000) >> 16, \ | |||
((d) & 0x0000FF00) >> 8, \ | |||
((d) & 0x000000FF), \ | |||
} | |||
#else // V3_COM_COMPAT | |||
enum { | |||
V3_NO_INTERFACE = -1, | |||
V3_OK, | |||
V3_TRUE = V3_OK, | |||
V3_FALSE, | |||
V3_INVALID_ARG, | |||
V3_NOT_IMPLEMENTED, | |||
V3_INTERNAL_ERR, | |||
V3_NOT_INITIALIZED, | |||
V3_NOMEM | |||
}; | |||
# define V3_ID(a, b, c, d) { \ | |||
((a) & 0xFF000000) >> 24, \ | |||
((a) & 0x00FF0000) >> 16, \ | |||
((a) & 0x0000FF00) >> 8, \ | |||
((a) & 0x000000FF), \ | |||
\ | |||
((b) & 0xFF000000) >> 24, \ | |||
((b) & 0x00FF0000) >> 16, \ | |||
((b) & 0x0000FF00) >> 8, \ | |||
((b) & 0x000000FF), \ | |||
\ | |||
((c) & 0xFF000000) >> 24, \ | |||
((c) & 0x00FF0000) >> 16, \ | |||
((c) & 0x0000FF00) >> 8, \ | |||
((c) & 0x000000FF), \ | |||
\ | |||
((d) & 0xFF000000) >> 24, \ | |||
((d) & 0x00FF0000) >> 16, \ | |||
((d) & 0x0000FF00) >> 8, \ | |||
((d) & 0x000000FF), \ | |||
} | |||
#endif // V3_COM_COMPAT | |||
#define V3_ID_COPY(iid) \ | |||
{ iid[0], iid[1], iid[ 2], iid[ 3], iid[ 4], iid[ 5], iid[ 6], iid[ 7], \ | |||
iid[8], iid[9], iid[10], iid[11], iid[12], iid[13], iid[14], iid[15] } | |||
/** | |||
* funknown | |||
*/ | |||
struct v3_funknown { | |||
v3_result (V3_API* query_interface)(void* self, const v3_tuid iid, void** obj); | |||
uint32_t (V3_API* ref)(void* self); | |||
uint32_t (V3_API* unref)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_funknown_iid = | |||
V3_ID(0x00000000, 0x00000000, 0xC0000000, 0x00000046); | |||
/** | |||
* plugin base | |||
*/ | |||
struct v3_plugin_base { | |||
struct v3_funknown; | |||
v3_result (V3_API* initialize)(void* self, struct v3_funknown** context); | |||
v3_result (V3_API* terminate)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_base_iid = | |||
V3_ID(0x22888DDB, 0x156E45AE, 0x8358B348, 0x08190625); | |||
#ifdef __cplusplus | |||
/** | |||
* helper C++ functions to manually call v3_funknown methods on an object. | |||
*/ | |||
template<class T, class M> static inline | |||
v3_result v3_cpp_obj_query_interface(T** obj, const v3_tuid iid, M*** obj2) | |||
{ | |||
return static_cast<v3_funknown*>(static_cast<void*>(*obj))->query_interface(obj, iid, (void**)obj2); | |||
} | |||
template<class T> static inline | |||
uint32_t v3_cpp_obj_ref(T** obj) | |||
{ | |||
return static_cast<v3_funknown*>(static_cast<void*>(*obj))->ref(obj); | |||
} | |||
template<class T> static inline | |||
uint32_t v3_cpp_obj_unref(T** obj) | |||
{ | |||
return static_cast<v3_funknown*>(static_cast<void*>(*obj))->unref(obj); | |||
} | |||
#endif |
@@ -0,0 +1,37 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
enum v3_seek_mode { | |||
V3_SEEK_SET = 0, | |||
V3_SEEK_CUR, | |||
V3_SEEK_END | |||
}; | |||
struct v3_bstream { | |||
struct v3_funknown; | |||
v3_result (V3_API *read)(void* self, void* buffer, int32_t num_bytes, int32_t* bytes_read); | |||
v3_result (V3_API *write)(void* self, void* buffer, int32_t num_bytes, int32_t* bytes_written); | |||
v3_result (V3_API *seek)(void* self, int64_t pos, int32_t seek_mode, int64_t* result); | |||
v3_result (V3_API *tell)(void* self, int64_t* pos); | |||
}; | |||
static constexpr const v3_tuid v3_bstream_iid = | |||
V3_ID(0xC3BF6EA2, 0x30994752, 0x9B6BF990, 0x1EE33E9B); |
@@ -0,0 +1,134 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
#include "bstream.h" | |||
#include "align_push.h" | |||
/** | |||
* buses | |||
*/ | |||
enum v3_media_types { | |||
V3_AUDIO = 0, | |||
V3_EVENT | |||
}; | |||
static inline | |||
const char* v3_media_type_str(int32_t type) | |||
{ | |||
switch (type) | |||
{ | |||
case V3_AUDIO: | |||
return "V3_AUDIO"; | |||
case V3_EVENT: | |||
return "V3_EVENT"; | |||
default: | |||
return "[unknown]"; | |||
} | |||
} | |||
enum v3_bus_direction { | |||
V3_INPUT = 0, | |||
V3_OUTPUT | |||
}; | |||
static inline | |||
const char* v3_bus_direction_str(int32_t d) | |||
{ | |||
switch (d) | |||
{ | |||
case V3_INPUT: | |||
return "V3_INPUT"; | |||
case V3_OUTPUT: | |||
return "V3_OUTPUT"; | |||
default: | |||
return "[unknown]"; | |||
} | |||
} | |||
enum v3_bus_types { | |||
V3_MAIN = 0, | |||
V3_AUX | |||
}; | |||
enum v3_bus_flags { | |||
V3_DEFAULT_ACTIVE = 1 << 0, | |||
V3_IS_CONTROL_VOLTAGE = 1 << 1 | |||
}; | |||
struct v3_bus_info { | |||
int32_t media_type; | |||
int32_t direction; | |||
int32_t channel_count; | |||
v3_str_128 bus_name; | |||
int32_t bus_type; | |||
uint32_t flags; | |||
}; | |||
/** | |||
* component | |||
*/ | |||
struct v3_routing_info; | |||
struct v3_component { | |||
struct v3_plugin_base; | |||
v3_result (V3_API *get_controller_class_id)(void* self, v3_tuid class_id); | |||
v3_result (V3_API *set_io_mode)(void* self, int32_t io_mode); | |||
int32_t (V3_API *get_bus_count)(void* self, int32_t media_type, int32_t bus_direction); | |||
v3_result (V3_API *get_bus_info)(void* self, int32_t media_type, int32_t bus_direction, | |||
int32_t bus_idx, struct v3_bus_info* bus_info); | |||
v3_result (V3_API *get_routing_info)(void* self, struct v3_routing_info* input, struct v3_routing_info* output); | |||
v3_result (V3_API *activate_bus)(void* self, int32_t media_type, int32_t bus_direction, | |||
int32_t bus_idx, v3_bool state); | |||
v3_result (V3_API *set_active)(void* self, v3_bool state); | |||
v3_result (V3_API *set_state)(void* self, struct v3_bstream **); | |||
v3_result (V3_API *get_state)(void* self, struct v3_bstream **); | |||
}; | |||
static constexpr const v3_tuid v3_component_iid = | |||
V3_ID(0xE831FF31, 0xF2D54301, 0x928EBBEE, 0x25697802); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_component_cpp : v3_funknown { | |||
v3_plugin_base base; | |||
v3_component comp; | |||
}; | |||
template<> inline | |||
constexpr v3_component* v3_cpp_obj(v3_component** obj) | |||
{ | |||
/** | |||
* this ugly piece of code is required due to C++ assuming `reinterpret_cast` by default, | |||
* but we need everything to be `static_cast` for it to be `constexpr` compatible. | |||
*/ | |||
return static_cast<v3_component*>( | |||
static_cast<void*>(static_cast<uint8_t*>(static_cast<void*>(*obj)) + sizeof(void*)*5)); | |||
} | |||
#endif | |||
#include "align_pop.h" |
@@ -0,0 +1,141 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
#include "bstream.h" | |||
#include "view.h" | |||
#include "align_push.h" | |||
/** | |||
* component handler | |||
*/ | |||
enum { | |||
V3_RESTART_RELOAD_COMPONENT = 1 << 0, | |||
V3_RESTART_IO_CHANGED = 1 << 1, | |||
V3_RESTART_PARAM_VALUES_CHANGED = 1 << 2, | |||
V3_RESTART_LATENCY_CHANGED = 1 << 3, | |||
V3_RESTART_PARAM_TITLES_CHANGED = 1 << 4, | |||
V3_RESTART_MIDI_CC_ASSIGNMENT_CHANGED = 1 << 5, | |||
V3_RESTART_NOTE_EXPRESSION_CHANGED = 1 << 6, | |||
V3_RESTART_IO_TITLES_CHANGED = 1 << 7, | |||
V3_RESTART_PREFETCHABLE_SUPPORT_CHANGED = 1 << 8, | |||
V3_RESTART_ROUTING_INFO_CHANGED = 1 << 9 | |||
}; | |||
struct v3_component_handler { | |||
struct v3_funknown; | |||
v3_result (V3_API* begin_edit)(void* self, v3_param_id); | |||
v3_result (V3_API* perform_edit)(void* self, v3_param_id, double value_normalised); | |||
v3_result (V3_API* end_edit)(void* self, v3_param_id); | |||
v3_result (V3_API* restart_component)(void* self, int32_t flags); | |||
}; | |||
static constexpr const v3_tuid v3_component_handler_iid = | |||
V3_ID(0x93A0BEA3, 0x0BD045DB, 0x8E890B0C, 0xC1E46AC6); | |||
/** | |||
* edit controller | |||
*/ | |||
enum { | |||
V3_PARAM_CAN_AUTOMATE = 1 << 0, | |||
V3_PARAM_READ_ONLY = 1 << 1, | |||
V3_PARAM_WRAP_AROUND = 1 << 2, | |||
V3_PARAM_IS_LIST = 1 << 3, | |||
V3_PARAM_IS_HIDDEN = 1 << 4, | |||
V3_PARAM_PROGRAM_CHANGE = 1 << 15, | |||
V3_PARAM_IS_BYPASS = 1 << 16 | |||
}; | |||
struct v3_param_info { | |||
v3_param_id param_id; | |||
v3_str_128 title; | |||
v3_str_128 short_title; | |||
v3_str_128 units; | |||
int32_t step_count; | |||
double default_normalised_value; | |||
int32_t unit_id; | |||
int32_t flags; | |||
}; | |||
struct v3_edit_controller { | |||
struct v3_plugin_base; | |||
v3_result (V3_API* set_component_state)(void* self, struct v3_bstream*); | |||
v3_result (V3_API* set_state)(void* self, struct v3_bstream*); | |||
v3_result (V3_API* get_state)(void* self, struct v3_bstream*); | |||
int32_t (V3_API* get_parameter_count)(void* self); | |||
v3_result (V3_API* get_parameter_info)(void* self, int32_t param_idx, struct v3_param_info*); | |||
v3_result (V3_API* get_parameter_string_for_value)(void* self, v3_param_id, double normalised, v3_str_128 output); | |||
v3_result (V3_API* get_parameter_value_for_string)(void* self, v3_param_id, int16_t* input, double* output); | |||
double (V3_API* normalised_parameter_to_plain)(void* self, v3_param_id, double normalised); | |||
double (V3_API* plain_parameter_to_normalised)(void* self, v3_param_id, double plain); | |||
double (V3_API* get_parameter_normalised)(void* self, v3_param_id); | |||
v3_result (V3_API* set_parameter_normalised)(void* self, v3_param_id, double normalised); | |||
v3_result (V3_API* set_component_handler)(void* self, struct v3_component_handler**); | |||
struct v3_plugin_view** (V3_API* create_view)(void* self, const char* name); | |||
}; | |||
static constexpr const v3_tuid v3_edit_controller_iid = | |||
V3_ID(0xDCD7BBE3, 0x7742448D, 0xA874AACC, 0x979C759E); | |||
/** | |||
* midi mapping | |||
*/ | |||
struct v3_midi_mapping { | |||
struct v3_funknown; | |||
v3_result (V3_API* get_midi_controller_assignment)(void* self, int32_t bus, int16_t channel, int16_t cc, v3_param_id* id); | |||
}; | |||
static constexpr const v3_tuid v3_midi_mapping_iid = | |||
V3_ID(0xDF0FF9F7, 0x49B74669, 0xB63AB732, 0x7ADBF5E5); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_edit_controller_cpp : v3_funknown { | |||
v3_plugin_base base; | |||
v3_edit_controller ctrl; | |||
}; | |||
struct v3_midi_mapping_cpp : v3_funknown { | |||
v3_midi_mapping map; | |||
}; | |||
template<> inline | |||
constexpr v3_edit_controller* v3_cpp_obj(v3_edit_controller** obj) | |||
{ | |||
/** | |||
* this ugly piece of code is required due to C++ assuming `reinterpret_cast` by default, | |||
* but we need everything to be `static_cast` for it to be `constexpr` compatible. | |||
*/ | |||
return static_cast<v3_edit_controller*>( | |||
static_cast<void*>(static_cast<uint8_t*>(static_cast<void*>(*obj)) + sizeof(void*)*5)); | |||
} | |||
#endif | |||
#include "align_pop.h" |
@@ -0,0 +1,145 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
#include "align_push.h" | |||
/** | |||
* note events | |||
*/ | |||
struct v3_event_note_on { | |||
int16_t channel; | |||
int16_t pitch; // MIDI note number | |||
float tuning; | |||
float velocity; | |||
int32_t length; | |||
int32_t note_id; | |||
}; | |||
struct v3_event_note_off { | |||
int16_t channel; | |||
int16_t pitch; // MIDI note number | |||
float velocity; | |||
int32_t note_id; | |||
float tuning; | |||
}; | |||
struct v3_event_data { | |||
uint32_t size; | |||
uint32_t type; | |||
const uint8_t* bytes; | |||
}; | |||
struct v3_event_poly_pressure { | |||
int16_t channel; | |||
int16_t pitch; | |||
float pressure; | |||
int32_t note_id; | |||
}; | |||
struct v3_event_chord { | |||
int16_t root; | |||
int16_t bass_note; | |||
int16_t mask; | |||
uint16_t text_len; | |||
const int16_t* text; | |||
}; | |||
struct v3_event_scale { | |||
int16_t root; | |||
int16_t mask; | |||
uint16_t text_len; | |||
const int16_t* text; | |||
}; | |||
struct v3_event_legacy_midi_cc_out { | |||
uint8_t cc_number; | |||
int8_t channel; | |||
int8_t value; | |||
int8_t value2; | |||
}; | |||
struct v3_event_note_expression_value { | |||
uint32_t type_id; | |||
int32_t note_id; | |||
double value; | |||
}; | |||
struct v3_event_note_expression_text { | |||
int32_t note_id; | |||
uint32_t text_len; | |||
const int16_t* text; | |||
}; | |||
/** | |||
* event | |||
*/ | |||
enum v3_event_flags { | |||
V3_EVENT_IS_LIVE = 1 << 0 | |||
}; | |||
enum v3_event_type { | |||
V3_EVENT_NOTE_ON = 0, | |||
V3_EVENT_NOTE_OFF = 1, | |||
V3_EVENT_DATA = 2, | |||
V3_EVENT_POLY_PRESSURE = 3, | |||
V3_EVENT_NOTE_EXP_VALUE = 4, | |||
V3_EVENT_NOTE_EXP_TEXT = 5, | |||
V3_EVENT_CHORD = 6, | |||
V3_EVENT_SCALE = 7, | |||
V3_EVENT_LEGACY_MIDI_CC_OUT = 65535 | |||
}; | |||
struct v3_event { | |||
int32_t bus_index; | |||
int32_t sample_offset; | |||
double ppq_position; | |||
uint16_t flags; | |||
uint16_t type; | |||
union { | |||
struct v3_event_note_on note_on; | |||
struct v3_event_note_off note_off; | |||
struct v3_event_data data; | |||
struct v3_event_poly_pressure poly_pressure; | |||
struct v3_event_chord chord; | |||
struct v3_event_scale scale; | |||
struct v3_event_legacy_midi_cc_out midi_cc_out; | |||
struct v3_event_note_expression_value note_exp_value; | |||
struct v3_event_note_expression_text note_exp_text; | |||
}; | |||
}; | |||
/** | |||
* event list | |||
*/ | |||
struct v3_event_list { | |||
struct v3_funknown; | |||
uint32_t (V3_API* get_event_count)(void* self); | |||
v3_result (V3_API* get_event)(void* self, int32_t idx, struct v3_event* event); | |||
v3_result (V3_API* add_event)(void* self, struct v3_event* event); | |||
}; | |||
static constexpr const v3_tuid v3_event_list_iid = | |||
V3_ID(0x3A2C4214, 0x346349FE, 0xB2C4F397, 0xB9695A44); | |||
#include "align_pop.h" |
@@ -0,0 +1,122 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
/** | |||
* plugin factory v1 | |||
*/ | |||
struct v3_factory_info { | |||
char vendor[64]; | |||
char url[256]; | |||
char email[128]; | |||
int32_t flags; // set to 0x10 (unicode) | |||
}; | |||
struct v3_class_info { | |||
v3_tuid class_id; | |||
int32_t cardinality; // set to 0x7FFFFFFF (many instances) | |||
char category[32]; | |||
char name[64]; | |||
}; | |||
struct v3_plugin_factory { | |||
struct v3_funknown; | |||
v3_result (V3_API *get_factory_info)(void* self, struct v3_factory_info*); | |||
int32_t (V3_API *num_classes)(void* self); | |||
v3_result (V3_API *get_class_info)(void* self, int32_t idx, struct v3_class_info*); | |||
v3_result (V3_API *create_instance)(void* self, const v3_tuid class_id, const v3_tuid iid, void** instance); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_factory_iid = | |||
V3_ID(0x7A4D811C, 0x52114A1F, 0xAED9D2EE, 0x0B43BF9F); | |||
/** | |||
* plugin factory v2 | |||
*/ | |||
enum { | |||
V3_DISTRIBUTABLE = 1 << 0, | |||
V3_SIMPLE_MODE = 1 << 1 | |||
}; | |||
struct v3_class_info_2 { | |||
v3_tuid class_id; | |||
int32_t cardinality; // set to 0x7FFFFFFF | |||
char category[32]; | |||
char name[64]; | |||
uint32_t class_flags; | |||
char sub_categories[128]; | |||
char vendor[64]; | |||
char version[64]; | |||
char sdk_version[64]; | |||
}; | |||
struct v3_plugin_factory_2 { | |||
struct v3_plugin_factory; | |||
v3_result (V3_API *get_class_info_2)(void* self, int32_t idx, struct v3_class_info_2*); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_factory_2_iid = | |||
V3_ID(0x0007B650, 0xF24B4C0B, 0xA464EDB9, 0xF00B2ABB); | |||
/** | |||
* plugin factory v3 | |||
* (we got it right this time I swear) | |||
* | |||
* same as above, but "unicode" (really just utf-16, thanks microsoft!) | |||
*/ | |||
struct v3_class_info_3 { | |||
v3_tuid class_id; | |||
int32_t cardinality; // set to 0x7FFFFFFF | |||
char category[32]; | |||
int16_t name[64]; | |||
uint32_t class_flags; | |||
char sub_categories[128]; | |||
int16_t vendor[64]; | |||
int16_t version[64]; | |||
int16_t sdk_version[64]; | |||
}; | |||
struct v3_plugin_factory_3 { | |||
struct v3_plugin_factory_2; | |||
v3_result (V3_API *get_class_info_utf16)(void* self, int32_t idx, struct v3_class_info_3*); | |||
v3_result (V3_API *set_host_context)(void* self, struct v3_funknown** host); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_factory_3_iid = | |||
V3_ID(0x4555A2AB, 0xC1234E57, 0x9B122910, 0x36878931); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_plugin_factory_cpp : v3_funknown { | |||
v3_plugin_factory v1; | |||
v3_plugin_factory_2 v2; | |||
v3_plugin_factory_3 v3; | |||
}; | |||
#endif |
@@ -0,0 +1,49 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "message.h" | |||
#include "align_push.h" | |||
/** | |||
* connection point | |||
*/ | |||
struct v3_host_application { | |||
struct v3_funknown; | |||
v3_result (V3_API* get_name)(void* self, v3_str_128 name); // wtf? | |||
v3_result (V3_API* create_instance)(void* self, v3_tuid cid, v3_tuid iid, void** obj); | |||
}; | |||
static constexpr const v3_tuid v3_host_application_iid = | |||
V3_ID(0x58E595CC, 0xDB2D4969, 0x8B6AAF8C, 0x36A664E5); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_host_application_cpp : v3_funknown { | |||
v3_host_application app; | |||
}; | |||
#endif | |||
#include "align_pop.h" |
@@ -0,0 +1,93 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
#include "align_push.h" | |||
/** | |||
* attribute list | |||
*/ | |||
struct v3_attribute_list { | |||
struct v3_funknown; | |||
v3_result (V3_API* set_int)(void* self, const char* id, int64_t value); | |||
v3_result (V3_API* get_int)(void* self, const char* id, int64_t* value); | |||
v3_result (V3_API* set_float)(void* self, const char* id, double value); | |||
v3_result (V3_API* get_float)(void* self, const char* id, double* value); | |||
v3_result (V3_API* set_string)(void* self, const char* id, const int16_t* string); | |||
v3_result (V3_API* get_string)(void* self, const char* id, int16_t* string, uint32_t size); | |||
v3_result (V3_API* set_binary)(void* self, const char* id, const void* data, uint32_t size); | |||
v3_result (V3_API* get_binary)(void* self, const char* id, const void** data, uint32_t* size); | |||
}; | |||
static constexpr const v3_tuid v3_attribute_list_iid = | |||
V3_ID(0x1E5F0AEB, 0xCC7F4533, 0xA2544011, 0x38AD5EE4); | |||
/** | |||
* message | |||
*/ | |||
struct v3_message { | |||
struct v3_funknown; | |||
const char* (V3_API* get_message_id)(void* self); | |||
void (V3_API* set_message_id)(void* self, const char* id); | |||
v3_attribute_list** (V3_API* get_attributes)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_message_iid = | |||
V3_ID(0x936F033B, 0xC6C047DB, 0xBB0882F8, 0x13C1E613); | |||
/** | |||
* connection point | |||
*/ | |||
struct v3_connection_point { | |||
struct v3_funknown; | |||
v3_result (V3_API* connect)(void* self, struct v3_connection_point** other); | |||
v3_result (V3_API* disconnect)(void* self, struct v3_connection_point** other); | |||
v3_result (V3_API* notify)(void* self, struct v3_message** message); | |||
}; | |||
static constexpr const v3_tuid v3_connection_point_iid = | |||
V3_ID(0x70A4156F, 0x6E6E4026, 0x989148BF, 0xAA60D8D1); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_attribute_list_cpp : v3_funknown { | |||
v3_attribute_list attrlist; | |||
}; | |||
struct v3_message_cpp : v3_funknown { | |||
v3_message msg; | |||
}; | |||
struct v3_connection_point_cpp : v3_funknown { | |||
v3_connection_point point; | |||
}; | |||
#endif | |||
#include "align_pop.h" |
@@ -0,0 +1,186 @@ | |||
/* | |||
* travesty, pure C VST3-compatible interface | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#pragma once | |||
#include "base.h" | |||
/** | |||
* base view stuff | |||
*/ | |||
struct v3_view_rect { | |||
int32_t left; | |||
int32_t top; | |||
int32_t right; | |||
int32_t bottom; | |||
}; | |||
#define V3_VIEW_PLATFORM_TYPE_HWND "HWND" | |||
#define V3_VIEW_PLATFORM_TYPE_NSVIEW "NSView" | |||
#define V3_VIEW_PLATFORM_TYPE_X11 "X11EmbedWindowID" | |||
#if defined(__APPLE__) | |||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_NSVIEW | |||
#elif defined(_WIN32) | |||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_HWND | |||
#else | |||
# define V3_VIEW_PLATFORM_TYPE_NATIVE V3_VIEW_PLATFORM_TYPE_X11 | |||
#endif | |||
/** | |||
* plugin view | |||
*/ | |||
struct v3_plugin_frame; | |||
struct v3_plugin_view { | |||
struct v3_funknown; | |||
v3_result (V3_API* is_platform_type_supported)(void* self, const char* platform_type); | |||
v3_result (V3_API* attached)(void* self, void* parent, const char* platform_type); | |||
v3_result (V3_API* removed)(void* self); | |||
v3_result (V3_API* on_wheel)(void* self, float distance); | |||
v3_result (V3_API* on_key_down)(void* self, int16_t key_char, int16_t key_code, int16_t modifiers); | |||
v3_result (V3_API* on_key_up)(void* self, int16_t key_char, int16_t key_code, int16_t modifiers); | |||
v3_result (V3_API* get_size)(void* self, struct v3_view_rect*); | |||
v3_result (V3_API* on_size)(void* self, struct v3_view_rect*); | |||
v3_result (V3_API* on_focus)(void* self, v3_bool state); | |||
v3_result (V3_API* set_frame)(void* self, struct v3_plugin_frame**); | |||
v3_result (V3_API* can_resize)(void* self); | |||
v3_result (V3_API* check_size_constraint)(void* self, struct v3_view_rect*); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_view_iid = | |||
V3_ID(0x5BC32507, 0xD06049EA, 0xA6151B52, 0x2B755B29); | |||
/** | |||
* plugin frame | |||
*/ | |||
struct v3_plugin_frame { | |||
struct v3_funknown; | |||
v3_result (V3_API* resize_view)(void* self, struct v3_plugin_view**, struct v3_view_rect*); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_frame_iid = | |||
V3_ID(0x367FAF01, 0xAFA94693, 0x8D4DA2A0, 0xED0882A3); | |||
/** | |||
* steinberg content scaling support | |||
* (same IID/iface as presonus view scaling) | |||
*/ | |||
struct v3_plugin_view_content_scale { | |||
struct v3_funknown; | |||
v3_result (V3_API* set_content_scale_factor)(void* self, float factor); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_view_content_scale_iid = | |||
V3_ID(0x65ED9690, 0x8AC44525, 0x8AADEF7A, 0x72EA703F); | |||
/** | |||
* support for querying the view to find what control is underneath the mouse | |||
*/ | |||
struct v3_plugin_view_parameter_finder { | |||
struct v3_funknown; | |||
v3_result (V3_API* find_parameter)(void* self, int32_t x, int32_t y, v3_param_id *); | |||
}; | |||
static constexpr const v3_tuid v3_plugin_view_parameter_finder_iid = | |||
V3_ID(0x0F618302, 0x215D4587, 0xA512073C, 0x77B9D383); | |||
/** | |||
* linux event handler | |||
*/ | |||
struct v3_event_handler { | |||
struct v3_funknown; | |||
void (V3_API* on_fd_is_set)(void* self, int fd); | |||
}; | |||
static constexpr const v3_tuid v3_event_handler_iid = | |||
V3_ID(0x561E65C9, 0x13A0496F, 0x813A2C35, 0x654D7983); | |||
/** | |||
* linux timer handler | |||
*/ | |||
struct v3_timer_handler { | |||
struct v3_funknown; | |||
void (V3_API* on_timer)(void* self); | |||
}; | |||
static constexpr const v3_tuid v3_timer_handler_iid = | |||
V3_ID(0x10BDD94F, 0x41424774, 0x821FAD8F, 0xECA72CA9); | |||
/** | |||
* linux host run loop | |||
*/ | |||
struct v3_run_loop { | |||
struct v3_funknown; | |||
v3_result (V3_API* register_event_handler)(void* self, v3_event_handler** handler, int fd); | |||
v3_result (V3_API* unregister_event_handler)(void* self, v3_event_handler** handler); | |||
v3_result (V3_API* register_timer)(void* self, v3_timer_handler** handler, uint64_t ms); | |||
v3_result (V3_API* unregister_timer)(void* self, v3_timer_handler** handler); | |||
}; | |||
static constexpr const v3_tuid v3_run_loop_iid = | |||
V3_ID(0x18C35366, 0x97764F1A, 0x9C5B8385, 0x7A871389); | |||
#ifdef __cplusplus | |||
/** | |||
* C++ variants | |||
*/ | |||
struct v3_plugin_view_cpp : v3_funknown { | |||
v3_plugin_view view; | |||
}; | |||
struct v3_plugin_frame_cpp : v3_funknown { | |||
v3_plugin_frame frame; | |||
}; | |||
struct v3_plugin_view_content_scale_cpp : v3_funknown { | |||
v3_plugin_view_content_scale scale; | |||
}; | |||
struct v3_plugin_view_parameter_finder_cpp : v3_funknown { | |||
v3_plugin_view_parameter_finder finder; | |||
}; | |||
struct v3_event_handler_cpp : v3_funknown { | |||
v3_event_handler handler; | |||
}; | |||
struct v3_timer_handler_cpp : v3_funknown { | |||
v3_timer_handler handler; | |||
}; | |||
struct v3_run_loop_cpp : v3_funknown { | |||
v3_run_loop loop; | |||
}; | |||
#endif |
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla VST utils | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Carla VST2 utils | |||
* Copyright (C) 2011-2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -15,8 +15,8 @@ | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#ifndef CARLA_VST_UTILS_HPP_INCLUDED | |||
#define CARLA_VST_UTILS_HPP_INCLUDED | |||
#ifndef CARLA_VST2_UTILS_HPP_INCLUDED | |||
#define CARLA_VST2_UTILS_HPP_INCLUDED | |||
#include "CarlaUtils.hpp" | |||
@@ -404,4 +404,4 @@ const char* vstMasterOpcode2str(const int32_t opcode) noexcept | |||
// ----------------------------------------------------------------------- | |||
#endif // CARLA_VST_UTILS_HPP_INCLUDED | |||
#endif // CARLA_VST2_UTILS_HPP_INCLUDED |
@@ -0,0 +1,26 @@ | |||
/* | |||
* Carla VST3 utils | |||
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
* published by the Free Software Foundation; either version 2 of | |||
* the License, or any later version. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU General Public License for more details. | |||
* | |||
* For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
*/ | |||
#ifndef CARLA_VST3_UTILS_HPP_INCLUDED | |||
#define CARLA_VST3_UTILS_HPP_INCLUDED | |||
#include "CarlaUtils.hpp" | |||
#include "travesty/component.h" | |||
#include "travesty/edit_controller.h" | |||
#endif // CARLA_VST3_UTILS_HPP_INCLUDED |