audio messages: rename MUTE->MUTE_TOGGLE

* the MUTE commands are actually mute-toggle
This commit is contained in:
Martin Pulec
2023-09-25 14:31:37 +02:00
parent 9c015f96ad
commit 8a50ff4d2e
5 changed files with 10 additions and 10 deletions

View File

@@ -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;

View File

@@ -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 ")) {

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}