Skip to content
Snippets Groups Projects
Commit 3a163f81 authored by Johannes Kauffmann's avatar Johannes Kauffmann Committed by Jean-Baptiste Kempf
Browse files

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 (d104faec).
parent 84dbe807
No related branches found
No related tags found
1 merge request!558audio_output/winstore: report initial volume/mute status
Pipeline #137504 passed with stage
in 13 minutes and 14 seconds
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment