mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 12:30:00 +02:00
Move TChar* -> std::u16string conversion to base.h
We're going to need it for VST3 events.
This commit is contained in:
@@ -19,6 +19,16 @@
|
||||
|
||||
#include "base.h"
|
||||
|
||||
std::u16string tchar_string_to_u16string(const Steinberg::Vst::TChar* string) {
|
||||
#ifdef __WINE__
|
||||
// This is great, thanks Steinberg
|
||||
static_assert(sizeof(Steinberg::Vst::TChar) == sizeof(char16_t));
|
||||
return std::u16string(reinterpret_cast<const char16_t*>(string));
|
||||
#else
|
||||
return std::u16string(static_cast<const char16_t*>(string));
|
||||
#endif
|
||||
}
|
||||
|
||||
UniversalTResult::UniversalTResult() : universal_result(Value::kResultFalse) {}
|
||||
|
||||
UniversalTResult::UniversalTResult(tresult native_result)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <pluginterfaces/base/ftypes.h>
|
||||
#include <pluginterfaces/base/funknown.h>
|
||||
#include <pluginterfaces/base/ibstream.h>
|
||||
#include <pluginterfaces/vst/vsttypes.h>
|
||||
|
||||
// Yet Another layer of includes, but these are some VST3-specific typedefs that
|
||||
// we'll need for all of our interfaces
|
||||
@@ -51,6 +52,12 @@ constexpr size_t max_num_speakers = 16384;
|
||||
*/
|
||||
constexpr size_t max_vector_stream_size = 50 << 20;
|
||||
|
||||
/**
|
||||
* Convert a UTF-16 C-style string to an `std::u16string`. Who event invented
|
||||
* UTF-16?
|
||||
*/
|
||||
std::u16string tchar_string_to_u16string(const Steinberg::Vst::TChar* string);
|
||||
|
||||
/**
|
||||
* Empty struct for when we have send a response to some operation without any
|
||||
* result values.
|
||||
|
||||
@@ -24,13 +24,7 @@ YaHostApplication::ConstructArgs::ConstructArgs(
|
||||
: component_instance_id(component_instance_id) {
|
||||
Steinberg::Vst::String128 name_array;
|
||||
if (context->getName(name_array) == Steinberg::kResultOk) {
|
||||
#ifdef __WINE__
|
||||
// Who even invented UTF-16
|
||||
static_assert(sizeof(Steinberg::Vst::TChar) == sizeof(char16_t));
|
||||
name = std::u16string(reinterpret_cast<const char16_t*>(name_array));
|
||||
#else
|
||||
name = std::u16string(static_cast<const char16_t*>(name_array));
|
||||
#endif
|
||||
name = tchar_string_to_u16string(name_array);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user