Skip to contentSkip to conversation

alsa-gobject: ctl: obsolete abstract class for snd_ctl_elem_info structure

DISCUSSION GitHub pull_request - opened 1 participant 1 message Jun 12, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

alsa-project/alsa-gobject pull request #32 was opened from takaswie:

In UAPI of Linux sound subsystem, snd_ctl_elem_info structure includes union member.

Current implementation of ALSACtl uses abstract class (ALSACtlElemInfo) and concrete class (ALSACtlElemInfoBool and so on) to represent variation corresponding to each of union member. However, the design pattern is not convenient for some language bindings.

For example, in Rust language, class-based inheritance is not supported. Gtk-rs project produces mechanism to upcast/downcast between super/sub classes and handles GObject class system. In my opinion, the code to upcast/downcast is a bit inconvenient to handle derivatives.

This patchset obsoletes usage of abstract class for ALSACtl. The target is ALSACtlElemInfo. Some APIs are added into the object to retrieve data for integer/integer64/enumerated element type, then the object becomes concrete class.

Request URL : https://github.com/alsa-project/alsa-gobject/pull/32
Patch URL : https://github.com/alsa-project/alsa-gobject/pull/32.patch
Repository URL: https://github.com/alsa-project/alsa-gobject