![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
List of mixer callback functions
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;
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:
![]() |
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. |
The rebuild callback is called whenever the mixer is rebuilt. Its only argument is the private_data that you specified in this structure.
The element callback is called whenever an element event occurs. The arguments to this function are:
The group callback is called whenever a group event occurs. The arguments are:
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);
}
QNX Neutrino
snd_mixer_eid_t, snd_mixer_gid_t, snd_mixer_read()
![]() |
![]() |
![]() |
![]() |