Information about the audio types that are active in terms of audio concurrency management policies in effect on the system
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;
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:
QNX Neutrino