Browse Source

audio_output/winstore: report initial volume/mute status

Previously, the volume and mute properties would read their default
values (0 and false respectively) since neither Open() or Start()
would call aout_{Volume,Mute}Report by themselves.
Now, the initial volume and mute status are read during Start(), which
means that setting the volume should work after the first
volume_changed event is received by a libvlc consumer.

Partial workaround for #26032.

As a result, reporting the volume level after (un)muting is no longer
necessary (d104faec19).
Johannes Kauffmann 5 years ago
committed by Alexandre Janniaux
parent
commit
7fedcff412
  1. 45
      modules/audio_output/winstore.c

45
modules/audio_output/winstore.c

@ -339,15 +339,6 @@ static int MuteSet(audio_output_t *aout, bool mute)
goto done;
}
float vol;
hr = ISimpleAudioVolume_GetMasterVolume(pc_AudioVolume, &vol);
if (FAILED(hr))
{
msg_Err(aout, "cannot get volume (error 0x%lX)", hr);
goto done;
}
aout_VolumeReport(aout, cbrtf(vol * sys->gain));
aout_MuteReport(aout, mute);
done:
@ -502,6 +493,42 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
break;
}
// Report the initial volume and mute status to the core
if (sys->client != NULL)
{
ISimpleAudioVolume* pc_AudioVolume = NULL;
hr = IAudioClient_GetService(sys->client, &IID_ISimpleAudioVolume, (void**)&pc_AudioVolume);
if (FAILED(hr))
{
msg_Err(aout, "cannot get volume service (error 0x%lx)", hr);
goto done;
}
float vol;
hr = ISimpleAudioVolume_GetMasterVolume(pc_AudioVolume, &vol);
if (FAILED(hr))
{
msg_Err(aout, "cannot get initial volume (error 0x%lX)", hr);
goto done;
}
WINBOOL mute;
hr = ISimpleAudioVolume_GetMute(pc_AudioVolume, &mute);
if (FAILED(hr))
{
msg_Err(aout, "cannot get initial mute (error 0x%lX)", hr);
goto done;
}
aout_VolumeReport(aout, cbrtf(vol * sys->gain));
aout_MuteReport(aout, mute != 0);
done:
if (pc_AudioVolume)
ISimpleAudioVolume_Release(pc_AudioVolume);
}
LeaveCriticalSection(&sys->lock);
LeaveMTA();

Loading…
Cancel
Save