From 8a50ff4d2e9d384e2e68cf760f43107a3269268b Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 25 Sep 2023 14:31:37 +0200 Subject: [PATCH] audio messages: rename MUTE->MUTE_TOGGLE * the MUTE commands are actually mute-toggle --- src/audio/audio.cpp | 8 ++++---- src/control_socket.cpp | 2 +- src/keyboard_control.cpp | 4 ++-- src/messaging.h | 4 ++-- src/video_rxtx/rtp.cpp | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index 22586dd31..6ee9547ff 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -624,9 +624,9 @@ static struct response * audio_receiver_process_message(struct state_audio *s, s } case RECEIVER_MSG_INCREASE_VOLUME: case RECEIVER_MSG_DECREASE_VOLUME: - case RECEIVER_MSG_MUTE: + case RECEIVER_MSG_MUTE_TOGGLE: { - if (msg->type == RECEIVER_MSG_MUTE) { + if (msg->type == RECEIVER_MSG_MUTE_TOGGLE) { s->muted_receiver = !s->muted_receiver; } else if (msg->type == RECEIVER_MSG_INCREASE_VOLUME) { s->volume *= 1.1; @@ -635,7 +635,7 @@ static struct response * audio_receiver_process_message(struct state_audio *s, s } double new_volume = s->muted_receiver ? 0.0 : s->volume; double db = 20.0 * log10(new_volume); - if (msg->type == RECEIVER_MSG_MUTE) { + if (msg->type == RECEIVER_MSG_MUTE_TOGGLE) { LOG(LOG_LEVEL_NOTICE) << "Audio receiver " << (s->muted_receiver ? "" : "un") << "muted.\n"; } else { log_msg(LOG_LEVEL_INFO, "Playback volume: %.2f%% (%+.2f dB)\n", new_volume * 100.0, db); @@ -941,7 +941,7 @@ static struct response *audio_sender_process_message(struct state_audio *s, stru return new_response(RESPONSE_OK, status); break; } - case SENDER_MSG_MUTE: + case SENDER_MSG_MUTE_TOGGLE: s->muted_sender = !s->muted_sender; log_msg(LOG_LEVEL_NOTICE, "Audio sender %smuted.\n", s->muted_sender ? "" : "un"); break; diff --git a/src/control_socket.cpp b/src/control_socket.cpp index 8edd5ad97..710c6b7b0 100644 --- a/src/control_socket.cpp +++ b/src/control_socket.cpp @@ -313,7 +313,7 @@ process_audio_message(struct module *root_module, const char *cmd) strncpy(path, "audio.receiver", sizeof path); auto *msg = (struct msg_receiver *) new_message( sizeof(struct msg_receiver)); - msg->type = RECEIVER_MSG_MUTE; + msg->type = RECEIVER_MSG_MUTE_TOGGLE; return send_message(root_module, path, (struct message *) msg); } if (prefix_matches(cmd, "volume ")) { diff --git a/src/keyboard_control.cpp b/src/keyboard_control.cpp index 41a2cbd30..1f4b237b5 100644 --- a/src/keyboard_control.cpp +++ b/src/keyboard_control.cpp @@ -559,7 +559,7 @@ void keyboard_control::impl::run() case '*': m->type = RECEIVER_MSG_INCREASE_VOLUME; break; case '9': case '/': m->type = RECEIVER_MSG_DECREASE_VOLUME; break; - case 'm': m->type = RECEIVER_MSG_MUTE; break; + case 'm': m->type = RECEIVER_MSG_MUTE_TOGGLE; break; } auto resp = send_message(m_root, path, (struct message *) m); @@ -570,7 +570,7 @@ void keyboard_control::impl::run() { char path[] = "audio.sender"; auto m = (struct msg_sender *) new_message(sizeof(struct msg_sender)); - m->type = SENDER_MSG_MUTE; + m->type = SENDER_MSG_MUTE_TOGGLE; auto resp = send_message(m_root, path, (struct message *) m); free_response(resp); diff --git a/src/messaging.h b/src/messaging.h index d4ae12241..60b697b47 100644 --- a/src/messaging.h +++ b/src/messaging.h @@ -99,7 +99,7 @@ enum msg_sender_type { SENDER_MSG_CHANGE_RECEIVER, SENDER_MSG_CHANGE_PORT, SENDER_MSG_GET_STATUS, - SENDER_MSG_MUTE, + SENDER_MSG_MUTE_TOGGLE, SENDER_MSG_CHANGE_FEC, SENDER_MSG_QUERY_VIDEO_MODE, SENDER_MSG_RESET_SSRC, @@ -124,7 +124,7 @@ enum msg_receiver_type { RECEIVER_MSG_GET_AUDIO_STATUS, RECEIVER_MSG_INCREASE_VOLUME, RECEIVER_MSG_DECREASE_VOLUME, - RECEIVER_MSG_MUTE, + RECEIVER_MSG_MUTE_TOGGLE, }; struct msg_receiver { struct message m; diff --git a/src/video_rxtx/rtp.cpp b/src/video_rxtx/rtp.cpp index e08be2ce5..d7aba34e3 100644 --- a/src/video_rxtx/rtp.cpp +++ b/src/video_rxtx/rtp.cpp @@ -187,7 +187,7 @@ struct response *rtp_video_rxtx::process_sender_message(struct msg_sender *msg) } break; case SENDER_MSG_GET_STATUS: - case SENDER_MSG_MUTE: + case SENDER_MSG_MUTE_TOGGLE: log_msg(LOG_LEVEL_ERROR, "Unexpected message!\n"); break; }