Audio decoder: correctly handle volume changes

1. set the volume for all channels
2. correctly set attribute muted according to the value (until now it
   was actually never set)
This commit is contained in:
Martin Pulec
2021-10-04 14:08:05 +02:00
parent 80924bfd1b
commit 54befa491a

View File

@@ -795,6 +795,11 @@ int decode_audio_frame_mulaw(struct coded_data *cdata, void *data, struct pbuf_s
void audio_decoder_set_volume(void *state, double val)
{
auto s = (struct state_audio_decoder *) state;
s->scale->scale = val;
int output_channels = s->channel_remapping ?
s->channel_map.max_output + 1: s->saved_desc.ch_count;
for (int i = 0; i < output_channels; ++i) {
s->scale[i].scale = val;
}
s->muted = val == 0.0;
}