diff --git a/src/common/logging/vst3.cpp b/src/common/logging/vst3.cpp index 3f511c1b..55f9c115 100644 --- a/src/common/logging/vst3.cpp +++ b/src/common/logging/vst3.cpp @@ -119,12 +119,60 @@ void Vst3Logger::log_request(bool is_host_vst, void Vst3Logger::log_request(bool is_host_vst, const YaAudioProcessor::Process& request) { - // TODO: Only log this on log level 2 - log_request_base(is_host_vst, [&](auto& message) { - // TODO: Log about the process data - message << "::process(TODO)"; - }); + log_request_base( + is_host_vst, Logger::Verbosity::all_events, [&](auto& message) { + // This is incredibly verbose, but if you're really a plugin that + // handles processing in a weird way you're going to need all of + // this + + std::ostringstream num_input_channels; + num_input_channels << "["; + for (bool is_first = true; + const auto& buffers : request.data.inputs) { + num_input_channels << (is_first ? "" : ", ") + << buffers.num_channels(); + is_first = false; + } + num_input_channels << "]"; + + std::ostringstream num_output_channels; + num_output_channels << "["; + for (bool is_first = true; + const auto& num_channels : request.data.outputs_num_channels) { + num_output_channels << (is_first ? "" : ", ") << num_channels; + is_first = false; + } + num_output_channels << "]"; + + message << "::process(data = , output_parameter_changes = " + << (request.data.output_parameter_changes_supported + ? "" + : "nullptr") + << ", input_events = "; + if (request.data.input_events) { + message << "num_events() + << " events>"; + } else { + message << "nullptr"; + } + message << ", output_events = " + << (request.data.output_events_supported ? "" + : "nullptr") + << ", process_context = " + << (request.data.process_context ? "" + : "nullptr") + << ", process_mode = " << request.data.process_mode + << ", symbolic_sample_size = " + << request.data.symbolic_sample_size << ">)"; + }); } void Vst3Logger::log_request(bool is_host_vst, @@ -284,12 +332,44 @@ void Vst3Logger::log_response( void Vst3Logger::log_response( bool is_host_vst, const YaAudioProcessor::ProcessResponse& response) { - // TODO: Only log this on verbosity level 2 - log_response_base(is_host_vst, [&](auto& message) { - message << response.result.string(); + log_response_base( + is_host_vst, Logger::Verbosity::all_events, [&](auto& message) { + message << response.result.string(); - // TODO: Log response - }); + // This is incredibly verbose, but if you're really a plugin that + // handles processing in a weird way you're going to need all of + // this + + std::ostringstream num_output_channels; + num_output_channels << "["; + for (bool is_first = true; + const auto& buffers : response.output_data.outputs) { + num_output_channels << (is_first ? "" : ", ") + << buffers.num_channels(); + is_first = false; + } + num_output_channels << "]"; + + message << ""; + + if (response.output_data.output_parameter_changes) { + message << ", num_parameters() + << " parameters>"; + } else { + message << ", host does not support parameter outputs"; + } + + if (response.output_data.output_events) { + message << ", num_events() + << " events>"; + } else { + message << ", host does not support event outputs"; + } + }); } void Vst3Logger::log_response(bool is_host_vst, diff --git a/src/common/logging/vst3.h b/src/common/logging/vst3.h index 8360b828..2e23c85b 100644 --- a/src/common/logging/vst3.h +++ b/src/common/logging/vst3.h @@ -115,9 +115,10 @@ class Vst3Logger { * every logging function so we don't have to repeat it everywhere. */ template F> - void log_request_base(bool is_host_vst, F callback) { - if (BOOST_UNLIKELY(logger.verbosity >= - Logger::Verbosity::most_events)) { + void log_request_base(bool is_host_vst, + Logger::Verbosity min_verbosity, + F callback) { + if (BOOST_UNLIKELY(logger.verbosity >= min_verbosity)) { std::ostringstream message; if (is_host_vst) { message << "[host -> vst] >> "; @@ -130,14 +131,20 @@ class Vst3Logger { } } + template F> + void log_request_base(bool is_host_vst, F callback) { + log_request_base(is_host_vst, Logger::Verbosity::most_events, callback); + } + /** * Log a response with a standard prefix based on the boolean flag we pass * to every logging function so we don't have to repeat it everywhere. */ template F> - void log_response_base(bool is_host_vst, F callback) { - if (BOOST_UNLIKELY(logger.verbosity >= - Logger::Verbosity::most_events)) { + void log_response_base(bool is_host_vst, + Logger::Verbosity min_verbosity, + F callback) { + if (BOOST_UNLIKELY(logger.verbosity >= min_verbosity)) { std::ostringstream message; if (is_host_vst) { message << "[host -> vst] "; @@ -149,4 +156,10 @@ class Vst3Logger { log(message.str()); } } + + template F> + void log_response_base(bool is_host_vst, F callback) { + log_response_base(is_host_vst, Logger::Verbosity::most_events, + callback); + } }; diff --git a/src/common/serialization/vst3/event-list.cpp b/src/common/serialization/vst3/event-list.cpp index a60f7023..da882533 100644 --- a/src/common/serialization/vst3/event-list.cpp +++ b/src/common/serialization/vst3/event-list.cpp @@ -190,8 +190,10 @@ YaEventList::YaEventList(Steinberg::Vst::IEventList& event_list) { } } -YaEventList::~YaEventList() { - FUNKNOWN_DTOR +YaEventList::~YaEventList(){FUNKNOWN_DTOR} + +size_t YaEventList::num_events() const { + return events.size(); } void YaEventList::write_back_outputs( diff --git a/src/common/serialization/vst3/event-list.h b/src/common/serialization/vst3/event-list.h index 84ae6059..ce052bea 100644 --- a/src/common/serialization/vst3/event-list.h +++ b/src/common/serialization/vst3/event-list.h @@ -227,6 +227,11 @@ class YaEventList : public Steinberg::Vst::IEventList { DECLARE_FUNKNOWN_METHODS + /** + * Return the number of events we store. Used in debug logs. + */ + size_t num_events() const; + /** * Write these events an output events queue on the `ProcessData` object * provided by the host. diff --git a/src/common/serialization/vst3/parameter-changes.cpp b/src/common/serialization/vst3/parameter-changes.cpp index 44c4bb62..83b8ed50 100644 --- a/src/common/serialization/vst3/parameter-changes.cpp +++ b/src/common/serialization/vst3/parameter-changes.cpp @@ -41,6 +41,10 @@ IMPLEMENT_FUNKNOWN_METHODS(YaParameterChanges, Steinberg::Vst::IParameterChanges::iid) #pragma GCC diagnostic pop +size_t YaParameterChanges::num_parameters() const { + return queues.size(); +} + void YaParameterChanges::write_back_outputs( Steinberg::Vst::IParameterChanges& output_queues) const { for (auto& queue : queues) { diff --git a/src/common/serialization/vst3/parameter-changes.h b/src/common/serialization/vst3/parameter-changes.h index 600dd08b..83fc3a3e 100644 --- a/src/common/serialization/vst3/parameter-changes.h +++ b/src/common/serialization/vst3/parameter-changes.h @@ -45,6 +45,12 @@ class YaParameterChanges : public Steinberg::Vst::IParameterChanges { DECLARE_FUNKNOWN_METHODS + /** + * Return the number of parameter we have parameter change queues for. Used + * in debug logs. + */ + size_t num_parameters() const; + /** * Write these changes back to an output parameter changes queue on the * `ProcessData` object provided by the host. diff --git a/src/common/serialization/vst3/process-data.cpp b/src/common/serialization/vst3/process-data.cpp index b733ee4c..1e805495 100644 --- a/src/common/serialization/vst3/process-data.cpp +++ b/src/common/serialization/vst3/process-data.cpp @@ -92,6 +92,11 @@ Steinberg::Vst::AudioBusBuffers YaAudioBusBuffers::get() { return reconstructed_buffers; } +size_t YaAudioBusBuffers::num_channels() const { + return std::visit([&](const auto& buffers) { return buffers.size(); }, + buffers); +} + void YaAudioBusBuffers::write_back_outputs( Steinberg::Vst::AudioBusBuffers& output_buffers) const { output_buffers.silenceFlags = silence_flags; diff --git a/src/common/serialization/vst3/process-data.h b/src/common/serialization/vst3/process-data.h index 2a38052b..846244ea 100644 --- a/src/common/serialization/vst3/process-data.h +++ b/src/common/serialization/vst3/process-data.h @@ -72,6 +72,11 @@ class YaAudioBusBuffers { */ Steinberg::Vst::AudioBusBuffers get(); + /** + * Return the number of channels in `buffers`. Only used for debug logs. + */ + size_t num_channels() const; + /** * Write these buffers and the silence flag back to an `AudioBusBuffers * object provided by the host. @@ -203,7 +208,6 @@ class YaProcessData { // of the `output*` fields defined below it } - private: // These fields are input and context data read from the original // `ProcessData` object @@ -266,6 +270,7 @@ class YaProcessData { */ std::optional process_context; + private: // These are the same fields as in `YaProcessDataResponse`. We'll generate // these as part of creating `reconstructed_process_data`, and they will be // moved into a response object during `move_outputs_to_response()`.