From 1043776e52b99cff01116eb9d42bf36e1b9f89ad Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Sat, 30 Jan 2021 13:56:58 +0100 Subject: [PATCH] Differentiate between cached values in logs If it turns out we forgot to flush this cache in some place. --- src/common/logging/vst3.cpp | 6 +++++- src/common/logging/vst3.h | 16 ++++++++++++---- src/plugin/bridges/vst3-impls/plugin-proxy.cpp | 11 ++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index fca09c53..94322ec4 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -1776,7 +1776,8 @@ void Vst3Logger::log_response( } void Vst3Logger::log_response(bool is_host_vst, - const YaComponent::GetBusInfoResponse& response) { + const YaComponent::GetBusInfoResponse& response, + bool from_cache) { log_response_base(is_host_vst, [&](auto& message) { message << response.result.string(); if (response.result == Steinberg::kResultOk) { @@ -1785,6 +1786,9 @@ void Vst3Logger::log_response(bool is_host_vst, << "\" with " << response.updated_bus.channelCount << " channels, type = " << response.updated_bus.busType << ", flags = " << response.updated_bus.flags << ">"; + if (from_cache) { + message << " (from cache)"; + } } }); } diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 4394b9c1..35b014d8 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -305,7 +305,9 @@ class Vst3Logger { const YaAudioProcessor::ProcessResponse&); void log_response(bool is_host_vst, const YaComponent::GetControllerClassIdResponse&); - void log_response(bool is_host_vst, const YaComponent::GetBusInfoResponse&); + void log_response(bool is_host_vst, + const YaComponent::GetBusInfoResponse&, + bool from_cache = false); void log_response(bool is_host_vst, const YaComponent::GetRoutingInfoResponse&); void log_response( @@ -319,10 +321,16 @@ class Vst3Logger { void log_response(bool is_host_vst, const YaProgress::StartResponse&); template - void log_response(bool is_host_vst, const PrimitiveWrapper& value) { + void log_response(bool is_host_vst, + const PrimitiveWrapper& value, + bool from_cache = false) { // For logging all primitive return values other than `tresult` - log_response_base(is_host_vst, - [&](auto& message) { message << value; }); + log_response_base(is_host_vst, [&](auto& message) { + message << value; + if (from_cache) { + message << " (from cache)"; + } + }); } Logger& logger; diff --git a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp index a5ea3952..2b09726a 100644 --- a/src/plugin/bridges/vst3-impls/plugin-proxy.cpp +++ b/src/plugin/bridges/vst3-impls/plugin-proxy.cpp @@ -231,8 +231,8 @@ Vst3PluginProxyImpl::getBusCount(Steinberg::Vst::MediaType type, it != processing_bus_cache->bus_count.end()) { const bool log_response = bridge.logger.log_request(true, request); if (log_response) { - // TODO: Add to the log message that this information was cached - bridge.logger.log_response(true, PrimitiveWrapper(it->second)); + bridge.logger.log_response(true, PrimitiveWrapper(it->second), + true); } return it->second; @@ -268,10 +268,11 @@ Vst3PluginProxyImpl::getBusInfo(Steinberg::Vst::MediaType type, it != processing_bus_cache->bus_info.end()) { const bool log_response = bridge.logger.log_request(true, request); if (log_response) { - // TODO: Add to the log message that this information was cached bridge.logger.log_response( - true, GetBusInfoResponse{.result = Steinberg::kResultOk, - .updated_bus = it->second}); + true, + GetBusInfoResponse{.result = Steinberg::kResultOk, + .updated_bus = it->second}, + true); } bus = it->second;