mixer/alsa: move alsa_mixer_elem_callback() into the AlsaMixer class

This commit is contained in:
Max Kellermann 2021-08-06 18:00:04 +02:00
parent e8f328d8ad
commit 3b6d4e6673

View File

@ -112,6 +112,10 @@ private:
unsigned GetPercentVolume() const noexcept { unsigned GetPercentVolume() const noexcept {
return NormalizedToPercent(GetNormalizedVolume()); return NormalizedToPercent(GetNormalizedVolume());
} }
static int ElemCallback(snd_mixer_elem_t *elem,
unsigned mask) noexcept;
}; };
static constexpr Domain alsa_mixer_domain("alsa_mixer"); static constexpr Domain alsa_mixer_domain("alsa_mixer");
@ -155,8 +159,8 @@ AlsaMixerMonitor::DispatchSockets() noexcept
* *
*/ */
static int int
alsa_mixer_elem_callback(snd_mixer_elem_t *elem, unsigned mask) AlsaMixer::ElemCallback(snd_mixer_elem_t *elem, unsigned mask) noexcept
{ {
AlsaMixer &mixer = *(AlsaMixer *) AlsaMixer &mixer = *(AlsaMixer *)
snd_mixer_elem_get_callback_private(elem); snd_mixer_elem_get_callback_private(elem);
@ -244,7 +248,7 @@ AlsaMixer::Setup()
throw FormatRuntimeError("no such mixer control: %s", control); throw FormatRuntimeError("no such mixer control: %s", control);
snd_mixer_elem_set_callback_private(elem, this); snd_mixer_elem_set_callback_private(elem, this);
snd_mixer_elem_set_callback(elem, alsa_mixer_elem_callback); snd_mixer_elem_set_callback(elem, ElemCallback);
monitor = new AlsaMixerMonitor(event_loop, handle); monitor = new AlsaMixerMonitor(event_loop, handle);
} }