Re: Getting a notification of snd_kcontrol value change, defined in codec, in machine driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Jul 8 2018 08:10, Giedrius Trainavičius wrote:
What would be the best way in machine driver to learn about changes of alsa
mixer control values? The controls are defined in the codec driver.

The intended use case would be to use the current volume setting for the
codec on the board to forward to a dedicated microcontroller for visual
feedback.

I am aware that this could be bridged over via a user space program, but I
will have to forward the current PCM stream format to the MCU anyway from
hw_params, so ideally I would like all of this functionality contained in
the machine driver.

By assigning a function to 'struct snd_kcontrol.put', in-kernel drivers can receive any notification as a callback at changing value array of a control element set including handled conntrol element. When calling snd_ctl_new(), passing proper data for an argument of 'struct snd_kcontrol_new'.

I note that for userspace applications, ALSA control core supports notification mechanism for this purpose by typical I/O handling in UNIX environment. With alsa-lib, at first, call 'snd_ctl_subscribe_events()', then listen to file descriptor for opened ALSA control character device (or call 'snd_ctl_wait()'). When any events are emitted, the applications can read data of 'struct snd_ctl_event' from the descriptor and handle the notification by parsing the data.


Regards

Takashi Sakamoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel




[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux