From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 5/6] control: add a function to add an element of bytes type Date: Tue, 23 Feb 2016 10:37:42 +0100 Message-ID: References: <1456188510-7189-1-git-send-email-o-takashi@sakamocchi.jp> <1456188510-7189-6-git-send-email-o-takashi@sakamocchi.jp> <56CC18EE.1070800@ladisch.de> <56CC24EA.8060505@sakamocchi.jp> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id CA28C260535 for ; Tue, 23 Feb 2016 10:37:43 +0100 (CET) In-Reply-To: <56CC24EA.8060505@sakamocchi.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Sakamoto Cc: alsa-devel@alsa-project.org, Clemens Ladisch List-Id: alsa-devel@alsa-project.org On Tue, 23 Feb 2016 10:22:50 +0100, Takashi Sakamoto wrote: > > Hi, > > On Feb 23 2016 17:31, Clemens Ladisch wrote: > > Takashi Sakamoto wrote: > >> ALSA Ctl core allows userspace applications to add elements of bytes type, > >> while there's no APIs for this purpose in alsa-lib. > >> > >> This commit adds the missing function. > > > >> /** > >> + * \brief Create and add an user-defined control element of bytes type. > >> + * \param[in] ctl CTL handle. > >> + * \param[in,out] id ID of the new control element. > >> + * \param[in] channels The number of channels which a control element includes. > > > > For this control type, "count" might be a better name. > > Or at least say in the description that this is the number of bytes. > > For the name of this variable, I don't mind using 'count'. But then, in > next commit, snd_ctl_elem_add_bytes_set() has two arguments named > 'count'. And the consistency of API design is lost a bit. How about naming it a bit more descriptive way, e.g. count_xxx? "channel" isn't clearer than "count", IMO. > I think that naming the variables depends on interpretation of 'struct > snd_ctl_elem_value', therefore it mostly depends on taste of each > developers. For example, to 'bytes' type element set, we can interpret > 'struct snd_ctl_elem_value.bytes' as either 'byte array in an element' > or 'data for each channels with int8_t (=char) value for an element'. > > So I propose the design of ALSA control core. If possible, I'd like to > follow the design when adding new APIs for a consistent representation. > If the proposed design is not propper, we can change the design for > better shape. (but it will sometimes be a dull work depending on taste > of each developers.) > > And, I note that the name of 'channel' is picked up from Mixer APIs in > alsa-lib. It doesn't come from my brain ;) The mixer API is indeed focused on the mixer element, thus the concept of channel would match in most cases (but not all, sure). But control API is designed a bit more generically, so I understand Clemens' concern, too. thanks, Takashi