From bda8b75c78a68b14dee99b7fd8b72ed04d163b1d Mon Sep 17 00:00:00 2001 From: Paolo Marrone Date: Fri, 10 Jan 2025 17:17:08 +0100 Subject: [PATCH] sdbm moved to tibia --- templates/vst3/src/data.h | 10 +++++----- templates/vst3/tibia-index.js | 7 ------- tibia | 7 +++++++ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/templates/vst3/src/data.h b/templates/vst3/src/data.h index a8e5f4b..9fb5ebc 100644 --- a/templates/vst3/src/data.h +++ b/templates/vst3/src/data.h @@ -129,7 +129,7 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_ {{~it.product.parameters.filter(x => !x.isLatency) :p:i}} { {{?p.isBypass}} - /* .id = */ {{=(it.tibia.vst3.sdbm("Bypass") & 0x7fffffff) >>> 0}}, + /* .id = */ {{=(it.tibia.sdbm("Bypass") & 0x7fffffff) >>> 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 }, /* .units = */ { 0 }, @@ -138,7 +138,7 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_ /* .unitId = */ 0, /* .flags = */ Steinberg_Vst_ParameterInfo_ParameterFlags_kIsBypass | Steinberg_Vst_ParameterInfo_ParameterFlags_kCanAutomate {{??}} - /* .id = */ {{=(it.tibia.vst3.sdbm(p.name) & 0x7fffffff) >>> 0}}, + /* .id = */ {{=(it.tibia.sdbm(p.name) & 0x7fffffff) >>> 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 }, /* .units = */ { {{~Array.from(p.unit in it.tibia.vst3.units ? it.tibia.vst3.units[p.unit] : "") :c}}0x{{=c.charCodeAt(0).toString(16)}}, {{~}}0 }, @@ -151,7 +151,7 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_ {{~}} {{~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.sdbm(b.name + " Channel Pressure") & 0x7fffffff) >>> 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 }, /* .units = */ { 0 }, @@ -161,7 +161,7 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_ /* .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.sdbm(b.name + " Pitch Bend") & 0x7fffffff) >>> 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 }, /* .units = */ { 0 }, @@ -171,7 +171,7 @@ static struct Steinberg_Vst_ParameterInfo parameterInfo[DATA_PRODUCT_PARAMETERS_ /* .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.sdbm(b.name + " Mod Wheel") & 0x7fffffff) >>> 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 }, /* .units = */ { 0 }, diff --git a/templates/vst3/tibia-index.js b/templates/vst3/tibia-index.js index c2e3213..553c0af 100644 --- a/templates/vst3/tibia-index.js +++ b/templates/vst3/tibia-index.js @@ -49,13 +49,6 @@ module.exports = function (data, api, outputCommon, outputData) { "pc": "%", "s": "s", "semitone12TET": "semi" - }, - - sdbm: function (s) { - var hash = 0; - for (var i = 0; i < s.length; i++) - hash = s.charCodeAt(i) + (hash << 6) + (hash << 16) - hash; - return hash >>> 0; } }; diff --git a/tibia b/tibia index 3819c85..6d80b17 100755 --- a/tibia +++ b/tibia @@ -171,6 +171,13 @@ data.tibia = { } } return s; + }, + + sdbm: function (s) { + var hash = 0; + for (var i = 0; i < s.length; i++) + hash = s.charCodeAt(i) + (hash << 6) + (hash << 16) - hash; + return hash >>> 0; } };