diff --git a/src/detail/auv2/auv2_base_classes.h b/src/detail/auv2/auv2_base_classes.h index 5ca925d0..9b9f661d 100644 --- a/src/detail/auv2/auv2_base_classes.h +++ b/src/detail/auv2/auv2_base_classes.h @@ -426,17 +426,19 @@ class WrapAsAUV2 : public ausdk::AUBase, const char* host_get_name() override { char text[65]; + // No need to release any of these "Get" functions. + // https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-SW1 CFBundleRef applicationBundle = CFBundleGetMainBundle(); if (applicationBundle != NULL) { CFStringRef myProductString = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(applicationBundle, kCFBundleNameKey); + if (myProductString) { CFStringGetCString(myProductString, text, 64, kCFStringEncodingUTF8); _hostname = text; - CFRelease(myProductString); } else { @@ -445,10 +447,8 @@ class WrapAsAUV2 : public ausdk::AUBase, { CFStringGetCString(applicationBundleID, text, 64, kCFStringEncodingUTF8); _hostname = text; - CFRelease(applicationBundleID); } } - // CFRelease(applicationBundle); Don't release it CFStringRef myVersionString = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(applicationBundle, kCFBundleVersionKey); if (myVersionString) @@ -457,7 +457,6 @@ class WrapAsAUV2 : public ausdk::AUBase, _hostname.append(" ("); _hostname.append(text); _hostname.append(")"); - CFRelease(myVersionString); } _hostname.append(" (CLAP-as-AUv2)"); } diff --git a/src/detail/vst3/parameter.h b/src/detail/vst3/parameter.h index f75a2e11..e2ef4c57 100644 --- a/src/detail/vst3/parameter.h +++ b/src/detail/vst3/parameter.h @@ -26,6 +26,7 @@ #include #include #include +#include class Vst3Parameter : public Steinberg::Vst::Parameter { @@ -50,11 +51,15 @@ class Vst3Parameter : public Steinberg::Vst::Parameter bool fromString(const Steinberg::Vst::TChar* string, Steinberg::Vst::ParamValue& valueNormalized) const override; #endif + // for asClapValue() and asVst3Value() + // regarding conversion and the meaning of stepCount take a look here: + // https://steinbergmedia.github.io/vst3_dev_portal/pages/Technical+Documentation/Parameters+Automation/Index.html#conversion-of-normalized-values + inline double asClapValue(double vst3value) const { if (info.stepCount > 0) { - return (vst3value * info.stepCount + 1) + min_value; + return (vst3value * info.stepCount) + min_value; } return (vst3value * (max_value - min_value)) + min_value; } @@ -63,7 +68,7 @@ class Vst3Parameter : public Steinberg::Vst::Parameter auto& info = this->getInfo(); if (info.stepCount > 0) { - return (clapvalue - min_value) / float(info.stepCount + 1); + return floor(clapvalue - min_value) / float(info.stepCount); } return (clapvalue - min_value) / (max_value - min_value); }