Operating systems, development tools, and professional services
for connected embedded systems
for connected embedded systems
![]() |
![]() |
![]() |
![]() |
snd_mixer_callbacks_t
List of mixer callback functions
Synopsis:
typedef struct snd_mixer_callbacks {
void *private_data; /* should be used with an application */
void (*rebuild) (void *private_data);
void (*element) (void *private_data, int cmd,
snd_mixer_eid_t *eid);
void (*group) (void *private_data, int cmd,
snd_mixer_gid_t *gid);
void *reserved[28]; /* reserved for the future use - must be NULL!!! */
} snd_mixer_callbacks_t;
Description:
The snd_mixer_callbacks_t structure defines a list of callbacks that you can provide to handle events read by snd_mixer_read(). The members include:
- private_data, a pointer to arbitrary data that you want to pass to the callbacks
- pointers to the callbacks, which are described below.
![]() |
Make sure that you zero-fill any members that you aren't interested in. You can zero-fill the entire snd_mixer_callbacks_t structure if you aren't interested in tracking any of these events. The wave.c example does this. |
rebuild callback
The rebuild callback is called whenever the mixer is rebuilt. Its only argument is the private_data that you specified in this structure.
element callback
The element callback is called whenever an element event occurs. The arguments to this function are:
- private_data
- A pointer to the arbitrary data that you specified in this structure.
- cmd
- A SND_MIXER_READ_ELEMENT_* event code:
- SND_MIXER_READ_ELEMENT_VALUE -- the element's value changed.
- SND_MIXER_READ_ELEMENT_CHANGE -- the element changed (something other than its value).
- SND_MIXER_READ_ELEMENT_ADD -- the element was added (i.e. created).
- SND_MIXER_READ_ELEMENT_REMOVE -- the element was removed (i.e. destroyed).
- SND_MIXER_READ_ELEMENT_ROUTE -- the element's routing information changed.
- eid
- A pointer to a snd_mixer_eid_t structure that holds the ID of the element affected by the event.
group callback
The group callback is called whenever a group event occurs. The arguments are:
- private_data
- A pointer to the arbitrary data that you specified in this structure.
- cmd
- A SND_MIXER_READ_GROUP_* event code:
- SND_MIXER_READ_GROUP_VALUE -- the group's value changed.
- SND_MIXER_READ_GROUP_CHANGE -- the group changed (something other than the value).
- SND_MIXER_READ_GROUP_ADD -- the group was added (i.e. created).
- SND_MIXER_READ_GROUP_REMOVE -- the group was removed (i.e. destroyed).
- gid
- A pointer to a snd_mixer_gid_t structure that holds the ID of the group affected by the event.
Examples:
static void
mixer_callback_group (void *private_data, int cmd, snd_mixer_gid_t * gid)
{
Control_t *control, *prev;
PtWidget_t *above_wgt;
int i;
switch (cmd)
{
case SND_MIXER_READ_GROUP_VALUE:
for (control = control_head; control; control = control->next)
{
if (strcmp (control->group.gid.name, gid->name) == 0 &&
control->group.gid.index == gid->index)
{
if (snd_mixer_group_read (mixer_handle, &control->group) == 0)
base_update_control (control, NULL);
}
}
break;
case SND_MIXER_READ_GROUP_ADD:
if ((control = mixer_create_control (gid, control_tail)))
{
if (control->group.caps & SND_MIXER_GRPCAP_PLAY_GRP)
above_wgt = PtWidgetBrotherBehind (ABW_base_capture_pane);
else
above_wgt = PtWidgetBrotherBehind (ABW_base_status);
PtContainerHold (ABW_base_controls);
base_create_control (ABW_base_controls, &above_wgt, control);
PtContainerRelease (ABW_base_controls);
}
break;
case SND_MIXER_READ_GROUP_REMOVE:
for (prev = NULL, control = control_head; control;
prev = control, control = control->next)
{
if (strcmp (control->group.gid.name, gid->name) == 0 &&
control->group.gid.index == gid->index)
mixer_delete_control (control, prev);
}
break;
}
}
int
mixer_update (int fd, void *data, unsigned mode)
{
snd_mixer_callbacks_t callbacks = { 0, 0, 0, 0 };
callbacks.group = mixer_callback_group;
snd_mixer_read (mixer_handle, &callbacks);
return (Pt_CONTINUE);
}
Classification:
QNX Neutrino
See also:
snd_mixer_eid_t, snd_mixer_gid_t, snd_mixer_read()
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)
