Yair K. wrote:
>
> At the moment, the only way I know of to discover whether new control have 
> been added with the current API is to poll the device for total number of 
> mixers (via SNDCTL_MIX_NREXT) and to compare this to the previous number 
> (this is what ossxmix does for VMIX). If so, than the groups may be 
> ignored/throwed away and it won't matter.
>
> (BTW, If controls can also be removed, and not just added, than there's an 
> edge case:
>   A. Total number can be the same even in a case of change. (1-1=0)
>   B. ossxmix polls the controls, if all the newly added mixers have the same 
> control numbers than get_value won't fail and the display won't be reloaded.
>
>  Not sure how to really fix this: A separate flag in SNDCTL_MIXERINFO to 
> inform of such changes? Or maybe changing a group's modify_counter in 
> SNDCTL_MIX_EXTINFO?)
>   
SNDCTL_MIX_NREXT cannot be used to detect this kind of situation. 
However the timestamp field of SNDCTL_MIX_READ/WRITE will trigger error 
(errno=EIDRM) if the control has been recreated.

Maybe group's update_counter could be used to return the number of 
controls located inside the group and it's sub groups. Every time a new 
control is added the mixer core will increment the update_counter for 
the parent groups (up to the root). In this way ossxmix can find out if 
the group is empty or not simply by looking if update_counter>0.

Best regards,

Hannu
_______________________________________________
oss-devel mailing list
oss-devel@mailman.opensound.com
http://mailman.opensound.com/mailman/listinfo/oss-devel

Reply via email to