mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 12:30:12 +02:00
Add logging for the input speaker configuration
This commit is contained in:
+6
-4
@@ -155,7 +155,8 @@ intptr_t send_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
|
||||
if (logging.has_value()) {
|
||||
auto [logger, is_dispatch] = logging.value();
|
||||
logger.log_event(is_dispatch, opcode, index, value, payload, option);
|
||||
logger.log_event(is_dispatch, opcode, index, value, payload, option,
|
||||
value_payload);
|
||||
}
|
||||
|
||||
const Event event{opcode, index, value, option, payload, value_payload};
|
||||
@@ -174,7 +175,7 @@ intptr_t send_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
if (logging.has_value()) {
|
||||
auto [logger, is_dispatch] = logging.value();
|
||||
logger.log_event_response(is_dispatch, opcode, response.return_value,
|
||||
response.payload);
|
||||
response.payload, response.value_payload);
|
||||
}
|
||||
|
||||
data_converter.write(opcode, data, response);
|
||||
@@ -211,14 +212,15 @@ void receive_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
if (logging.has_value()) {
|
||||
auto [logger, is_dispatch] = logging.value();
|
||||
logger.log_event(is_dispatch, event.opcode, event.index, event.value,
|
||||
event.payload, event.option);
|
||||
event.payload, event.option, event.value_payload);
|
||||
}
|
||||
|
||||
EventResult response = callback(event);
|
||||
if (logging.has_value()) {
|
||||
auto [logger, is_dispatch] = logging.value();
|
||||
logger.log_event_response(is_dispatch, event.opcode,
|
||||
response.return_value, response.payload);
|
||||
response.return_value, response.payload,
|
||||
response.value_payload);
|
||||
}
|
||||
|
||||
write_object(socket, response);
|
||||
|
||||
+34
-7
@@ -138,7 +138,8 @@ void Logger::log_event(bool is_dispatch,
|
||||
int index,
|
||||
intptr_t value,
|
||||
const EventPayload& payload,
|
||||
float option) {
|
||||
float option,
|
||||
const std::optional<EventPayload>& value_payload) {
|
||||
if (BOOST_UNLIKELY(verbosity >= Verbosity::most_events)) {
|
||||
if (should_filter_event(is_dispatch, opcode)) {
|
||||
return;
|
||||
@@ -161,7 +162,19 @@ void Logger::log_event(bool is_dispatch,
|
||||
message << "(index = " << index << ", value = " << value
|
||||
<< ", option = " << option << ", data = ";
|
||||
|
||||
// TODO: Print value payload
|
||||
// Only used during `effSetSpeakerArrangement` and
|
||||
// `effGetSpeakerArrangement`
|
||||
if (value_payload.has_value()) {
|
||||
std::visit(
|
||||
overload{
|
||||
[&](auto) {},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << "<" << speaker_arrangement.speakers.size()
|
||||
<< " input_speakers>, ";
|
||||
}},
|
||||
value_payload.value());
|
||||
}
|
||||
|
||||
std::visit(
|
||||
overload{
|
||||
[&](const std::nullptr_t&) { message << "<nullptr>"; },
|
||||
@@ -207,10 +220,12 @@ void Logger::log_event(bool is_dispatch,
|
||||
}
|
||||
}
|
||||
|
||||
void Logger::log_event_response(bool is_dispatch,
|
||||
int opcode,
|
||||
intptr_t return_value,
|
||||
const EventResultPayload& payload) {
|
||||
void Logger::log_event_response(
|
||||
bool is_dispatch,
|
||||
int opcode,
|
||||
intptr_t return_value,
|
||||
const EventResultPayload& payload,
|
||||
const std::optional<EventResultPayload>& value_payload) {
|
||||
if (BOOST_UNLIKELY(verbosity >= Verbosity::most_events)) {
|
||||
if (should_filter_event(is_dispatch, opcode)) {
|
||||
return;
|
||||
@@ -225,7 +240,19 @@ void Logger::log_event_response(bool is_dispatch,
|
||||
|
||||
message << return_value;
|
||||
|
||||
// TODO: Print value payload
|
||||
// Only used during `effSetSpeakerArrangement` and
|
||||
// `effGetSpeakerArrangement`
|
||||
if (value_payload.has_value()) {
|
||||
std::visit(
|
||||
overload{
|
||||
[&](auto) {},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << ", <" << speaker_arrangement.speakers.size()
|
||||
<< " input_speakers>";
|
||||
}},
|
||||
value_payload.value());
|
||||
}
|
||||
|
||||
std::visit(
|
||||
overload{
|
||||
[&](const std::nullptr_t&) {},
|
||||
|
||||
@@ -104,11 +104,14 @@ class Logger {
|
||||
int index,
|
||||
intptr_t value,
|
||||
const EventPayload& payload,
|
||||
float option);
|
||||
void log_event_response(bool is_dispatch,
|
||||
int opcode,
|
||||
intptr_t return_value,
|
||||
const EventResultPayload& payload);
|
||||
float option,
|
||||
const std::optional<EventPayload>& value_payload);
|
||||
void log_event_response(
|
||||
bool is_dispatch,
|
||||
int opcode,
|
||||
intptr_t return_value,
|
||||
const EventResultPayload& payload,
|
||||
const std::optional<EventResultPayload>& value_payload);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user