[alsa-devel] [PATCH] test: fix comment about first two fields of TLV data payload
Clemens Ladisch
clemens at ladisch.de
Tue Aug 30 09:24:04 CEST 2016
Takashi Sakamoto wrote:
> On Aug 30 2016 14:32, Takashi Iwai wrote:
>> Takashi Sakamoto wrote:
>>> - orig[0] = snd_ctl_elem_id_get_numid(trial->id);
>>> + orig[0] = SNDRV_CTL_TLVT_CONTAINER;
>>> orig[1] = 6 * sizeof(orig[0]);
>>> orig[2] = 'a';
>>> orig[3] = 'b';
>>
>> The container TLV type expects other TLVs as its content. So the
>> above looks buggy to me...
>
> This is a test program just to serve to myself. So I hope this degree of roughness is allowed...
>
> Or could you please construct valid TLV array here?
In the kernel, you could use the macros from include/sound/tlv.h.
Either copy them into your test program, and use them directly:
/* 4 words: */
DECLARE_TLV_DB_MINMAX(orig, -60, +60);
/* container with only one subitem; 8 words: */
DECLARE_TLV_CONTAINER(orig_container,
TLV_ITEM(SNDRV_CTL_TLVT_CHMAP_FIXED,
SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE)
);
or create the values by hand:
orig[0] = SNDRV_CTL_TLVT_DB_MINMAX;
orig[1] = 2 * sizeof(*orig);
orig[2] = -60;
orig[3] = +60;
orig_container[0] = SNDRV_CTL_TLVT_CONTAINER;
orig_container[1] = 6 * sizeof(*orig_container);
orig_container[2] = SNDRV_CTL_TLVT_CHMAP_FIXED;
orig_container[3] = 4 * sizeof(*orig_container);
orig_container[4] = SNDRV_CHMAP_FL
orig_container[5] = SNDRV_CHMAP_FR;
orig_container[6] = SNDRV_CHMAP_FC;
orig_container[7] = SNDRV_CHMAP_LFE;
Regards,
Clemens
More information about the Alsa-devel
mailing list