mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-10-29 05:40:25 -04:00 
			
		
		
		
	Added snd_ctl_elem_info_get_dimensions() and snd_ctl_elem_info_get_dimension() functions.
This commit is contained in:
		
							parent
							
								
									2978d18323
								
							
						
					
					
						commit
						368918b453
					
				
					 5 changed files with 67 additions and 11 deletions
				
			
		|  | @ -340,7 +340,6 @@ int snd_ctl_elem_info_is_volatile(const snd_ctl_elem_info_t *obj); | |||
| int snd_ctl_elem_info_is_inactive(const snd_ctl_elem_info_t *obj); | ||||
| int snd_ctl_elem_info_is_locked(const snd_ctl_elem_info_t *obj); | ||||
| int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj); | ||||
| int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj); | ||||
| pid_t snd_ctl_elem_info_get_owner(const snd_ctl_elem_info_t *obj); | ||||
| unsigned int snd_ctl_elem_info_get_count(const snd_ctl_elem_info_t *obj); | ||||
| long snd_ctl_elem_info_get_min(const snd_ctl_elem_info_t *obj); | ||||
|  | @ -352,6 +351,8 @@ long long snd_ctl_elem_info_get_step64(const snd_ctl_elem_info_t *obj); | |||
| unsigned int snd_ctl_elem_info_get_items(const snd_ctl_elem_info_t *obj); | ||||
| void snd_ctl_elem_info_set_item(snd_ctl_elem_info_t *obj, unsigned int val); | ||||
| const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj); | ||||
| int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj); | ||||
| int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx); | ||||
| void snd_ctl_elem_info_get_id(const snd_ctl_elem_info_t *obj, snd_ctl_elem_id_t *ptr); | ||||
| unsigned int snd_ctl_elem_info_get_numid(const snd_ctl_elem_info_t *obj); | ||||
| snd_ctl_elem_iface_t snd_ctl_elem_info_get_interface(const snd_ctl_elem_info_t *obj); | ||||
|  |  | |||
|  | @ -574,7 +574,7 @@ struct sndrv_timer_ginfo { | |||
| 	int card;			/* card number */ | ||||
| 	unsigned char id[64];		/* timer identification */ | ||||
| 	unsigned char name[80];		/* timer name */ | ||||
| 	unsigned long ticks;		/* maximum ticks between interrupts */ | ||||
| 	unsigned long reserved0;	/* reserved for future use */ | ||||
| 	unsigned long resolution;	/* average period resolution in ns */ | ||||
| 	unsigned long resolution_min;	/* minimal period resolution in ns */ | ||||
| 	unsigned long resolution_max;	/* maximal period resolution in ns */ | ||||
|  | @ -584,9 +584,8 @@ struct sndrv_timer_ginfo { | |||
| 
 | ||||
| struct sndrv_timer_gparams { | ||||
| 	struct sndrv_timer_id tid;	/* requested timer ID */ | ||||
| 	unsigned long period;		/* requested minimal period in ns */ | ||||
| 	unsigned long period_num;	/* requested precise period resolution (in seconds) - numerator */ | ||||
| 	unsigned long period_den;	/* requested precise period resolution (in seconds) - denominator */ | ||||
| 	unsigned long period_num;	/* requested precise period duration (in seconds) - numerator */ | ||||
| 	unsigned long period_den;	/* requested precise period duration (in seconds) - denominator */ | ||||
| 	unsigned char reserved[32]; | ||||
| }; | ||||
| 
 | ||||
|  | @ -608,7 +607,7 @@ struct sndrv_timer_info { | |||
| 	int card;			/* card number */ | ||||
| 	unsigned char id[64];		/* timer identificator */ | ||||
| 	unsigned char name[80];		/* timer name */ | ||||
| 	unsigned long ticks;		/* maximum ticks between interrupts */ | ||||
| 	unsigned long reserved0;	/* reserved for future use */ | ||||
| 	unsigned long resolution;	/* average period resolution in ns */ | ||||
| 	unsigned char reserved[64];	/* reserved */ | ||||
| }; | ||||
|  | @ -682,7 +681,7 @@ struct sndrv_timer_tread { | |||
|  *                                                                          * | ||||
|  ****************************************************************************/ | ||||
| 
 | ||||
| #define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 1) | ||||
| #define SNDRV_CTL_VERSION		SNDRV_PROTOCOL_VERSION(2, 0, 2) | ||||
| 
 | ||||
| struct sndrv_ctl_card_info { | ||||
| 	int card;			/* card number */ | ||||
|  | @ -727,7 +726,8 @@ enum sndrv_ctl_elem_iface { | |||
| #define SNDRV_CTL_ELEM_ACCESS_INACTIVE		(1<<8)	/* control does actually nothing, but may be updated */ | ||||
| #define SNDRV_CTL_ELEM_ACCESS_LOCK		(1<<9)	/* write lock */ | ||||
| #define SNDRV_CTL_ELEM_ACCESS_OWNER		(1<<10)	/* write lock owner */ | ||||
| #define SNDRV_CTL_ELEM_ACCESS_INDIRECT		(1<<31)	/* indirect access */ | ||||
| #define SNDRV_CTL_ELEM_ACCESS_DINDIRECT		(1<<30)	/* indirect access for matrix dimensions in the info structure */ | ||||
| #define SNDRV_CTL_ELEM_ACCESS_INDIRECT		(1<<31)	/* indirect access for element value in the value structure */ | ||||
| 
 | ||||
| /* for further details see the ACPI and PCI power management specification */ | ||||
| #define SNDRV_CTL_POWER_D0		0x0000	/* full On */ | ||||
|  | @ -779,7 +779,11 @@ struct sndrv_ctl_elem_info { | |||
| 		} enumerated; | ||||
| 		unsigned char reserved[128]; | ||||
| 	} value; | ||||
| 	unsigned char reserved[64]; | ||||
| 	union { | ||||
| 		unsigned short d[4];		/* dimensions */ | ||||
| 		unsigned short *d_ptr;		/* indirect */ | ||||
| 	} dimen; | ||||
| 	unsigned char reserved[64-4*sizeof(unsigned short)]; | ||||
| }; | ||||
| 
 | ||||
| struct sndrv_ctl_elem_value { | ||||
|  |  | |||
|  | @ -101,3 +101,10 @@ ALSA_0.9.0 { | |||
|     snd_timer_params_set_filter; | ||||
|     snd_timer_params_get_filter; | ||||
| } ALSA_0.9.0rc8; | ||||
| 
 | ||||
| ALSA_0.9.3 { | ||||
|   global: | ||||
| 
 | ||||
|     snd_ctl_elem_info_get_dimensions; | ||||
|     snd_ctl_elem_info_get_dimension; | ||||
| } ALSA_0.9.0; | ||||
|  |  | |||
|  | @ -1543,7 +1543,7 @@ int snd_ctl_elem_info_is_owner(const snd_ctl_elem_info_t *obj) | |||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * \brief Get info about values passing policy from a CTL element id/info | ||||
|  * \brief (DEPRECATED) Get info about values passing policy from a CTL element value | ||||
|  * \param obj CTL element id/info | ||||
|  * \return 0 if element value need to be passed by contents, 1 if need to be passed with a pointer | ||||
|  */ | ||||
|  | @ -1552,6 +1552,7 @@ int snd_ctl_elem_info_is_indirect(const snd_ctl_elem_info_t *obj) | |||
| 	assert(obj); | ||||
| 	return !!(obj->access & SNDRV_CTL_ELEM_ACCESS_INDIRECT); | ||||
| } | ||||
| link_warning(snd_ctl_elem_info_is_indirect, "Warning: snd_ctl_elem_info_is_indirect is deprecated, do not use it"); | ||||
| 
 | ||||
| /**
 | ||||
|  * \brief Get owner of a locked element | ||||
|  | @ -1682,6 +1683,49 @@ const char *snd_ctl_elem_info_get_item_name(const snd_ctl_elem_info_t *obj) | |||
| 	return obj->value.enumerated.name; | ||||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * \brief Get count of dimensions for given element | ||||
|  * \param obj CTL element id/info | ||||
|  * \return zero value if no dimensions are defined, otherwise positive value with count of dimensions | ||||
|  */ | ||||
| #ifndef DOXYGEN | ||||
| int INTERNAL(snd_ctl_elem_info_get_dimensions)(const snd_ctl_elem_info_t *obj) | ||||
| #else | ||||
| int snd_ctl_elem_info_get_dimensions(const snd_ctl_elem_info_t *obj) | ||||
| #endif | ||||
| { | ||||
| 	int i; | ||||
| 
 | ||||
| 	assert(obj); | ||||
| 	if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT) | ||||
| 		return 0;			/* FIXME: implement indirect access as well */ | ||||
| 	for (i = 3; i >= 0; i++) | ||||
| 		if (obj->dimen.d[0]) | ||||
| 			break; | ||||
| 	return i >= 0 ? i + 1 : 0; | ||||
| } | ||||
| use_default_symbol_version(__snd_ctl_elem_info_get_dimensions, snd_ctl_elem_info_get_dimensions, ALSA_0.9.3); | ||||
| 
 | ||||
| /**
 | ||||
|  * \brief Get specified of dimension width for given element | ||||
|  * \param obj CTL element id/info | ||||
|  * \return zero value if no dimension width is defined, otherwise positive value with with of specified dimension | ||||
|  */ | ||||
| #ifndef DOXYGEN | ||||
| int INTERNAL(snd_ctl_elem_info_get_dimension)(const snd_ctl_elem_info_t *obj, unsigned int idx) | ||||
| #else | ||||
| int snd_ctl_elem_info_get_dimension(const snd_ctl_elem_info_t *obj, unsigned int idx) | ||||
| #endif | ||||
| { | ||||
| 	assert(obj); | ||||
| 	if (obj->access & SNDRV_CTL_ELEM_ACCESS_DINDIRECT) | ||||
| 		return 0;			/* FIXME: implement indirect access as well */ | ||||
| 	if (idx >= 3) | ||||
| 		return 0; | ||||
| 	return obj->dimen.d[0]; | ||||
| } | ||||
| use_default_symbol_version(__snd_ctl_elem_info_get_dimension, snd_ctl_elem_info_get_dimension, ALSA_0.9.3); | ||||
| 
 | ||||
| /**
 | ||||
|  * \brief Get CTL element identifier of a CTL element id/info | ||||
|  * \param obj CTL element id/info | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ const char *_snd_module_control_hw = ""; | |||
| #endif | ||||
| 
 | ||||
| #define SNDRV_FILE_CONTROL	"/dev/snd/controlC%i" | ||||
| #define SNDRV_CTL_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 0) | ||||
| #define SNDRV_CTL_VERSION_MAX	SNDRV_PROTOCOL_VERSION(2, 0, 2) | ||||
| 
 | ||||
| typedef struct { | ||||
| 	int card; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jaroslav Kysela
						Jaroslav Kysela