mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04: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::string& where,
|
||||||
const std::optional<Steinberg::FUID>& uid) {
|
const std::optional<Steinberg::FUID>& uid) {
|
||||||
if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) {
|
if (BOOST_UNLIKELY(logger.verbosity >= Logger::Verbosity::most_events)) {
|
||||||
char uid_string[128] = "<invalid_pointer>";
|
std::string uid_string = uid ? format_uid(*uid) : "<unknown_pointer>";
|
||||||
if (uid) {
|
|
||||||
uid->print(uid_string, Steinberg::FUID::UIDPrintStyle::kCLASS_UID);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostringstream message;
|
std::ostringstream message;
|
||||||
message << "[unknown interface] " << where << ": " << uid_string;
|
message << "[unknown interface] " << where << ": " << uid_string;
|
||||||
|
|||||||
@@ -15,10 +15,27 @@
|
|||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#include "base.h"
|
#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) {
|
std::u16string tchar_pointer_to_u16string(const Steinberg::Vst::TChar* string) {
|
||||||
#ifdef __WINE__
|
#ifdef __WINE__
|
||||||
// This is great, thanks Steinberg
|
// 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;
|
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
|
* Convert a UTF-16 C-style string to an `std::u16string`. Who event invented
|
||||||
* UTF-16?
|
* UTF-16?
|
||||||
|
|||||||
Reference in New Issue
Block a user