Skip to content

Commit

Permalink
Merge branch 'next' of https://github.com/defiantnerd/clap-wrapper in…
Browse files Browse the repository at this point in the history
…to next
  • Loading branch information
defiantnerd committed Sep 8, 2024
2 parents 344366d + 90b16c5 commit f5440cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/detail/auv2/auv2_base_classes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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)
Expand All @@ -457,7 +457,6 @@ class WrapAsAUV2 : public ausdk::AUBase,
_hostname.append(" (");
_hostname.append(text);
_hostname.append(")");
CFRelease(myVersionString);
}
_hostname.append(" (CLAP-as-AUv2)");
}
Expand Down
9 changes: 7 additions & 2 deletions src/detail/vst3/parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <clap/ext/params.h>
#include <public.sdk/source/vst/vstparameters.h>
#include <functional>
#include <cmath>

class Vst3Parameter : public Steinberg::Vst::Parameter
{
Expand All @@ -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;
}
Expand All @@ -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);
}
Expand Down

0 comments on commit f5440cb

Please sign in to comment.