String128 literal and numeric conversions

SDK for VST 3 audio plug-in and host development.
programaudio
Posts: 7
Joined: Mon Oct 03, 2016 4:09 am

String128 literal and numeric conversions

Postby programaudio » Mon Jun 25, 2018 3:44 am

How can string literals and numeric values be assigned to Steinberg::Vst::String128 tchar*'s, for both SMTG_OS_OSX and SMTG_WINDOWS?
Xcode to_string.png

Xcode string literal.png
You do not have the required permissions to view the files attached to this post.

ray
Posts: 73
Joined: Fri Sep 02, 2016 9:37 am

Re: String128 literal and numeric conversions

Postby ray » Mon Jun 25, 2018 8:01 am

programaudio wrote:How can string literals and numeric values be assigned to Steinberg::Vst::String128 tchar*'s, for both SMTG_OS_OSX and SMTG_WINDOWS?
Xcode to_string.png

Xcode string literal.png


Check Steinberg::String, which is the SDK's platform independent wrapper class for converting between different string encodings. Also note that SMTG_OS_OSX and SMTG_OS_WINDOWS are macros, so you can use the preprocessor to generate platform specific code at compile time, e.g.

Code: Select all

#if SMTG_OS_OSX
// OSX specific code...
#elif SMTG_OS_WINDOWS
// Windows speicifc code...
#endif


Your code is trying to distinguish at runtime, which will lead to build issues if stuff isn't available in another compiler/build environment.

programaudio
Posts: 7
Joined: Mon Oct 03, 2016 4:09 am

Re: String128 literal and numeric conversions

Postby programaudio » Sun Jul 01, 2018 3:33 pm

This revised code works on Mac and PC.
std_string to String128.png
You do not have the required permissions to view the files attached to this post.


Return to “VST 3 SDK”

Who is online

Users browsing this forum: No registered users and 0 guests