mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Implement a UID formatting function
This commit is contained in:
@@ -24,10 +24,7 @@ void Vst3Logger::log_unknown_interface(
|
||||
const std::string& where,
|
||||
const std::optional<Steinberg::FUID>& uid) {
|
||||
if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) {
|
||||
char uid_string[128] = "<invalid_pointer>";
|
||||
if (uid) {
|
||||
uid->print(uid_string, Steinberg::FUID::UIDPrintStyle::kCLASS_UID);
|
||||
}
|
||||
std::string uid_string = uid ? format_uid(*uid) : "<unknown_pointer>";
|
||||
|
||||
std::ostringstream message;
|
||||
message << "[unknown interface] " << where << ": " << uid_string;
|
||||
|
||||
@@ -15,10 +15,27 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#include <cassert>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "base.h"
|
||||
|
||||
std::string format_uid(const Steinberg::FUID& uid) {
|
||||
// This is the same as `FUID::print`, but without any macro prefixes
|
||||
uint32 l1, l2, l3, l4;
|
||||
uid.to4Int(l1, l2, l3, l4);
|
||||
|
||||
std::ostringstream formatted_uid;
|
||||
formatted_uid << std::hex << std::uppercase << "(0x" << std::setfill('0')
|
||||
<< std::setw(8) << l1 << ", 0x" << std::setfill('0')
|
||||
<< std::setw(8) << l2 << ", 0x" << std::setfill('0')
|
||||
<< std::setw(8) << l3 << ", 0x" << std::setfill('0')
|
||||
<< std::setw(8) << l4 << ")";
|
||||
|
||||
return formatted_uid.str();
|
||||
}
|
||||
|
||||
std::u16string tchar_pointer_to_u16string(const Steinberg::Vst::TChar* string) {
|
||||
#ifdef __WINE__
|
||||
// This is great, thanks Steinberg
|
||||
|
||||
@@ -53,6 +53,11 @@ constexpr size_t max_num_speakers = 16384;
|
||||
*/
|
||||
constexpr size_t max_vector_stream_size = 50 << 20;
|
||||
|
||||
/**
|
||||
* Format a FUID as a simple hexadecimal four-tuple.
|
||||
*/
|
||||
std::string format_uid(const Steinberg::FUID& uid);
|
||||
|
||||
/**
|
||||
* Convert a UTF-16 C-style string to an `std::u16string`. Who event invented
|
||||
* UTF-16?
|
||||
|
||||
Reference in New Issue
Block a user