snd_ducking_status_t

Information about the audio types that are active in terms of audio concurrency management policies in effect on the system

Synopsis:

typedef struct snd_ducking_output_status {
    int       ntypes;
    snd_ducking_type_status_t active_types[1];
    #define SND_DUCKING_STATUS_NEXT_TYPE(type) \
                  ((void*)type + sizeof(*type) + \
                  (sizeof(type->pids[0]) * (type->npids - 1)))
} snd_ducking_status_t;

Description:

The list of active audio types currently running on the system and the information associated with each audio type. This datatype defines a SND_DUCKING_STATUS_NEXT_TYPE(type) macro, which you use to traverse the next structure. To use it, you pass a pointer to snd_ducking_type_status_t that you retrieve from the info member from calling snd_ctl_ducking_read(). Here's an example of a callback that uses the macro:
void audiomgmt_cb ( snd_ctl_t *hdl, void *private_data, int cmd)
{
	int status, i, j;
	const char *ducking_output = private_data;
	snd_ducking_status_t *info = NULL;
	snd_ducking_type_status_t *active_type = NULL;


	switch (cmd)
	{
		case SND_CTL_READ_AUDIOMGMT_CHG:
			if ((status = snd_ctl_ducking_read(hdl, ducking_output, &info )) != EOK)
			{
				printf("Failed to read ducking info - %s\n", snd_strerror(status));
				return;
			}

			printf("\nActive audio types = %d\n", info->ntypes);
			/* The active_types structure is variable in size and is based on the
			 * number of PIDs it references. For this reason, you must
			 * walk the active_type member of the info structure using the
			 * SND_DUCKING_STATUS_NEXT_TYPE() macro.
			 */
			for (i = 0, active_type = info->active_types;
                 i < info->ntypes; 
                 i++, active_type = SND_DUCKING_STATUS_NEXT_TYPE(active_type))
			{
				printf("Audio Type %s, Priority %d\n", active_type->name, active_type->prio);
				printf("\tPids (%d): ", active_type->npids);
				for (j = 0; j  < active_type->npids; j++)
				{
					printf("%d ", active_type->pids[j]);
				}
				printf("\n");
			}
			/* snd_ctl_ducking_read() allocates memory for the info buffer,
			 * so you must free the memory that was allocated for you.
			 */
			free(info);
			break;
		default:
			break;
	}
}

The members include:

ntypes
The number of active audio types.
active_types
An array of active audio types.

Classification:

QNX Neutrino