Compare commits

..

No commits in common. "5d07c39170b89ab3d9cdb867bc532c83f2e8453f" and "67cddf552be91d74fdd50ad27648976383b9f773" have entirely different histories.

3 changed files with 263 additions and 295 deletions

View File

@ -18,54 +18,54 @@
* File author: Stefano D'Angelo * File author: Stefano D'Angelo
*/ */
#define DATA_COMPANY_NAME "{{=it.tibia.CGetUTF8StringLiteral(it.company.name, 63)}}" #define DATA_COMPANY_NAME "{{=it.tibia.CGetUTF8StringLiteral(it.company.name, 63)}}"
#define DATA_COMPANY_URL "{{=it.tibia.CGetUTF8StringLiteral(it.company.url, 255)}}" #define DATA_COMPANY_URL "{{=it.tibia.CGetUTF8StringLiteral(it.company.url, 255)}}"
#define DATA_COMPANY_EMAIL "{{=it.tibia.CGetUTF8StringLiteral(it.company.email, 127)}}" #define DATA_COMPANY_EMAIL "{{=it.tibia.CGetUTF8StringLiteral(it.company.email, 127)}}"
#define DATA_PRODUCT_NAME "{{=it.tibia.CGetUTF8StringLiteral(it.product.name, 63)}}" #define DATA_PRODUCT_NAME "{{=it.tibia.CGetUTF8StringLiteral(it.product.name, 63)}}"
#define DATA_PRODUCT_VERSION "{{=(it.product.version + '.' + it.product.buildVersion).substring(0, 63)}}" #define DATA_PRODUCT_VERSION "{{=(it.product.version + '.' + it.product.buildVersion).substring(0, 63)}}"
static Steinberg_char16 dataProductNameW[64] = { {{~Array.from(it.product.name).slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }; static Steinberg_char16 dataProductNameW[64] = { {{~Array.from(it.product.name).slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 };
static Steinberg_char16 dataProductVersionW[64] = { {{~Array.from(it.product.version + "." + it.product.buildVersion).slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }; static Steinberg_char16 dataProductVersionW[64] = { {{~Array.from(it.product.version + "." + it.product.buildVersion).slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 };
#define DATA_VST3_SDK_VERSION "VST 3.7.9" #define DATA_VST3_SDK_VERSION "VST 3.7.9"
static Steinberg_char16 dataVST3SDKVersionW[64] = { {{~Array.from("VST 3.7.9") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }; static Steinberg_char16 dataVST3SDKVersionW[64] = { {{~Array.from("VST 3.7.9") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 };
static Steinberg_char16 dataVST3ControllerNameW[64] = { {{~Array.from(it.product.name + " Controller").slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }; static Steinberg_char16 dataVST3ControllerNameW[64] = { {{~Array.from(it.product.name + " Controller").slice(0, 63) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 };
#define DATA_VST3_PLUGIN_CID_1 0x{{=it.vst3.plugin.cid.substring(0, 8)}} #define DATA_VST3_PLUGIN_CID_1 0x{{=it.vst3.plugin.cid.substring(0, 8)}}
#define DATA_VST3_PLUGIN_CID_2 0x{{=it.vst3.plugin.cid.substring(8, 16)}} #define DATA_VST3_PLUGIN_CID_2 0x{{=it.vst3.plugin.cid.substring(8, 16)}}
#define DATA_VST3_PLUGIN_CID_3 0x{{=it.vst3.plugin.cid.substring(16, 24)}} #define DATA_VST3_PLUGIN_CID_3 0x{{=it.vst3.plugin.cid.substring(16, 24)}}
#define DATA_VST3_PLUGIN_CID_4 0x{{=it.vst3.plugin.cid.substring(24, 32)}} #define DATA_VST3_PLUGIN_CID_4 0x{{=it.vst3.plugin.cid.substring(24, 32)}}
#define DATA_VST3_CONTROLLER_CID_1 0x{{=it.vst3.controller.cid.substring(0, 8)}} #define DATA_VST3_CONTROLLER_CID_1 0x{{=it.vst3.controller.cid.substring(0, 8)}}
#define DATA_VST3_CONTROLLER_CID_2 0x{{=it.vst3.controller.cid.substring(8, 16)}} #define DATA_VST3_CONTROLLER_CID_2 0x{{=it.vst3.controller.cid.substring(8, 16)}}
#define DATA_VST3_CONTROLLER_CID_3 0x{{=it.vst3.controller.cid.substring(16, 24)}} #define DATA_VST3_CONTROLLER_CID_3 0x{{=it.vst3.controller.cid.substring(16, 24)}}
#define DATA_VST3_CONTROLLER_CID_4 0x{{=it.vst3.controller.cid.substring(24, 32)}} #define DATA_VST3_CONTROLLER_CID_4 0x{{=it.vst3.controller.cid.substring(24, 32)}}
static const Steinberg_TUID dataPluginCID = SMTG_INLINE_UID(DATA_VST3_PLUGIN_CID_1, DATA_VST3_PLUGIN_CID_2, DATA_VST3_PLUGIN_CID_3, DATA_VST3_PLUGIN_CID_4); static const Steinberg_TUID dataPluginCID = SMTG_INLINE_UID(DATA_VST3_PLUGIN_CID_1, DATA_VST3_PLUGIN_CID_2, DATA_VST3_PLUGIN_CID_3, DATA_VST3_PLUGIN_CID_4);
static const Steinberg_TUID dataControllerCID = SMTG_INLINE_UID(DATA_VST3_CONTROLLER_CID_1, DATA_VST3_CONTROLLER_CID_2, DATA_VST3_CONTROLLER_CID_3, DATA_VST3_CONTROLLER_CID_4); static const Steinberg_TUID dataControllerCID = SMTG_INLINE_UID(DATA_VST3_CONTROLLER_CID_1, DATA_VST3_CONTROLLER_CID_2, DATA_VST3_CONTROLLER_CID_3, DATA_VST3_CONTROLLER_CID_4);
#define DATA_VST3_SUBCATEGORY "{{=it.vst3.subCategory}}" #define DATA_VST3_SUBCATEGORY "{{=it.vst3.subCategory}}"
#define DATA_PRODUCT_BUSES_AUDIO_INPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").length}} #define DATA_PRODUCT_BUSES_AUDIO_INPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").length}}
#define DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").length}} #define DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").length}}
#define DATA_PRODUCT_BUSES_MIDI_INPUT_N {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length}} #define DATA_PRODUCT_BUSES_MIDI_INPUT_N {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "input").length}}
#define DATA_PRODUCT_BUSES_MIDI_OUTPUT_N {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "output").length}} #define DATA_PRODUCT_BUSES_MIDI_OUTPUT_N {{=it.product.buses.filter(x => x.type == "midi" && x.direction == "output").length}}
#define DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}} #define DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "input").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
#define DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}} #define DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N {{=it.product.buses.filter(x => x.type == "audio" && x.direction == "output").reduce((a, x) => a + (x.channels == "mono" ? 1 : 2), 0)}}
#if DATA_PRODUCT_BUSES_AUDIO_INPUT_N > 0 #if DATA_PRODUCT_BUSES_AUDIO_INPUT_N > 0
static struct Steinberg_Vst_BusInfo busInfoAudioInput[DATA_PRODUCT_BUSES_AUDIO_INPUT_N] = { static struct Steinberg_Vst_BusInfo busInfoAudioInput[DATA_PRODUCT_BUSES_AUDIO_INPUT_N] = {
{{~it.product.buses.filter(x => x.type == "audio" && x.direction == "input") :b}} {{~it.product.buses.filter(x => x.type == "audio" && x.direction == "input") :b}}
{ {
/* .mediaType = */ Steinberg_Vst_MediaTypes_kAudio, /* .mediaType = */ Steinberg_Vst_MediaTypes_kAudio,
/* .direction = */ Steinberg_Vst_BusDirections_kInput, /* .direction = */ Steinberg_Vst_BusDirections_kInput,
/* .channelCount = */ {{=b.channels == "mono" ? 1 : 2}}, /* .channelCount = */ {{=b.channels == "mono" ? 1 : 2}},
/* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}}, /* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}},
/* .flags = */ 0{{?b.cv}} | Steinberg_Vst_BusInfo_BusFlags_kIsControlVoltage{{?}}{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}} /* .flags = */ 0{{?b.cv}} | Steinberg_Vst_BusInfo_BusFlags_kIsControlVoltage{{?}}{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}}
}, },
{{~}} {{~}}
}; };
@ -75,12 +75,12 @@ static struct Steinberg_Vst_BusInfo busInfoAudioInput[DATA_PRODUCT_BUSES_AUDIO_I
static struct Steinberg_Vst_BusInfo busInfoAudioOutput[DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N] = { static struct Steinberg_Vst_BusInfo busInfoAudioOutput[DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N] = {
{{~it.product.buses.filter(x => x.type == "audio" && x.direction == "output") :b}} {{~it.product.buses.filter(x => x.type == "audio" && x.direction == "output") :b}}
{ {
/* .mediaType = */ Steinberg_Vst_MediaTypes_kAudio, /* .mediaType = */ Steinberg_Vst_MediaTypes_kAudio,
/* .direction = */ Steinberg_Vst_BusDirections_kOutput, /* .direction = */ Steinberg_Vst_BusDirections_kOutput,
/* .channelCount = */ {{=b.channels == "mono" ? 1 : 2}}, /* .channelCount = */ {{=b.channels == "mono" ? 1 : 2}},
/* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}}, /* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}},
/* .flags = */ 0{{?b.cv}} | Steinberg_Vst_BusInfo_BusFlags_kIsControlVoltage{{?}}{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}} /* .flags = */ 0{{?b.cv}} | Steinberg_Vst_BusInfo_BusFlags_kIsControlVoltage{{?}}{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}}
}, },
{{~}} {{~}}
}; };
@ -90,12 +90,12 @@ static struct Steinberg_Vst_BusInfo busInfoAudioOutput[DATA_PRODUCT_BUSES_AUDIO_
static struct Steinberg_Vst_BusInfo busInfoMidiInput[DATA_PRODUCT_BUSES_MIDI_INPUT_N] = { static struct Steinberg_Vst_BusInfo busInfoMidiInput[DATA_PRODUCT_BUSES_MIDI_INPUT_N] = {
{{~it.product.buses.filter(x => x.type == "midi" && x.direction == "input") :b}} {{~it.product.buses.filter(x => x.type == "midi" && x.direction == "input") :b}}
{ {
/* .mediaType = */ Steinberg_Vst_MediaTypes_kEvent, /* .mediaType = */ Steinberg_Vst_MediaTypes_kEvent,
/* .direction = */ Steinberg_Vst_BusDirections_kInput, /* .direction = */ Steinberg_Vst_BusDirections_kInput,
/* .channelCount = */ 16, /* .channelCount = */ 16,
/* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}}, /* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}},
/* .flags = */ 0{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}} /* .flags = */ 0{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}}
}, },
{{~}} {{~}}
}; };
@ -105,12 +105,12 @@ static struct Steinberg_Vst_BusInfo busInfoMidiInput[DATA_PRODUCT_BUSES_MIDI_INP
static struct Steinberg_Vst_BusInfo busInfoMidiOutput[DATA_PRODUCT_BUSES_MIDI_OUTPUT_N] = { static struct Steinberg_Vst_BusInfo busInfoMidiOutput[DATA_PRODUCT_BUSES_MIDI_OUTPUT_N] = {
{{~it.product.buses.filter(x => x.type == "midi" && x.direction == "output") :b}} {{~it.product.buses.filter(x => x.type == "midi" && x.direction == "output") :b}}
{ {
/* .mediaType = */ Steinberg_Vst_MediaTypes_kEvent, /* .mediaType = */ Steinberg_Vst_MediaTypes_kEvent,
/* .direction = */ Steinberg_Vst_BusDirections_kOutput, /* .direction = */ Steinberg_Vst_BusDirections_kOutput,
/* .channelCount = */ 16, /* .channelCount = */ 16,
/* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .name = */ { {{~Array.from(b.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}}, /* .busType = */ {{?b.sidechain}}Steinberg_Vst_BusTypes_kAux{{??}}Steinberg_Vst_BusTypes_kMain{{?}},
/* .flags = */ 0{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}} /* .flags = */ 0{{?!b.optional}} | Steinberg_Vst_BusInfo_BusFlags_kDefaultActive{{?}}
}, },
{{~}} {{~}}
}; };
@ -122,108 +122,104 @@ static uint32_t midiInIndex[DATA_PRODUCT_BUSES_MIDI_INPUT_N] = {
}; };
#endif #endif
#define DATA_PRODUCT_PARAMETERS_N {{=it.product.parameters.filter(x => !x.isLatency).length}} #define DATA_PRODUCT_PARAMETERS_N {{=it.product.parameters.filter(x => !x.isLatency).length}}
#if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 #if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N] = { static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N] = {
{{~it.product.parameters.filter(x => !x.isLatency) :p:i}} {{~it.product.parameters.filter(x => !x.isLatency) :p:i}}
{ {
{{?p.isBypass}} {{?p.isBypass}}
/* .id = */ {{=(it.tibia.vst3.sdbm("Bypass") & 0x7fffffff) >>> 0}}, /* .id = */ {{=(it.tibia.vst3.sdbm("Bypass") & 0x7fffffff) >>> 0}},
/* .title = */ { {{~Array.from("Bypass") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .title = */ { {{~Array.from("Bypass") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .shortTitle = */ { {{~Array.from("Bypass") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .shortTitle = */ { {{~Array.from("Bypass") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .units = */ { 0 }, /* .units = */ { 0 },
/* .stepCount = */ 1, /* .stepCount = */ 1,
/* .defaultNormalizedValue = */ 0.0, /* .defaultNormalizedValue = */ 0.0,
/* .unitId = */ 0, /* .unitId = */ 0,
/* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsBypass | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate /* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsBypass | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate
{{??}} {{??}}
/* .id = */ {{=(it.tibia.vst3.sdbm(p.name) & 0x7fffffff) >>> 0}}, /* .id = */ {{=(it.tibia.vst3.sdbm(p.name) & 0x7fffffff) >>> 0}},
/* .title = */ { {{~Array.from(p.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .title = */ { {{~Array.from(p.name) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .shortTitle = */ { {{~Array.from(p.shortName) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .shortTitle = */ { {{~Array.from(p.shortName) :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .units = */ { {{~Array.from(p.unit in it.tibia.vst3.units ? it.tibia.vst3.units[p.unit] : "") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .units = */ { {{~Array.from(p.unit in it.tibia.vst3.units ? it.tibia.vst3.units[p.unit] : "") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .stepCount = */ {{=p.toggled ? 1 : (p.list && p.scalePoints.length > 1 ? p.scalePoints.length - 1 : (p.integer ? p.maximum - p.minimum : 0))}}, /* .stepCount = */ {{=p.toggled ? 1 : (p.list && p.scalePoints.length > 1 ? p.scalePoints.length - 1 : (p.integer ? p.maximum - p.minimum : 0))}},
/* .defaultNormalizedValue = */ {{?p.map == "logarithmic"}}{{=Number(Math.log(p.defaultValue / p.minimum) / (2 * Math.log(Math.sqrt(p.minimum * p.maximum) / Math.abs(p.minimum)))).toExponential()}}{{??}}{{=Number((p.defaultValue - p.minimum) / (p.maximum - p.minimum)).toExponential()}}{{?}}, /* .defaultNormalizedValue = */ {{?p.map == "logarithmic"}}{{=Number(Math.log(p.defaultValue / p.minimum) / (2 * Math.log(Math.sqrt(p.minimum * p.maximum) / Math.abs(p.minimum)))).toExponential()}}{{??}}{{=Number((p.defaultValue - p.minimum) / (p.maximum - p.minimum)).toExponential()}}{{?}},
/* .unitId = */ 0, /* .unitId = */ 0,
/* .flags = */ {{?p.direction == "input"}}Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate{{??}}Steinberg_Vst_ParameterInfo_ParameterFlags_kIsReadOnly{{?}} /* .flags = */ {{?p.direction == "input"}}Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate{{??}}Steinberg_Vst_ParameterInfo_ParameterFlags_kIsReadOnly{{?}}
{{?}} {{?}}
}, },
{{~}} {{~}}
{{~it.product.buses.filter(x => x.type == "midi" && x.direction == "input") :b:i}} {{~it.product.buses.filter(x => x.type == "midi" && x.direction == "input") :b:i}}
{ {
/* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Channel Pressure") & 0x7fffffff) >>> 0}}, /* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Channel Pressure") & 0x7fffffff) >>> 0}},
/* .title = */ { {{~Array.from(b.name + " Channel Pressure") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .title = */ { {{~Array.from(b.name + " Channel Pressure") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .shortTitle = */ { {{~Array.from(b.shortName + " Chan Pres") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .shortTitle = */ { {{~Array.from(b.shortName + " Chan Pres") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .units = */ { 0 }, /* .units = */ { 0 },
/* .stepCount = */ 0, /* .stepCount = */ 0,
/* .defaultNormalizedValue = */ 0.0, /* .defaultNormalizedValue = */ 0.0,
/* .unitId = */ 0, /* .unitId = */ 0,
/* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate /* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate
}, },
{ {
/* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Pitch Bend") & 0x7fffffff) >>> 0}}, /* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Pitch Bend") & 0x7fffffff) >>> 0}},
/* .title = */ { {{~Array.from(b.name + " Pitch Bend") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .title = */ { {{~Array.from(b.name + " Pitch Bend") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .shortTitle = */ { {{~Array.from(b.shortName + " Pitch Bend") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .shortTitle = */ { {{~Array.from(b.shortName + " Pitch Bend") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .units = */ { 0 }, /* .units = */ { 0 },
/* .stepCount = */ 0, /* .stepCount = */ 0,
/* .defaultNormalizedValue = */ 0.5, /* .defaultNormalizedValue = */ 0.5,
/* .unitId = */ 0, /* .unitId = */ 0,
/* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate /* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate
}, },
{ {
/* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Mod Wheel") & 0x7fffffff) >>> 0}}, /* .id = */ {{=(it.tibia.vst3.sdbm(b.name + " Mod Wheel") & 0x7fffffff) >>> 0}},
/* .title = */ { {{~Array.from(b.name + " Mod Wheel") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .title = */ { {{~Array.from(b.name + " Mod Wheel") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .shortTitle = */ { {{~Array.from(b.shortName + " Mod Wheel") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, /* .shortTitle = */ { {{~Array.from(b.shortName + " Mod Wheel") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 },
/* .units = */ { 0 }, /* .units = */ { 0 },
/* .stepCount = */ 0, /* .stepCount = */ 0,
/* .defaultNormalizedValue = */ 0.0, /* .defaultNormalizedValue = */ 0.0,
/* .unitId = */ 0, /* .unitId = */ 0,
/* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate /* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsHidden | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate
}, },
{{~}} {{~}}
}; };
# if DATA_PRODUCT_PARAMETERS_N > 0 # if DATA_PRODUCT_PARAMETERS_N > 0
# define DATA_PARAM_BYPASS 1 # define DATA_PARAM_BYPASS 1
# define DATA_PARAM_TOGGLED (1<<1) # define DATA_PARAM_TOGGLED (1<<1)
# define DATA_PARAM_INTEGER (1<<2) # define DATA_PARAM_INTEGER (1<<2)
# define DATA_PARAM_MAP_LOG (1<<3) # define DATA_PARAM_MAP_LOG (1<<3)
static struct { static struct {
size_t index; size_t index;
double min; double min;
double max; double max;
double def; double def;
uint32_t flags; uint32_t flags;
double mapK; double mapK;
// scalePoints? // scalePoints?
} parameterData[DATA_PRODUCT_PARAMETERS_N] = { } parameterData[DATA_PRODUCT_PARAMETERS_N] = {
{{~it.product.parameters.filter(x => !x.isLatency) :p:i}} {{~it.product.parameters.filter(x => !x.isLatency) :p:i}}
{ {
/* .index = */ {{=p.paramIndex}}, /* .index = */ {{=p.paramIndex}},
/* .min = */ {{=p.minimum.toExponential()}}, /* .min = */ {{=p.minimum.toExponential()}},
/* .max = */ {{=p.maximum.toExponential()}}, /* .max = */ {{=p.maximum.toExponential()}},
/* .def = */ {{=p.defaultValue.toExponential()}}, /* .def = */ {{=p.defaultValue.toExponential()}},
/* .flags = */ {{?p.isBypass}}DATA_PARAM_BYPASS{{??}}0{{?p.toggled}} | DATA_PARAM_TOGGLED{{?}}{{?p.integer}} | DATA_PARAM_INTEGER{{?}}{{?p.map == "logarithmic"}} | DATA_PARAM_MAP_LOG{{?}}{{?}}, /* .flags = */ {{?p.isBypass}}DATA_PARAM_BYPASS{{??}}0{{?p.toggled}} | DATA_PARAM_TOGGLED{{?}}{{?p.integer}} | DATA_PARAM_INTEGER{{?}}{{?p.map == "logarithmic"}} | DATA_PARAM_MAP_LOG{{?}}{{?}},
/* .mapK = */ {{?p.map == "logarithmic"}}{{=Number(2.0 * Math.log(Math.sqrt(p.maximum * p.minimum) / Math.abs(p.minimum))).toExponential()}}{{??}}0.0{{?}} /* .mapK = */ {{?p.map == "logarithmic"}}{{=Number(2.0 * Math.log(Math.sqrt(p.maximum * p.minimum) / Math.abs(p.minimum))).toExponential()}}{{??}}0.0{{?}}
}, },
{{~}} {{~}}
}; };
{{?it.product.parameters.find(x => x.direction == "output" && x.isCpumeter)}}
# define PARAM_OUT_CPU_INDEX {{=it.product.parameters.indexOf(it.product.parameters.find(x => x.direction == "output" && x.isCpumeter))}}
{{?}}
# endif # endif
#endif #endif
{{?it.product.parameters.find(x => x.isLatency)}} {{?it.product.parameters.find(x => x.isLatency)}}
#define DATA_PARAM_LATENCY_INDEX {{=it.product.parameters.find(x => x.isLatency).paramIndex}} #define DATA_PARAM_LATENCY_INDEX {{=it.product.parameters.find(x => x.isLatency).paramIndex}}
{{?}} {{?}}
{{?it.product.ui}} {{?it.product.ui}}
#define DATA_UI #define DATA_UI
#define DATA_UI_USER_RESIZABLE {{=it.product.ui.userResizable ? 1 : 0}} #define DATA_UI_USER_RESIZABLE {{=it.product.ui.userResizable ? 1 : 0}}
{{?}} {{?}}

View File

@ -22,18 +22,18 @@
#include <stdint.h> #include <stdint.h>
typedef struct { typedef struct {
void *handle; void * handle;
const char *format; const char * format;
const char *(*get_bindir)(void *handle); const char * (*get_bindir)(void *handle);
const char *(*get_datadir)(void *handle); const char * (*get_datadir)(void *handle);
} plugin_callbacks; } plugin_callbacks;
typedef struct { typedef struct {
void *handle; void * handle;
const char *format; const char * format;
const char *(*get_bindir)(void *handle); const char * (*get_bindir)(void *handle);
const char *(*get_datadir)(void *handle); const char * (*get_datadir)(void *handle);
void (*set_parameter)(void *handle, size_t index, float value); void (*set_parameter)(void *handle, size_t index, float value);
} plugin_ui_callbacks; } plugin_ui_callbacks;
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -64,10 +64,6 @@ typedef struct {
#include <pmmintrin.h> #include <pmmintrin.h>
#endif #endif
#ifdef PARAM_OUT_CPU_INDEX
# include "fatica.h"
#endif
// COM in C doc: // COM in C doc:
// https://github.com/rubberduck-vba/Rubberduck/wiki/COM-in-plain-C // https://github.com/rubberduck-vba/Rubberduck/wiki/COM-in-plain-C
// https://devblogs.microsoft.com/oldnewthing/20040205-00/?p=40733 // https://devblogs.microsoft.com/oldnewthing/20040205-00/?p=40733
@ -87,8 +83,8 @@ typedef struct Steinberg_ITimerHandlerVtbl
{ {
/* methods derived from "Steinberg_FUnknown": */ /* methods derived from "Steinberg_FUnknown": */
Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj); Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface);
/* methods derived from "Steinberg_ITimerHandler": */ /* methods derived from "Steinberg_ITimerHandler": */
void (SMTG_STDMETHODCALLTYPE* onTimer) (void* thisInterface); void (SMTG_STDMETHODCALLTYPE* onTimer) (void* thisInterface);
@ -105,8 +101,8 @@ typedef struct Steinberg_IEventHandlerVtbl
{ {
/* methods derived from "Steinberg_FUnknown": */ /* methods derived from "Steinberg_FUnknown": */
Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj); Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface);
/* methods derived from "Steinberg_IEventHandler": */ /* methods derived from "Steinberg_IEventHandler": */
void (SMTG_STDMETHODCALLTYPE* onFDIsSet) (void* thisInterface, int fd); void (SMTG_STDMETHODCALLTYPE* onFDIsSet) (void* thisInterface, int fd);
@ -124,8 +120,8 @@ typedef struct Steinberg_IRunLoopVtbl
{ {
/* methods derived from "Steinberg_FUnknown": */ /* methods derived from "Steinberg_FUnknown": */
Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj); Steinberg_tresult (SMTG_STDMETHODCALLTYPE* queryInterface) (void* thisInterface, const Steinberg_TUID iid, void** obj);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* addRef) (void* thisInterface);
Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface); Steinberg_uint32 (SMTG_STDMETHODCALLTYPE* release) (void* thisInterface);
/* methods derived from "Steinberg_IRunLoop": */ /* methods derived from "Steinberg_IRunLoop": */
Steinberg_tresult (SMTG_STDMETHODCALLTYPE* registerEventHandler) (void* thisInterface, struct Steinberg_IEventHandler* handler, int fd); Steinberg_tresult (SMTG_STDMETHODCALLTYPE* registerEventHandler) (void* thisInterface, struct Steinberg_IEventHandler* handler, int fd);
@ -197,38 +193,35 @@ static double parameterAdjust(int i, double v) {
} }
typedef struct pluginInstance { typedef struct pluginInstance {
Steinberg_Vst_IComponentVtbl *vtblIComponent; Steinberg_Vst_IComponentVtbl * vtblIComponent;
Steinberg_Vst_IAudioProcessorVtbl *vtblIAudioProcessor; Steinberg_Vst_IAudioProcessorVtbl * vtblIAudioProcessor;
Steinberg_Vst_IProcessContextRequirementsVtbl *vtblIProcessContextRequirements; Steinberg_Vst_IProcessContextRequirementsVtbl * vtblIProcessContextRequirements;
Steinberg_uint32 refs; Steinberg_uint32 refs;
Steinberg_FUnknown *context; Steinberg_FUnknown * context;
plugin p; plugin p;
float sampleRate; float sampleRate;
#if DATA_PRODUCT_PARAMETERS_N > 0 #if DATA_PRODUCT_PARAMETERS_N > 0
float parameters[DATA_PRODUCT_PARAMETERS_N]; float parameters[DATA_PRODUCT_PARAMETERS_N];
#endif #endif
#if DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N > 0 #if DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N > 0
const float *inputs[DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N]; const float * inputs[DATA_PRODUCT_CHANNELS_AUDIO_INPUT_N];
#endif #endif
#if DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N > 0 #if DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N > 0
float *outputs[DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N]; float * outputs[DATA_PRODUCT_CHANNELS_AUDIO_OUTPUT_N];
#endif #endif
#if DATA_PRODUCT_BUSES_AUDIO_INPUT_N > 0 #if DATA_PRODUCT_BUSES_AUDIO_INPUT_N > 0
char inputsActive[DATA_PRODUCT_BUSES_AUDIO_INPUT_N]; char inputsActive[DATA_PRODUCT_BUSES_AUDIO_INPUT_N];
#endif #endif
#if DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N > 0 #if DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N > 0
char outputsActive[DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N]; char outputsActive[DATA_PRODUCT_BUSES_AUDIO_OUTPUT_N];
#endif #endif
#if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 #if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
char midiInputsActive[DATA_PRODUCT_BUSES_MIDI_INPUT_N]; char midiInputsActive[DATA_PRODUCT_BUSES_MIDI_INPUT_N];
#endif #endif
#if DATA_PRODUCT_BUSES_MIDI_OUTPUT_N > 0 #if DATA_PRODUCT_BUSES_MIDI_OUTPUT_N > 0
char midiOutputsActive[DATA_PRODUCT_BUSES_MIDI_OUTPUT_N]; char midiOutputsActive[DATA_PRODUCT_BUSES_MIDI_OUTPUT_N];
#endif
void *mem;
#ifdef PARAM_OUT_CPU_INDEX
float cpu_meter;
#endif #endif
void * mem;
} pluginInstance; } pluginInstance;
static Steinberg_Vst_IComponentVtbl pluginVtblIComponent; static Steinberg_Vst_IComponentVtbl pluginVtblIComponent;
@ -297,10 +290,10 @@ static Steinberg_tresult pluginInitialize(void *thisInterface, struct Steinberg_
p->context = context; p->context = context;
plugin_callbacks cbs = { plugin_callbacks cbs = {
/* .handle = */ (void *)p, /* .handle = */ (void *)p,
/* .format = */ "vst3", /* .format = */ "vst3",
/* .get_bindir = */ get_bindir_cb, /* .get_bindir = */ get_bindir_cb,
/* .get_datadir = */ get_datadir_cb /* .get_datadir = */ get_datadir_cb
}; };
plugin_init(&p->p, &cbs); plugin_init(&p->p, &cbs);
#if DATA_PRODUCT_PARAMETERS_N > 0 #if DATA_PRODUCT_PARAMETERS_N > 0
@ -327,9 +320,6 @@ static Steinberg_tresult pluginInitialize(void *thisInterface, struct Steinberg_
p->midiOutputsActive[i] = 0; p->midiOutputsActive[i] = 0;
#endif #endif
p->mem = NULL; p->mem = NULL;
#ifdef PARAM_OUT_CPU_INDEX
p->cpu_meter = 0.f;
#endif
return Steinberg_kResultOk; return Steinberg_kResultOk;
} }
@ -565,24 +555,24 @@ static Steinberg_tresult pluginGetState(void* thisInterface, struct Steinberg_IB
static Steinberg_Vst_IComponentVtbl pluginVtblIComponent = { static Steinberg_Vst_IComponentVtbl pluginVtblIComponent = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ pluginIComponentQueryInterface, /* .queryInterface = */ pluginIComponentQueryInterface,
/* .addRef = */ pluginIComponentAddRef, /* .addRef = */ pluginIComponentAddRef,
/* .release = */ pluginIComponentRelease, /* .release = */ pluginIComponentRelease,
/* IPluginBase */ /* IPluginBase */
/* .initialize = */ pluginInitialize, /* .initialize = */ pluginInitialize,
/* .terminate = */ pluginTerminate, /* .terminate = */ pluginTerminate,
/* IComponent */ /* IComponent */
/* .getControllerClassId = */ pluginGetControllerClassId, /* .getControllerClassId = */ pluginGetControllerClassId,
/* .setIoMode = */ pluginSetIoMode, /* .setIoMode = */ pluginSetIoMode,
/* .getBusCount = */ pluginGetBusCount, /* .getBusCount = */ pluginGetBusCount,
/* .getBusInfo = */ pluginGetBusInfo, /* .getBusInfo = */ pluginGetBusInfo,
/* .getRoutingInfo = */ pluginGetRoutingInfo, /* .getRoutingInfo = */ pluginGetRoutingInfo,
/* .activateBus = */ pluginActivateBus, /* .activateBus = */ pluginActivateBus,
/* .setActive = */ pluginSetActive, /* .setActive = */ pluginSetActive,
/* .setState = */ pluginSetState, /* .setState = */ pluginSetState,
/* .getState = */ pluginGetState /* .getState = */ pluginGetState
}; };
static Steinberg_tresult pluginIAudioProcessorQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) { static Steinberg_tresult pluginIAudioProcessorQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) {
@ -748,10 +738,6 @@ static void processParams(pluginInstance *p, struct Steinberg_Vst_ProcessData *d
static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst_ProcessData* data) { static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst_ProcessData* data) {
TRACE("plugin IAudioProcessor process\n"); TRACE("plugin IAudioProcessor process\n");
#ifdef PARAM_OUT_CPU_INDEX
const unsigned long long processTimeStart = fatica_time_process();
#endif
#if defined(__aarch64__) #if defined(__aarch64__)
uint64_t fpcr; uint64_t fpcr;
__asm__ __volatile__ ("mrs %0, fpcr" : "=r"(fpcr)); __asm__ __volatile__ ("mrs %0, fpcr" : "=r"(fpcr));
@ -827,13 +813,7 @@ static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst
for (Steinberg_int32 i = 0; i < DATA_PRODUCT_PARAMETERS_N; i++) { for (Steinberg_int32 i = 0; i < DATA_PRODUCT_PARAMETERS_N; i++) {
if (!(parameterInfo[i].flags & Steinberg_Vst_ParameterInfo_ParameterFlags_kIsReadOnly)) if (!(parameterInfo[i].flags & Steinberg_Vst_ParameterInfo_ParameterFlags_kIsReadOnly))
continue; continue;
float v; float v = plugin_get_parameter(&p->p, parameterData[i].index);
# ifdef PARAM_OUT_CPU_INDEX
if (i == PARAM_OUT_CPU_INDEX)
v = p->cpu_meter;
else
# endif
v = plugin_get_parameter(&p->p, parameterData[i].index);
if (v == p->parameters[i]) if (v == p->parameters[i])
continue; continue;
p->parameters[i] = v; p->parameters[i] = v;
@ -857,13 +837,6 @@ static Steinberg_tresult pluginProcess(void* thisInterface, struct Steinberg_Vst
_MM_SET_DENORMALS_ZERO_MODE(denormals_zero_mode); _MM_SET_DENORMALS_ZERO_MODE(denormals_zero_mode);
#endif #endif
#ifdef PARAM_OUT_CPU_INDEX
const unsigned long long processTimeEnd = fatica_time_process();
const unsigned long long processTime100n = processTimeEnd - processTimeStart;
const double processTimeS = ((double) processTime100n) * 1.0e-7;
p->cpu_meter = p->cpu_meter * 0.9f + ((float) (processTimeS * p->sampleRate)) * 0.1f;
#endif
return Steinberg_kResultOk; return Steinberg_kResultOk;
} }
@ -877,19 +850,19 @@ static Steinberg_uint32 pluginGetTailSamples(void* thisInterface) {
static Steinberg_Vst_IAudioProcessorVtbl pluginVtblIAudioProcessor = { static Steinberg_Vst_IAudioProcessorVtbl pluginVtblIAudioProcessor = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ pluginIAudioProcessorQueryInterface, /* .queryInterface = */ pluginIAudioProcessorQueryInterface,
/* .addRef = */ pluginIAudioProcessorAddRef, /* .addRef = */ pluginIAudioProcessorAddRef,
/* .release = */ pluginIAudioProcessorRelease, /* .release = */ pluginIAudioProcessorRelease,
/* IAudioProcessor */ /* IAudioProcessor */
/* .setBusArrangements = */ pluginSetBusArrangements, /* .setBusArrangements = */ pluginSetBusArrangements,
/*. getBusArrangement = */ pluginGetBusArrangement, /*. getBusArrangement = */ pluginGetBusArrangement,
/* .canProcessSampleSize = */ pluginCanProcessSampleSize, /* .canProcessSampleSize = */ pluginCanProcessSampleSize,
/* .getLatencySamples = */ pluginGetLatencySamples, /* .getLatencySamples = */ pluginGetLatencySamples,
/* .setupProcessing = */ pluginSetupProcessing, /* .setupProcessing = */ pluginSetupProcessing,
/* .setProcessing = */ pluginSetProcessing, /* .setProcessing = */ pluginSetProcessing,
/* .process = */ pluginProcess, /* .process = */ pluginProcess,
/* .getTailSamples = */ pluginGetTailSamples /* .getTailSamples = */ pluginGetTailSamples
}; };
static Steinberg_tresult pluginIProcessContextRequirementsQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) { static Steinberg_tresult pluginIProcessContextRequirementsQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) {
@ -916,31 +889,31 @@ static Steinberg_uint32 pluginGetProcessContextRequirements(void* thisInterface)
static Steinberg_Vst_IProcessContextRequirementsVtbl pluginVtblIProcessContextRequirements = { static Steinberg_Vst_IProcessContextRequirementsVtbl pluginVtblIProcessContextRequirements = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ pluginIProcessContextRequirementsQueryInterface, /* .queryInterface = */ pluginIProcessContextRequirementsQueryInterface,
/* .addRef = */ pluginIProcessContextRequirementsAddRef, /* .addRef = */ pluginIProcessContextRequirementsAddRef,
/* .release = */ pluginIProcessContextRequirementsRelease, /* .release = */ pluginIProcessContextRequirementsRelease,
/* IProcessContextRequirements */ /* IProcessContextRequirements */
/* .getProcessContextRequirements = */ pluginGetProcessContextRequirements /* .getProcessContextRequirements = */ pluginGetProcessContextRequirements
}; };
typedef struct plugView plugView; typedef struct plugView plugView;
typedef struct controller { typedef struct controller {
Steinberg_Vst_IEditControllerVtbl *vtblIEditController; Steinberg_Vst_IEditControllerVtbl * vtblIEditController;
Steinberg_Vst_IMidiMappingVtbl *vtblIMidiMapping; Steinberg_Vst_IMidiMappingVtbl * vtblIMidiMapping;
#ifdef DATA_UI #ifdef DATA_UI
//Steinberg_Vst_IConnectionPointVtbl * vtblIConnectionPoint; //Steinberg_Vst_IConnectionPointVtbl * vtblIConnectionPoint;
#endif #endif
Steinberg_uint32 refs; Steinberg_uint32 refs;
Steinberg_FUnknown *context; Steinberg_FUnknown * context;
#if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 #if DATA_PRODUCT_PARAMETERS_N + DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
double parameters[DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N]; double parameters[DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N];
#endif #endif
struct Steinberg_Vst_IComponentHandler *componentHandler; struct Steinberg_Vst_IComponentHandler * componentHandler;
#ifdef DATA_UI #ifdef DATA_UI
plugView **views; plugView ** views;
size_t viewsCount; size_t viewsCount;
#endif #endif
} controller; } controller;
@ -953,10 +926,10 @@ static Steinberg_Vst_IEditControllerVtbl controllerVtblIEditController;
# include <X11/Xlib.h> # include <X11/Xlib.h>
typedef struct { typedef struct {
Steinberg_ITimerHandlerVtbl *vtblITimerHandler; Steinberg_ITimerHandlerVtbl * vtblITimerHandler;
Steinberg_uint32 refs; Steinberg_uint32 refs;
void *data; void * data;
void (*cb)(void *data); void (*cb)(void *data);
} timerHandler; } timerHandler;
static Steinberg_tresult timerHandlerQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) { static Steinberg_tresult timerHandlerQueryInterface(void *thisInterface, const Steinberg_TUID iid, void ** obj) {
@ -1007,12 +980,12 @@ static void timerHandlerOnTimer(void* thisInterface) {
static Steinberg_ITimerHandlerVtbl timerHandlerVtblITimerHandler = { static Steinberg_ITimerHandlerVtbl timerHandlerVtblITimerHandler = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ timerHandlerQueryInterface, /* .queryInterface = */ timerHandlerQueryInterface,
/* .addRef = */ timerHandlerAddRef, /* .addRef = */ timerHandlerAddRef,
/* .release = */ timerHandlerRelease, /* .release = */ timerHandlerRelease,
/* ITimerHandler */ /* ITimerHandler */
/* .onTimer = */ timerHandlerOnTimer /* .onTimer = */ timerHandlerOnTimer
}; };
# elif defined(__APPLE__) # elif defined(__APPLE__)
@ -1025,19 +998,19 @@ static Steinberg_ITimerHandlerVtbl timerHandlerVtblITimerHandler = {
# endif # endif
typedef struct plugView { typedef struct plugView {
Steinberg_IPlugViewVtbl *vtblIPlugView; Steinberg_IPlugViewVtbl * vtblIPlugView;
Steinberg_uint32 refs; Steinberg_uint32 refs;
Steinberg_IPlugFrame *frame; Steinberg_IPlugFrame * frame;
plugin_ui *ui; plugin_ui * ui;
controller *ctrl; controller * ctrl;
# ifdef __linux__ # ifdef __linux__
Steinberg_IRunLoop *runLoop; Steinberg_IRunLoop * runLoop;
timerHandler timer; timerHandler timer;
Display *display; Display * display;
# elif defined(__APPLE__) # elif defined(__APPLE__)
CFRunLoopTimerRef timer; CFRunLoopTimerRef timer;
# elif defined(_WIN32) || defined(__CYGWIN__) # elif defined(_WIN32) || defined(__CYGWIN__)
UINT_PTR timer; UINT_PTR timer;
# endif # endif
} plugView; } plugView;
@ -1159,14 +1132,14 @@ static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Ste
return Steinberg_kInvalidArgument; return Steinberg_kInvalidArgument;
plugin_ui_callbacks cbs = { plugin_ui_callbacks cbs = {
/* .handle = */ (void *)v, /* .handle = */ (void *)v,
/* .format = */ "vst3", /* .format = */ "vst3",
/* .get_bindir = */ get_bindir_cb, /* .get_bindir = */ get_bindir_cb,
/* .get_datadir = */ get_datadir_cb, /* .get_datadir = */ get_datadir_cb,
# if DATA_PRODUCT_PARAMETERS_N > 0 # if DATA_PRODUCT_PARAMETERS_N > 0
/* .set_parameter = */ plugViewSetParameterCb /* .set_parameter = */ plugViewSetParameterCb
# else # else
/* .set_parameter = */ NULL /* .set_parameter = */ NULL
# endif # endif
}; };
v->ui = plugin_ui_create(1, parent, &cbs); v->ui = plugin_ui_create(1, parent, &cbs);
@ -1188,11 +1161,11 @@ static Steinberg_tresult plugViewAttached(void* thisInterface, void* parent, Ste
} }
# elif defined(__APPLE__) # elif defined(__APPLE__)
CFRunLoopTimerContext ctx = { CFRunLoopTimerContext ctx = {
/* .version = */ 0, /* .version = */ 0,
/* .info = */ v, /* .info = */ v,
/* .retain = */ NULL, /* .retain = */ NULL,
/* .release = */ NULL, /* .release = */ NULL,
/* .copyDescription = */ NULL /* .copyDescription = */ NULL
}; };
v->timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 20.0 / 1000.0, 0, 0, plugViewTimerCb, &ctx); v->timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 20.0 / 1000.0, 0, 0, plugViewTimerCb, &ctx);
CFRunLoopAddTimer(CFRunLoopGetCurrent(), v->timer, kCFRunLoopCommonModes); CFRunLoopAddTimer(CFRunLoopGetCurrent(), v->timer, kCFRunLoopCommonModes);
@ -1381,23 +1354,23 @@ static void plugViewOnTimer(void *thisInterface) {
static Steinberg_IPlugViewVtbl plugViewVtblIPlugView = { static Steinberg_IPlugViewVtbl plugViewVtblIPlugView = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ plugViewQueryInterface, /* .queryInterface = */ plugViewQueryInterface,
/* .addRef = */ plugViewAddRef, /* .addRef = */ plugViewAddRef,
/* .release = */ plugViewRelease, /* .release = */ plugViewRelease,
/* IPlugView */ /* IPlugView */
/* .isPlatformTypeSupported = */ plugViewIsPlatformTypeSupported, /* .isPlatformTypeSupported = */ plugViewIsPlatformTypeSupported,
/* .attached = */ plugViewAttached, /* .attached = */ plugViewAttached,
/* .removed = */ plugViewRemoved, /* .removed = */ plugViewRemoved,
/* .onWheel = */ plugViewOnWheel, /* .onWheel = */ plugViewOnWheel,
/* .onKeyDown = */ plugViewOnKeyDown, /* .onKeyDown = */ plugViewOnKeyDown,
/* .onKeyUp = */ plugViewOnKeyUp, /* .onKeyUp = */ plugViewOnKeyUp,
/* .getSize = */ plugViewGetSize, /* .getSize = */ plugViewGetSize,
/* .onSize = */ plugViewOnSize, /* .onSize = */ plugViewOnSize,
/* .onFocus = */ plugViewOnFocus, /* .onFocus = */ plugViewOnFocus,
/* .setFrame = */ plugViewSetFrame, /* .setFrame = */ plugViewSetFrame,
/* .canResize = */ plugViewCanResize, /* .canResize = */ plugViewCanResize,
/* .checkSizeConstraint = */ plugViewCheckSizeConstraint /* .checkSizeConstraint = */ plugViewCheckSizeConstraint
}; };
#endif #endif
@ -1482,7 +1455,7 @@ static Steinberg_tresult controllerInitialize(void* thisInterface, struct Steinb
#endif #endif
#if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0 #if DATA_PRODUCT_BUSES_MIDI_INPUT_N > 0
for (int i = DATA_PRODUCT_PARAMETERS_N; i < DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N; i += 3) { for (int i = DATA_PRODUCT_PARAMETERS_N; i < DATA_PRODUCT_PARAMETERS_N + 3 * DATA_PRODUCT_BUSES_MIDI_INPUT_N; i += 3) {
c->parameters[i ] = 0.0; c->parameters[i] = 0.0;
c->parameters[i + 1] = 0.5; c->parameters[i + 1] = 0.5;
c->parameters[i + 2] = 0.0; c->parameters[i + 2] = 0.0;
} }
@ -1766,28 +1739,28 @@ static struct Steinberg_IPlugView* controllerCreateView(void* thisInterface, Ste
static Steinberg_Vst_IEditControllerVtbl controllerVtblIEditController = { static Steinberg_Vst_IEditControllerVtbl controllerVtblIEditController = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ controllerIEditControllerQueryInterface, /* .queryInterface = */ controllerIEditControllerQueryInterface,
/* .addRef = */ controllerIEditControllerAddRef, /* .addRef = */ controllerIEditControllerAddRef,
/* .release = */ controllerIEditControllerRelease, /* .release = */ controllerIEditControllerRelease,
/* IPluginBase */ /* IPluginBase */
/* .initialize = */ controllerInitialize, /* .initialize = */ controllerInitialize,
/* .terminate = */ controllerTerminate, /* .terminate = */ controllerTerminate,
/* IEditController */ /* IEditController */
/* .setComponentState = */ controllerSetComponentState, /* .setComponentState = */ controllerSetComponentState,
/* .setState = */ controllerSetState, /* .setState = */ controllerSetState,
/* .getState = */ controllerGetState, /* .getState = */ controllerGetState,
/* .getParameterCount = */ controllerGetParameterCount, /* .getParameterCount = */ controllerGetParameterCount,
/* .getParameterInfo = */ controllerGetParameterInfo, /* .getParameterInfo = */ controllerGetParameterInfo,
/* .getParamStringByValue = */ controllerGetParamStringByValue, /* .getParamStringByValue = */ controllerGetParamStringByValue,
/* .getParamValueByString = */ controllerGetParamValueByString, /* .getParamValueByString = */ controllerGetParamValueByString,
/* .normalizedParamToPlain = */ controllerNormalizedParamToPlain, /* .normalizedParamToPlain = */ controllerNormalizedParamToPlain,
/* .plainParamToNormalized = */ controllerPlainParamToNormalized, /* .plainParamToNormalized = */ controllerPlainParamToNormalized,
/* .getParamNormalized = */ controllerGetParamNormalized, /* .getParamNormalized = */ controllerGetParamNormalized,
/* .setParamNormalized = */ controllerSetParamNormalized, /* .setParamNormalized = */ controllerSetParamNormalized,
/* .setComponentHandler = */ controllerSetComponentHandler, /* .setComponentHandler = */ controllerSetComponentHandler,
/* .createView = */ controllerCreateView /* .createView = */ controllerCreateView
}; };
static Steinberg_tresult controllerIMidiMappingQueryInterface(void* thisInterface, const Steinberg_TUID iid, void** obj) { static Steinberg_tresult controllerIMidiMappingQueryInterface(void* thisInterface, const Steinberg_TUID iid, void** obj) {
@ -1833,12 +1806,12 @@ static Steinberg_tresult controllerGetMidiControllerAssignment(void* thisInterfa
static Steinberg_Vst_IMidiMappingVtbl controllerVtblIMidiMapping = { static Steinberg_Vst_IMidiMappingVtbl controllerVtblIMidiMapping = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ controllerIMidiMappingQueryInterface, /* .queryInterface = */ controllerIMidiMappingQueryInterface,
/* .addRef = */ controllerIMidiMappingAddRef, /* .addRef = */ controllerIMidiMappingAddRef,
/* .release = */ controllerIMidiMappingRelease, /* .release = */ controllerIMidiMappingRelease,
/* IMidiMapping */ /* IMidiMapping */
/* .getMidiControllerAssignment = */ controllerGetMidiControllerAssignment /* .getMidiControllerAssignment = */ controllerGetMidiControllerAssignment
}; };
#ifdef DATA_UI #ifdef DATA_UI
@ -1880,14 +1853,14 @@ static Steinberg_tresult controllerIConnectionPointNotify(void* thisInterface, s
static Steinberg_Vst_IConnectionPointVtbl controllerVtblIConnectionPoint = { static Steinberg_Vst_IConnectionPointVtbl controllerVtblIConnectionPoint = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ controllerIConnectionPointQueryInterface, /* .queryInterface = */ controllerIConnectionPointQueryInterface,
/* .addRef = */ controllerIConnectionPointAddRef, /* .addRef = */ controllerIConnectionPointAddRef,
/* .release = */ controllerIConnectionPointRelease, /* .release = */ controllerIConnectionPointRelease,
/* IConnectionPoint */ /* IConnectionPoint */
/* .connect = */ controllerIConnectionPointConnect, /* .connect = */ controllerIConnectionPointConnect,
/* .disconnect = */ controllerIConnectionPointDisconnect, /* .disconnect = */ controllerIConnectionPointDisconnect,
/* .notify = */ controllerIConnectionPointNotify /* .notify = */ controllerIConnectionPointNotify
}; };
# endif # endif
#endif #endif
@ -2112,22 +2085,22 @@ static Steinberg_tresult factorySetHostContext(void* thisInterface, struct Stein
static Steinberg_IPluginFactory3Vtbl factoryVtbl = { static Steinberg_IPluginFactory3Vtbl factoryVtbl = {
/* FUnknown */ /* FUnknown */
/* .queryInterface = */ factoryQueryInterface, /* .queryInterface = */ factoryQueryInterface,
/* .addRef = */ factoryAddRef, /* .addRef = */ factoryAddRef,
/* .release = */ factoryRelease, /* .release = */ factoryRelease,
/* IPluginFactory */ /* IPluginFactory */
/* .getFactoryInfo = */ factoryGetFactoryInfo, /* .getFactoryInfo = */ factoryGetFactoryInfo,
/* .countClasses = */ factoryCountClasses, /* .countClasses = */ factoryCountClasses,
/* .getClassInfo = */ factoryGetClassInfo, /* .getClassInfo = */ factoryGetClassInfo,
/* .createInstance = */ factoryCreateInstance, /* .createInstance = */ factoryCreateInstance,
/* IPluginFactory2 */ /* IPluginFactory2 */
/* .getClassInfo2 = */ factoryGetClassInfo2, /* .getClassInfo2 = */ factoryGetClassInfo2,
/* IPluginFactory3 */ /* IPluginFactory3 */
/* .getClassInfoUnicode = */ factoryGetClassInfoUnicode, /* .getClassInfoUnicode = */ factoryGetClassInfoUnicode,
/* .setHostContext = */ factorySetHostContext /* .setHostContext = */ factorySetHostContext
}; };
static Steinberg_IPluginFactory3 factory = { &factoryVtbl }; static Steinberg_IPluginFactory3 factory = { &factoryVtbl };

View File

@ -3,7 +3,6 @@
dir=`dirname $0` dir=`dirname $0`
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3 $dir/../out/vst3 $dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json $dir/../templates/vst3 $dir/../out/vst3
$dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json,$dir/vst3-make.json $dir/../templates/vst3-make $dir/../out/vst3 $dir/../tibia $dir/product.json,$dir/company.json,$dir/vst3.json,$dir/vst3-make.json $dir/../templates/vst3-make $dir/../out/vst3
cp $dir/../templates/common/* $dir/../out/vst3/src/
cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/vst3/src cp $dir/plugin.h $dir/plugin_ui.h $dir/../out/vst3/src
$dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2 $dir/../out/lv2 $dir/../tibia $dir/product.json,$dir/company.json,$dir/lv2.json $dir/../templates/lv2 $dir/../out/lv2