Closed flatmax closed 1 year ago
The name is only one from multiple fields identifying the control element. Use snd_ctl_event_elem_get_id
to get the id structure which contains all fields.
Also, it seems that you mix two APIs. Do not use raw snd_ctl_*
functions with the snd_mixer_*
functions. It won't work. The control mapping between those two APIs is not straight (control elements and mixer elements are two different things).
What you're trying to implement?
I'm trying to catch mixer element changes as events. Then I want to fetch the changed mixer element and propagate that element state through other user applications (over the network for example),
On 6/1/23 21:06, Jaroslav Kysela wrote:
What you're trying to implement?
— Reply to this email directly, view it on GitHub https://github.com/alsa-project/alsa-lib/issues/291#issuecomment-1373425572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLUB3T3VMPTPBGZTPIL33WQ7VCPANCNFSM6AAAAAATS45PGI. You are receiving this because you authored the thread.Message ID: @.***>
I added a MixerEvents class code to handle mixer events in the same way amixer handles it. Unfortunately I can't seem to get my threaded snd_mixer_wait function to release with an event.
Matt
On 9/1/23 10:14, Matt Flax wrote:
I'm trying to catch mixer element changes as events. Then I want to fetch the changed mixer element and propagate that element state through other user applications (over the network for example),
On 6/1/23 21:06, Jaroslav Kysela wrote:
What you're trying to implement?
— Reply to this email directly, view it on GitHub https://github.com/alsa-project/alsa-lib/issues/291#issuecomment-1373425572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLUB3T3VMPTPBGZTPIL33WQ7VCPANCNFSM6AAAAAATS45PGI. You are receiving this because you authored the thread.Message ID: @.***>
OK, got it to work now.
The thing I missed was that snd_mixer_wait should only be called once the mixer has been loaded. If it is called before, then it will wait forever missing events.
Here is the code :
https://github.com/flatmax/gtkiostream/blob/master/include/ALSA/MixerEvents.H
On 9/1/23 14:47, Matt Flax wrote:
I added a MixerEvents class code to handle mixer events in the same way amixer handles it. Unfortunately I can't seem to get my threaded snd_mixer_wait function to release with an event.
Matt
On 9/1/23 10:14, Matt Flax wrote:
I'm trying to catch mixer element changes as events. Then I want to fetch the changed mixer element and propagate that element state through other user applications (over the network for example),
On 6/1/23 21:06, Jaroslav Kysela wrote:
What you're trying to implement?
— Reply to this email directly, view it on GitHub https://github.com/alsa-project/alsa-lib/issues/291#issuecomment-1373425572, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFLUB3T3VMPTPBGZTPIL33WQ7VCPANCNFSM6AAAAAATS45PGI. You are receiving this because you authored the thread.Message ID: @.***>
I would like to get a snd_mixer_elem_t from a control event :
My problem is sometimes there are mixer elements with the same names. I can get the mixer element's name like so :
std::string elemName(snd_ctl_event_elem_get_name(event));
But when I search for the simple mixer element based on the element name, the search will stop at the first found matching element. A few issues arise with this approach, for example when the same simple mixer element is in both the playback and capture alsamixer sections. None the less I can iterate through the name for comparson :
It would be better if there was a way to find the exact simple mixer element which triggered the event in the first place. Is that possible ? I am aware of the snd_ctl_event_elem_get_numid function, but I can't see how to find a simple mixer element which matches that numid.